aspcap

ASPCAP is the APOGEE Stellar Parameters and Chemical Abundances pipeline. The main engine of ASPCAP is the code FERRE. Here, we refer to ASPCAP as the wrapper which runs FERRE on APOGEE data, orchestrating the different spectral libraries, and producing output FITS files.

Through DR14, ASPCAP was mostly written in IDL and was archived in the idlwrap SVN product. Some Python routines were included for the post-calibration of the FERRE output.

Various ASPCAP routines are being ported to Python with a goal of having ASPCAP written entirely in Python evenutally.

The migration has started with basic utility routines:

aspcap.py

apogee.aspcap.aspcap.apField2aspcapField(planfile, minerr=0.005, apstar_vers='stars', addgaia=False)[source]

create initial aspcapField file from apField file

apogee.aspcap.aspcap.apStar2aspcap(apstar)[source]

from input aspcap spectrum on aspcap grid, return spectrum on apStar grid

apogee.aspcap.aspcap.apStarWave()[source]

Returns apStar wavelengths

apogee.aspcap.aspcap.aspcap2apStar(aspcap)[source]

from input aspcap spectrum on aspcap grid, return spectrum on apStar grid

apogee.aspcap.aspcap.chi2(data)[source]

calculate chi2 and cumulative chi2

apogee.aspcap.aspcap.comp(a, b, terange=[4500, 5000], loggrange=[2.5, 3.5], mhrange=[-2.5, 1.0], amrange=[-1, 1], spec=True)[source]

Compare two versions in region on Kiel diagram

apogee.aspcap.aspcap.data(str, loc=None)[source]

Add apogeeObject data to structure

apogee.aspcap.aspcap.elemfrac(spec, el)[source]

calculate fractional contribution of good pixels

apogee.aspcap.aspcap.elemmask(el, maskdir='filters_26112015', plot=None, yr=[0, 1])[source]

Reads element window file, optional plot

apogee.aspcap.aspcap.elems(nelem=0)[source]

Define the order of the element arrays

apogee.aspcap.aspcap.elemsens(els=None, plot=None, ylim=[0.1, -0.3], teff=4750, logg=2.0, feh=-1.0, smooth=None)[source]

Returns and optionally plots wavelength sensitivity to changes in elemental abundances for specified elements from MOOG mini-elem grid

apogee.aspcap.aspcap.fill_plock(a, plocks)[source]

Fill FPARAM array in input structure with values of locked parameters

apogee.aspcap.aspcap.fit_elems(planfile, aspcapdata=None, clobber=False, nobj=None, write=True, calib=False, renorm=True, suffix='', html=True)[source]

run ASPCAP on a field for elemental abundances

apogee.aspcap.aspcap.fit_params(planfile, aspcapdata=None, clobber=False, write=True, minerr=0.005, apstar_vers=None, plot=False, init='RV', coarse=False, fix=None, renorm=False, suffix='', html=True, mult=False, dostar=None)[source]

run ASPCAP on a field to get parameters

apogee.aspcap.aspcap.gridPix(apStar=True)[source]

Returns chip pixel ranges in apStar or aspcap grid

apogee.aspcap.aspcap.gridWave()[source]

Returns aspcap grid wavelengths

apogee.aspcap.aspcap.mkhtml(load, field, suffix='')[source]

Create ASPCAP field web page and plots

apogee.aspcap.aspcap.params()[source]

Define the order of the parameter arrays, with the associated FERRE names, tag names, and flag names

apogee.aspcap.aspcap.writefiles(load, field, aspcapfield, aspcapspec, aspcapkey, suffix='', aspcapstar=True, version=None)[source]

Write aspcapField and aspcapStar files

err.py

loggcomp.py

teffcomp.py

cal.py

elem.py

ferre.py

apogee.aspcap.ferre.clip(x, lim, eps=None)[source]

Utility routine to clip values within limits, and move slightly off edges if requested

apogee.aspcap.ferre.elemmask(libfile, wspec, spec, dw=0.1, thresh=0.0, out=None)[source]

writes FERRE binary (0/1) mask file for wavelengths from input libfile, where input spectrum > thresh within wavelength dw

apogee.aspcap.ferre.interp(libfile, params, renorm=4, obscont=0, rejectcont=0.3)[source]

Use FERRE to get an interpolated spectrum

apogee.aspcap.ferre.rdlibhead(name)[source]

Read a full FERRE library header with multi-extensions

Returns:libstr0, libstr – first header, then list of extension headers; headers returned as dictionaries
apogee.aspcap.ferre.rdsinglehead(f)[source]

Read a FERRE library header into a dictionary

apogee.aspcap.ferre.read(name, libfile)[source]

Read all of the FERRE files associated with a FERRE run

apogee.aspcap.ferre.readferredata(name)[source]

Read a single file with FERRE-format data, and return as 2D array [nspec,nwave]

apogee.aspcap.ferre.readmask(name)[source]

Read a single FERRE mask file

apogee.aspcap.ferre.readspec(name)[source]

Read a single file with FERRE-format spectra, and return as 2D array [nspec,nwave]

apogee.aspcap.ferre.wrhead(planstr, file, npca=None, npix=None, wchip=None, cont=None)[source]

Write header of library file given plan structure

apogee.aspcap.ferre.writeipf(name, libfile, stars, param=None)[source]

Writes FERRE input file

apogee.aspcap.ferre.writemask(name, mask)[source]

Write a single FERRE ask file

apogee.aspcap.ferre.writenml(outfile, file, libhead, ncpus=2, nruns=1, inter=3, pca=1, errbar=1, indi=None, indv=None, filterfile=None, f_format=1, f_access=0, f_sort=None, init=None, indini=None, renorm=None, obscont=0, rejectcont=0, algor=1, nov=None, stopcr=None, ttie=None)[source]

Writes FERRE control file

apogee.aspcap.ferre.writespec(name, data)[source]

Writes FERRE ‘spectrum’ file with input data, one line per star

norm.py

apogee.aspcap.norm.cont(spec, specerr, chips=False, order=4, poly=True, apstar=True, medfilt=0)[source]

Returns continuum normalized spectrum

apogee.aspcap.norm.correct(field, libfile, plot=True, write=None, width=151)[source]

Read raw FERRE files and create correction to normalization based on ratio

apogee.aspcap.norm.polyfit(x, y, yerr, order)[source]

continuum via polynomial fit

persist.py