Beispiel #1
0
def apogeeObject(field_name, dr=None):
    """
    NAME:
       apogeeObject
    PURPOSE:
       download an apogeeObject file
    INPUT:
       field_name - name of the field
       dr= return the path corresponding to this data release (general default)
    OUTPUT:
       (none; just downloads)
    HISTORY:
       2015-12-27 - Written - Bovy (UofT)
    """
    if dr is None: dr = path._default_dr()
    # First make sure the file doesn't exist
    filePath = path.apogeeObjectPath(field_name, dr=dr)
    if os.path.exists(filePath): return None
    # Create the file path
    downloadPath= os.path.join(path._APOGEE_DATA,'dr%s' % dr,
                               'apogee','target','apogeeObject',
                               os.path.basename(filePath))\
                               .replace(os.path.join(path._APOGEE_DATA,
                                                     _dr_string(dr)),
                                        _base_url(dr=dr))
    _download_file(downloadPath, filePath, dr)
    return None
Beispiel #2
0
def apogeeObject(field_name,dr=None):
    """
    NAME:
       apogeeObject
    PURPOSE:
       download an apogeeObject file
    INPUT:
       field_name - name of the field
       dr= return the path corresponding to this data release (general default)
    OUTPUT:
       (none; just downloads)
    HISTORY:
       2015-12-27 - Written - Bovy (UofT)
    """
    if dr is None: dr= path._default_dr()
    # First make sure the file doesn't exist
    filePath= path.apogeeObjectPath(field_name,dr=dr)
    if os.path.exists(filePath): return None
    # Create the file path    
    downloadPath= os.path.join(path._APOGEE_DATA,'dr%s' % dr,
                               'apogee','target','apogeeObject',
                               os.path.basename(filePath))\
                               .replace(os.path.join(path._APOGEE_DATA,
                                                     _dr_string(dr)),
                                        _base_url(dr=dr))
    _download_file(downloadPath,filePath,dr)
    return None
Beispiel #3
0
def apogeeObject(field_name, dr=None, ak=True, akvers='targ'):
    """
    NAME:
       apogeePlate
    PURPOSE:
       read the apogeePlate file
    INPUT:
       field_name - name of the field
       dr= return the file corresponding to this data release
       ak= (default: True) only use objects for which dereddened mags exist
       akvers= 'targ' (default) or 'wise': use target AK (AK_TARG) or AK derived from all-sky WISE (AK_WISE)
    OUTPUT:
       apogeeObject file
    HISTORY:
       2013-11-04 - Written - Bovy (IAS)
    """
    filePath = path.apogeeObjectPath(field_name, dr=dr)
    if not os.path.exists(filePath):
        download.apogeeObject(field_name, dr=dr)
    data = fitsio.read(filePath)
    if akvers.lower() == 'targ':
        aktag = 'AK_TARG'
    elif akvers.lower() == 'wise':
        aktag = 'AK_WISE'
    if ak:
        data = data[True - numpy.isnan(data[aktag])]
        data = data[(data[aktag] > -50.)]
    #Add dereddened J, H, and Ks
    aj = data[aktag] * 2.5
    ah = data[aktag] * 1.55
    if _ESUTIL_LOADED:
        data = esutil.numpy_util.add_fields(data,
                                            [('J0', float), ('H0', float),
                                             ('K0', float)])
        data['J0'] = data['J'] - aj
        data['H0'] = data['H'] - ah
        data['K0'] = data['K'] - data[aktag]
        data['J0'][(data[aktag] <= -50.)] = -9999.9999
        data['H0'][(data[aktag] <= -50.)] = -9999.9999
        data['K0'][(data[aktag] <= -50.)] = -9999.9999
    else:
        warnings.warn(
            "Extinction-corrected J,H,K not added because esutil is not installed",
            RuntimeWarning)
    return data
Beispiel #4
0
def apogeeObject(field_name,dr=None,
                 ak=True,
                 akvers='targ'):
    """
    NAME:
       apogeePlate
    PURPOSE:
       read the apogeePlate file
    INPUT:
       field_name - name of the field
       dr= return the file corresponding to this data release
       ak= (default: True) only use objects for which dereddened mags exist
       akvers= 'targ' (default) or 'wise': use target AK (AK_TARG) or AK derived from all-sky WISE (AK_WISE)
    OUTPUT:
       apogeeObject file
    HISTORY:
       2013-11-04 - Written - Bovy (IAS)
    """
    filePath= path.apogeeObjectPath(field_name,dr=dr)
    if not os.path.exists(filePath):
        download.apogeeObject(field_name,dr=dr)
    data= fitsio.read(filePath)
    if akvers.lower() == 'targ':
        aktag= 'AK_TARG'
    elif akvers.lower() == 'wise':
        aktag= 'AK_WISE'
    if ak:
        data= data[True-numpy.isnan(data[aktag])]
        data= data[(data[aktag] > -50.)]
    #Add dereddened J, H, and Ks
    aj= data[aktag]*2.5
    ah= data[aktag]*1.55
    if _ESUTIL_LOADED:   
        data= esutil.numpy_util.add_fields(data,[('J0', float),
                                                 ('H0', float),
                                                 ('K0', float)])
        data['J0']= data['J']-aj
        data['H0']= data['H']-ah
        data['K0']= data['K']-data[aktag]
        data['J0'][(data[aktag] <= -50.)]= -9999.9999
        data['H0'][(data[aktag] <= -50.)]= -9999.9999
        data['K0'][(data[aktag] <= -50.)]= -9999.9999
    else:
        warnings.warn("Extinction-corrected J,H,K not added because esutil is not installed",RuntimeWarning)       
    return data
