def apStar(loc_id,apogee_id,dr=None): """ NAME: apStar PURPOSE: download an apStar file INPUT: loc_id - location ID apogee_id - APOGEE ID of the star dr= return the path corresponding to this data release (general default) OUTPUT: (none; just downloads) HISTORY: 2015-01-13 - Written - Bovy (IAS) """ if dr is None: dr= path._default_dr() # First make sure the file doesn't exist filePath= path.apStarPath(loc_id,apogee_id,dr=dr) if os.path.exists(filePath): return None # Create the file path downloadPath= filePath.replace(os.path.join(path._APOGEE_DATA, _dr_string(dr)), _base_url(dr=dr)) _download_file(downloadPath,filePath,dr) return None
def apStar(loc_id, apogee_id, telescope='apo25m', ext=1, dr=None, header=True, aspcapWavegrid=False): """ NAME: apStar PURPOSE: Read an apStar file for a given star INPUT: loc_id - location ID (field for 1m targets or after DR14) apogee_id - APOGEE ID of the star telescope= telescope used ('apo25m' [default], 'apo1m', 'lco25m') ext= (1) extension to load header= (True) if True, also return the header dr= return the path corresponding to this data release (general default) aspcapWavegrid= (False) if True, output the spectrum on the ASPCAP wavelength grid OUTPUT: apStar file or (apStar file, header) HISTORY: 2015-01-13 - Written - Bovy (IAS) 2018-01-22 - Edited for new post-DR14 path structure - Bovy (UofT) """ filePath = path.apStarPath(loc_id, apogee_id, dr=dr, telescope=telescope) if not os.path.exists(filePath): download.apStar(loc_id, apogee_id, dr=dr, telescope=telescope) data = fitsread(filePath, ext, header=header) return data
def apStar(loc_id, apogee_id, ext=1, dr=None, header=True, aspcapWavegrid=False): """ NAME: apStar PURPOSE: Read an apStar file for a given star INPUT: loc_id - location ID (field for 1m targets) apogee_id - APOGEE ID of the star ext= (1) extension to load header= (True) if True, also return the header dr= return the path corresponding to this data release (general default) aspcapWavegrid= (False) if True, output the spectrum on the ASPCAP wavelength grid OUTPUT: apStar file or (apStar file, header) HISTORY: 2015-01-13 - Written - Bovy (IAS) """ filePath = path.apStarPath(loc_id, apogee_id, dr=dr) if not os.path.exists(filePath): download.apStar(loc_id, apogee_id, dr=dr) data = fitsio.read(filePath, ext, header=header) return data
def apStar(loc_id,apogee_id,telescope='apo25m',dr=None): """ NAME: apStar PURPOSE: download an apStar file INPUT: loc_id - location ID apogee_id - APOGEE ID of the star telescope= telescope used ('apo25m' [default], 'apo1m', 'lco25m') dr= return the path corresponding to this data release (general default) OUTPUT: (none; just downloads) HISTORY: 2015-01-13 - Written - Bovy (IAS) 2018-01-22 - Edited for new post-DR14 path structure - Bovy (UofT) """ if dr is None: dr= path._default_dr() # First make sure the file doesn't exist filePath= path.apStarPath(loc_id,apogee_id,dr=dr,telescope=telescope) if os.path.exists(filePath): return None # Create the file path downloadPath= filePath.replace(os.path.join(path._APOGEE_DATA, _dr_string(dr)), _base_url(dr=dr)) _download_file(downloadPath,filePath,dr) return None
def apStar(loc_id,apogee_id,telescope='apo25m', ext=1,dr=None,header=True,aspcapWavegrid=False): """ NAME: apStar PURPOSE: Read an apStar file for a given star INPUT: loc_id - location ID (field for 1m targets or after DR14) apogee_id - APOGEE ID of the star telescope= telescope used ('apo25m' [default], 'apo1m', 'lco25m') ext= (1) extension to load header= (True) if True, also return the header dr= return the path corresponding to this data release (general default) aspcapWavegrid= (False) if True, output the spectrum on the ASPCAP wavelength grid OUTPUT: apStar file or (apStar file, header) HISTORY: 2015-01-13 - Written - Bovy (IAS) 2018-01-22 - Edited for new post-DR14 path structure - Bovy (UofT) """ filePath= path.apStarPath(loc_id,apogee_id,dr=dr,telescope=telescope) if not os.path.exists(filePath): download.apStar(loc_id,apogee_id,dr=dr,telescope=telescope) data= fitsread(filePath,ext,header=header) return data
def apStar(loc_id, apogee_id, dr=None): """ NAME: apStar PURPOSE: download an apStar file INPUT: loc_id - location ID apogee_id - APOGEE ID of the star dr= return the path corresponding to this data release (general default) OUTPUT: (none; just downloads) HISTORY: 2015-01-13 - Written - Bovy (IAS) """ if dr is None: dr = path._default_dr() # First make sure the file doesn't exist filePath = path.apStarPath(loc_id, apogee_id, dr=dr) if os.path.exists(filePath): return None # Create the file path downloadPath = filePath.replace( os.path.join(path._APOGEE_DATA, _dr_string(dr)), _base_url(dr=dr)) _download_file(downloadPath, filePath, dr) return None
def apStar(loc_id,apogee_id,ext=1,dr=None,header=True,aspcapWavegrid=False): """ NAME: apStar PURPOSE: Read an apStar file for a given star INPUT: loc_id - location ID (field for 1m targets) apogee_id - APOGEE ID of the star ext= (1) extension to load header= (True) if True, also return the header dr= return the path corresponding to this data release (general default) aspcapWavegrid= (False) if True, output the spectrum on the ASPCAP wavelength grid OUTPUT: apStar file or (apStar file, header) HISTORY: 2015-01-13 - Written - Bovy (IAS) """ filePath= path.apStarPath(loc_id,apogee_id,dr=dr) if not os.path.exists(filePath): download.apStar(loc_id,apogee_id,dr=dr) data= fitsio.read(filePath,ext,header=header) return data
INPUT: loc_id - location ID (field for 1m targets or after DR14) apogee_id - APOGEE ID of the star telescope= telescope used ('apo25m' [default], 'apo1m', 'lco25m') ext= (1) extension to load header= (True) if True, also return the header dr= return the path corresponding to this data release (general default) aspcapWavegrid= (False) if True, output the spectrum on the ASPCAP wavelength grid OUTPUT: apStar file or (apStar file, header) HISTORY: 2015-01-13 - Written - Bovy (IAS) 2018-01-22 - Edited for new post-DR14 path structure - Bovy (UofT) """ filePath= path.apStarPath(loc_id,apogee_id,dr=dr,telescope=telescope) if not os.path.exists(filePath): download.apStar(loc_id,apogee_id,dr=dr,telescope=telescope) data= fitsread(filePath,ext,header=header) return data def apVisit(plateid, mjd, fiberid, ext=1, telescope='apo25m', dr=None, header=False): """ NAME: apVisit PURPOSE: Read a single apVisit file for a given plate, MJD, and fiber INPUT: plateid = 4-digit plate ID (field for 1m targets), float mjd = 5-digit MJD, float fiberid = 3-digit fiber ID, float ext = (1) extension to load