コード例 #1
0
ファイル: __init__.py プロジェクト: mindriot101/gaia_tools
def apogee(**kwargs):
    """
    PURPOSE:
       read the APOGEE allStar file
    INPUT:
       IF the apogee package is not installed:
           dr= (13) SDSS data release

       ELSE you can use the same keywords as apogee.tools.read.allstar:

       rmcommissioning= (default: True) if True, only use data obtained after commissioning
       main= (default: False) if True, only select stars in the main survey
       exclude_star_bad= (False) if True, remove stars with the STAR_BAD flag set in ASPCAPFLAG
       exclude_star_warn= (False) if True, remove stars with the STAR_WARN flag set in ASPCAPFLAG
       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)
       rmnovisits= (False) if True, remove stars with no good visits (to go into the combined spectrum); shouldn't be necessary
       adddist= (default: False) add distances (DR10/11 Hayden distances, DR12 combined distances)
       distredux= (default: DR default) reduction on which the distances are based
       rmdups= (False) if True, remove duplicates (very slow)
       raw= (False) if True, just return the raw file, read w/ fitsio
    OUTPUT:
       allStar data
    HISTORY:
       2013-09-06 - Written - Bovy (IAS)
    """
    if not _APOGEE_LOADED:
        warnings.warn("Falling back on simple APOGEE interface; for more functionality, install the jobovy/apogee package")
        dr= kwargs.get('dr',13)
        filePath= path.apogeePath(dr=dr)
        if not os.path.exists(filePath):
            download.apogee(dr=dr)
        return fitsio.read(filePath,1)
    else:
        return apread.allStar(**kwargs)
コード例 #2
0
ファイル: download.py プロジェクト: jtbuch/darkdisk
def apogee(dr=13,verbose=True,spider=False):
    filePath= path.apogeePath(dr=dr)
    if os.path.exists(filePath): return None
    if dr == 12:
        _download_file(\
            'http://data.sdss3.org/sas/dr12/apogee/spectro/redux/r5/allStar-v603.fits',
            filePath,verbose=verbose,spider=spider)
    elif dr == 13:
        _download_file(\
            'https://data.sdss.org/sas/dr13/apogee/spectro/redux/r6/allStar-l30e.2.fits',
            filePath,verbose=verbose,spider=spider)
    return None    
コード例 #3
0
ファイル: __init__.py プロジェクト: saramotalebi/gaia_tools
def apogee(xmatch=None, **kwargs):
    """
    PURPOSE:
       read the APOGEE allStar file
    INPUT:
       IF the apogee package is not installed:
           dr= (14) SDSS data release

       ELSE you can use the same keywords as apogee.tools.read.allstar:

       rmcommissioning= (default: True) if True, only use data obtained after commissioning
       main= (default: False) if True, only select stars in the main survey
       exclude_star_bad= (False) if True, remove stars with the STAR_BAD flag set in ASPCAPFLAG
       exclude_star_warn= (False) if True, remove stars with the STAR_WARN flag set in ASPCAPFLAG
       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)
       rmnovisits= (False) if True, remove stars with no good visits (to go into the combined spectrum); shouldn't be necessary
       adddist= (default: False) add distances (DR10/11 Hayden distances, DR12 combined distances)
       distredux= (default: DR default) reduction on which the distances are based
       rmdups= (False) if True, remove duplicates (very slow)
       raw= (False) if True, just return the raw file, read w/ fitsio
    
       ALWAYS ALSO

       xmatch= (None) if set, cross-match against a Vizier catalog (e.g., vizier:I/345/gaia2 for Gaia DR2) using gaia_tools.xmatch.cds and return the overlap
       +gaia_tools.xmatch.cds keywords
    OUTPUT:
       allStar data[,xmatched table]
    HISTORY:
       2013-09-06 - Written - Bovy (IAS)
       2018-05-09 - Add xmatch - Bovy (UofT)
    """
    if not _APOGEE_LOADED:
        warnings.warn(
            "Falling back on simple APOGEE interface; for more functionality, install the jobovy/apogee package"
        )
        dr = kwargs.get('dr', 14)
        filePath = path.apogeePath(dr=dr)
        if not os.path.exists(filePath):
            download.apogee(dr=dr)
        data = fitsread(filePath, 1)
        if not xmatch is None:
            ma, mai = _xmatch_cds(data, xmatch, filePath, **kwargs)
            return (data[mai], ma)
        else:
            return data
    else:
        kwargs['xmatch'] = xmatch
        return apread.allStar(**kwargs)