def lamost(dr=2, cat='all', verbose=True): filePath = path.lamostPath(dr=dr, cat=cat) if os.path.exists(filePath): return None downloadPath = filePath.replace( filePath, 'http://dr2.lamost.org/catdl?name=%s' % os.path.basename(filePath)) _download_file(downloadPath + '.gz', filePath + '.gz', verbose=verbose) # gunzip the file try: subprocess.check_call(['gunzip', filePath + '.gz']) except subprocess.CalledProcessError: raise IOError('gunzipping the LAMOST catalog %s failed ...' % os.path.basename(filePath)) return None
def lamost(dr=2, cat='all'): """ NAME: lamost PURPOSE: Load the LAMOST data INPUT: dr= (2) data release cat= ('all') 'all', 'A', 'M', 'star' (see LAMOST docs) OUTPUT: data table HISTORY: 2016-10-13 - Written - Bovy (UofT) """ filePath = path.lamostPath(dr=dr, cat=cat) if not os.path.exists(filePath): download.lamost(dr=dr, cat=cat) data = fitsread(filePath, 1) return data