Instrument Tools¶
Todo
Add description of Spectrum object class.
APOGEE Data¶
Downloading and reading APOGEE data files¶
To download APOGEE spectrum by 2MASS name and data type aspcap
, or apstar
:
import apogee_tools as ap
ap.download('2M03425325+2326495', type='aspcap')
ap.download('2M03425325+2326495', type='apstar')
For data type apvisit
or ap1d
:
ap.download('2M03425325+2326495', type='apvisit')
ap.download('2M03425325+2326495', type='ap1d', visit=1, frame=1)
Note: type='apvisit'
will download the spectra for all visits observed, while type='ap1d'
will download only the visit specified (and if not specified, will default to visit=1
, frame=1
).
For information on APOGEE data files, see the following:
- aspcap - combined, continuum normalized spectra
- apStar - combined spectra
- apVisit - individual raw visit spectra with telluric correction
- ap1D - individual raw visit spectra with NO telluric correction
Also for info about the allStar file (such as aspcap pipeline parameters and photometry for all of the sources), see: allStar.
Once the data for a source has been downloaded, read aspcap or apStar files by specifying the 2MASS name and data type:
data = ap.Apogee(id='2M03425325+2326495', type='aspcap')
Or for single visit spectrum, indicate the index of the visit number at the end:
data = ap.Apogee(id='2M03425325+2326495', type='apvisit', visit=1)
Search the APOGEE catalog¶
Example search–will search the allStar-l30e.2.fits
you downloaded:
params = ['TEFF', 'LOGG', 'M_H']
ranges = [[-10000,4000], [0,5], [-2,2]]
source_table = ap.multiParamSearch(par=params, select=ranges, dir='/path_to/')
Look up aspcap parameters in allStar-l30e.2.fits
for specific list of 2MASS IDs:
tm_ids = ['2M01195227+8409327']
ap_dict = ap.returnAspcapTable(tm_ids, params=['TEFF', 'LOGG', 'M_H', 'SNR'], save=False)
Plot data¶
Some plotting examples:
data = ap.Apogee(id='2M03290406+3117075', type='aspcap')
# plot spectrum
data.plot()
# plot aspcap model and noise:
data.plot(items=['spec', 'model', 'noise'], save=True)
# plot indentified lines (from Souto 2016):
data.plot(items=['spec', 'lines'], xrange=[15200,15500], yrange=[.6,1.2])
Mask outlying flux¶
Specify number of standard deviations above and below the mean of the flux to cut (sigma = [lower cuttoff, upper cutoff]
), and the number pixels to buffer each side of the cut (pixel_buffer = [lower mask pixel buffer, upper mask pixel buffer]
):
data.mask(sigma=[3,2], pixel_buffer=[0,3])
Chi-squared comparison¶
Compare two spectra; return chi
(chi-squared value between data and mdl), norm_data
(data
spectrum normalized), and scaled_mdl
(mdl
which has been scaled to data
):
chi, norm_data, scaled_mdl = ap.compareSpectra(data, mdl)
NIRSPEC Data¶
Todo
More info coming soon.
Adding New Instruments¶
Todo
More info coming soon.