Beispiel #5
0
def apogeeObject(field_name,dr=None,
                 ak=True,
                 akvers='targ'):
    """
    NAME:
       apogeePlate
    PURPOSE:
       read the apogeePlate file
    INPUT:
       field_name - name of the field
       dr= return the file corresponding to this data release
       ak= (default: True) only use objects for which dereddened mags exist
       akvers= 'targ' (default) or 'wise': use target AK (AK_TARG) or AK derived from all-sky WISE (AK_WISE)
    OUTPUT:
       apogeeObject file
    HISTORY:
       2013-11-04 - Written - Bovy (IAS)
    """
    data= fitsio.read(path.apogeeObjectPath(field_name,dr=dr))
    if akvers.lower() == 'targ':
        aktag= 'AK_TARG'
    elif akvers.lower() == 'wise':
        aktag= 'AK_WISE'
    if ak:
        data= data[True-numpy.isnan(data[aktag])]
        data= data[(data[aktag] > -50.)]
    #Add dereddened J, H, and Ks
    aj= data[aktag]*2.5
    ah= data[aktag]*1.55
    data= esutil.numpy_util.add_fields(data,[('J0', float),
                                             ('H0', float),
                                             ('K0', float)])
    data['J0']= data['J']-aj
    data['H0']= data['H']-ah
    data['K0']= data['K']-data[aktag]
    data['J0'][(data[aktag] <= -50.)]= -9999.9999
    data['H0'][(data[aktag] <= -50.)]= -9999.9999
    data['K0'][(data[aktag] <= -50.)]= -9999.9999
    return data
Beispiel #6
0
def apogeeObject(field_name,dr=None,
                 ak=True,
                 akvers='targ'):
    """
    NAME:
       apogeePlate
    PURPOSE:
       read the apogeePlate file
    INPUT:
       field_name - name of the field
       dr= return the file corresponding to this data release
       ak= (default: True) only use objects for which dereddened mags exist
       akvers= 'targ' (default) or 'wise': use target AK (AK_TARG) or AK derived from all-sky WISE (AK_WISE)
    OUTPUT:
       apogeeObject file
    HISTORY:
       2013-11-04 - Written - Bovy (IAS)
    """
    data= fitsio.read(path.apogeeObjectPath(field_name,dr=dr))
    if akvers.lower() == 'targ':
        aktag= 'AK_TARG'
    elif akvers.lower() == 'wise':
        aktag= 'AK_WISE'
    if ak:
        data= data[True-numpy.isnan(data[aktag])]
        data= data[(data[aktag] > -50.)]
    #Add dereddened J, H, and Ks
    aj= data[aktag]*2.5
    ah= data[aktag]*1.55
    data= esutil.numpy_util.add_fields(data,[('J0', float),
                                             ('H0', float),
                                             ('K0', float)])
    data['J0']= data['J']-aj
    data['H0']= data['H']-ah
    data['K0']= data['K']-data[aktag]
    data['J0'][(data[aktag] <= -50.)]= -9999.9999
    data['H0'][(data[aktag] <= -50.)]= -9999.9999
    data['K0'][(data[aktag] <= -50.)]= -9999.9999
    return data
Beispiel #7
0
 """
 NAME:
    apogeePlate
 PURPOSE:
    read the apogeePlate file
 INPUT:
    field_name - name of the field
    dr= return the file corresponding to this data release
    ak= (default: True) only use objects for which dereddened mags exist
    akvers= 'targ' (default) or 'wise': use target AK (AK_TARG) or AK derived from all-sky WISE (AK_WISE)
 OUTPUT:
    apogeeObject file
 HISTORY:
    2013-11-04 - Written - Bovy (IAS)
 """
 filePath= path.apogeeObjectPath(field_name,dr=dr)
 if not os.path.exists(filePath):
     download.apogeeObject(field_name,dr=dr)
 data= fitsread(filePath)
 if akvers.lower() == 'targ':
     aktag= 'AK_TARG'
 elif akvers.lower() == 'wise':
     aktag= 'AK_WISE'
 if ak:
     data= data[True^numpy.isnan(data[aktag])]
     data= data[(data[aktag] > -50.)]
 #Add dereddened J, H, and Ks
 aj= data[aktag]*2.5
 ah= data[aktag]*1.55
 if _ESUTIL_LOADED:   
     data= esutil.numpy_util.add_fields(data,[('J0', float),