Пример #1
0
def _load_precomp(dr=None,fiber='combo',sparse=True):
    """Load a precomputed LSF"""
    if dr is None: dr= appath._default_dr()
    fileDir= os.path.dirname(appath.apLSFPath('a',dr=dr))
    filePath= os.path.join(fileDir,'apogee-lsf-dr%s-%s.fits' % (dr,fiber))
    # Download the file if necessary
    if not os.path.exists(filePath):
        dlink= \
            filePath.replace(fileDir,'https://zenodo.org/record/16147/files')
        _download_file(dlink,filePath,dr)
    x= numpy.linspace(-7.,7.,43)
    elsf= fitsio.read(filePath)
    if sparse:
        return (x,sparsify(elsf))
    else:
        return (x,elsf)
Пример #2
0
def _load_precomp(dr=None,fiber='combo',sparse=True):
    """Load a precomputed LSF"""
    if dr is None: dr= appath._default_dr()
    if dr is 'current':
        warnings.warn("Preloaded LSFs for current DR not yet available, falling back on DR12 files")
        dr= '12'
    fileDir= os.path.dirname(appath.apLSFPath('a',dr=dr))
    filePath= os.path.join(fileDir,'apogee-lsf-dr%s-%s.fits' % (dr,fiber))
    # Download the file if necessary
    if not os.path.exists(filePath):
        dlink= \
            filePath.replace(fileDir,'https://zenodo.org/record/16147/files')
        _download_file(dlink,filePath,dr)
    x= numpy.linspace(-7.,7.,43)
    elsf= fitsio.read(filePath)
    if sparse:
        return (x,sparsify(elsf))
    else:
        return (x,elsf)
Пример #3
0
def apLSF(chip, ext=0, dr=None):
    """
    NAME:
       apLSF
    PURPOSE:
       open an apLSF file
    INPUT:
       chip - chip 'a', 'b', or 'c'
       ext= (0) extension to read
       dr= return the path corresponding to this data release      
    OUTPUT:
       contents of HDU ext
    HISTORY:
       2015-03-12 - Written - Bovy (IAS)
    """
    filePath = path.apLSFPath(chip, dr=dr)
    if not os.path.exists(filePath):
        download.apLSF(chip, dr=dr)
    data = fitsio.read(filePath, ext)
    return data
Пример #4
0
def apLSF(chip,ext=0,dr=None):
    """
    NAME:
       apLSF
    PURPOSE:
       open an apLSF file
    INPUT:
       chip - chip 'a', 'b', or 'c'
       ext= (0) extension to read
       dr= return the path corresponding to this data release      
    OUTPUT:
       contents of HDU ext
    HISTORY:
       2015-03-12 - Written - Bovy (IAS)
    """
    filePath= path.apLSFPath(chip,dr=dr)
    if not os.path.exists(filePath):
        download.apLSF(chip,dr=dr)
    data= fitsio.read(filePath,ext)
    return data
Пример #5
0
def apLSF(chip, dr=None):
    """
    NAME:
       apLSF
    PURPOSE:
       download an apLSF file
    INPUT:
       chip - chip 'a', 'b', or 'c'
       dr= return the path corresponding to this data release      
    OUTPUT:
       (none; just downloads)
    HISTORY:
       2015-03-12 - Written - Bovy (IAS)
    """
    if dr is None: dr = path._default_dr()
    # First make sure the file doesn't exist
    filePath = path.apLSFPath(chip, 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, verbose=True)
    return None
Пример #6
0
def apLSF(chip,dr=None):
    """
    NAME:
       apLSF
    PURPOSE:
       download an apLSF file
    INPUT:
       chip - chip 'a', 'b', or 'c'
       dr= return the path corresponding to this data release      
    OUTPUT:
       (none; just downloads)
    HISTORY:
       2015-03-12 - Written - Bovy (IAS)
    """
    if dr is None: dr= path._default_dr()
    # First make sure the file doesn't exist
    filePath= path.apLSFPath(chip,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,verbose=True)
    return None