Beispiel #1
0
def apogeerc(dr=14, verbose=True, spider=False):
    filePath = path.apogeercPath(dr=dr)
    if os.path.exists(filePath): return None
    _download_file(\
        'https://data.sdss.org/sas/dr%i/apogee/vac/apogee-rc/cat/apogee-rc-DR%i.fits' % (dr,dr),
        filePath,verbose=verbose,spider=spider)
    return None
Beispiel #2
0
def apogeerc(**kwargs):
    """
    NAME:
       apogeerc
    PURPOSE:
       read the APOGEE RC data
    INPUT:
       IF the apogee package is not installed:
           dr= (13) SDSS data release

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

       main= (default: False) if True, only select stars in the main survey
       dr= data reduction to load the catalog for (automatically set based on APOGEE_REDUX if not given explicitly)
    OUTPUT:
       APOGEE RC sample data
    HISTORY:
       2013-10-08 - 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.apogeercPath(dr=dr)
        if not os.path.exists(filePath):
            download.apogeerc(dr=dr)
        return fitsio.read(filePath, 1)
    else:
        return apread.rcsample(**kwargs)
Beispiel #3
0
def apogeerc(xmatch=None, **kwargs):
    """
    NAME:
       apogeerc
    PURPOSE:
       read the APOGEE RC data
    INPUT:
       IF the apogee package is not installed:
           dr= (14) SDSS data release

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

       main= (default: False) if True, only select stars in the main survey
       dr= data reduction to load the catalog for (automatically set based on APOGEE_REDUX if not given explicitly)

       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:
       APOGEE RC sample data[,xmatched table]
    HISTORY:
       2013-10-08 - 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.apogeercPath(dr=dr)
        if not os.path.exists(filePath):
            download.apogeerc(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.rcsample(**kwargs)