apred¶
apred provides Python routines related to APOGEE data reduction. To date, these are limited because the reduction is done in an IDL environment, but there are a few utility routines used for quality assurance. It is expected that additional functionality will be implemented in Python in the future.
In late 2018, routines for doing wavelength calibration were added, see Wavelength Calibration
lsfmap.py
routines to create maps of FWHM and resolution across the APOGEE detectors, given pre-existing apLSF files
-
apogee.apred.lsfmap.group(lsf, wave=None, hard=None, groups=None)[source]¶ Plot the FWHM from gaussian fits to the LSF of the 3 chips at column 1024
-
apogee.apred.lsfmap.modelmap(lsfframe, waveframe=None, cols=array([ 5, 25, 45, 65, 85, 105, 125, 145, 165, 185, 205, 225, 245, 265, 285, 305, 325, 345, 365, 385, 405, 425, 445, 465, 485, 505, 525, 545, 565, 585, 605, 625, 645, 665, 685, 705, 725, 745, 765, 785, 805, 825, 845, 865, 885, 905, 925, 945, 965, 985, 1005, 1025, 1045, 1065, 1085, 1105, 1125, 1145, 1165, 1185, 1205, 1225, 1245, 1265, 1285, 1305, 1325, 1345, 1365, 1385, 1405, 1425, 1445, 1465, 1485, 1505, 1525, 1545, 1565, 1585, 1605, 1625, 1645, 1665, 1685, 1705, 1725, 1745, 1765, 1785, 1805, 1825, 1845, 1865, 1885, 1905, 1925, 1945, 1965, 1985]), fibers=array([ 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, 253, 256, 259, 262, 265, 268, 271, 274, 277, 280, 283, 286, 289, 292, 295, 298]), apStar=False, smooth=5, hard=False)[source]¶ Make LSF map from a model a[ps]LSF file
-
apogee.apred.lsfmap.sum(apred='r11', telescope='apo25m', lsfs=[3430016, 7510018, 11130063, 14600018, 18430026, 22330043, 25560065], waveid=None, out='apogee-n', verbose=False, groups=None)[source]¶ Make plots for a series of LSFs and a summary web page
through.py
routines to make throughput-related plots, given pre-existing reduction summary files
-
apogee.apred.through.throughplot(instrument='apogee-s', outfile=None, inter=False)[source]¶ Routine to make zeropoint/throughput plots from apogeeSci summary files with information including FWHM, GDRMS, CART
mjdcube.py
routine to make a cube of simply-reduced (CDS?) frames for an entire night, used by the apogeereduce persistence correction routines.
-
apogee.apred.mjdcube.mjdcube(mjd, darkid=None, write=False, apred='current', clobber=False)[source]¶ Make a cube for a given night with the CDS images of all frames Optionally, write out individual uncompressed data cubes
rv.py
routines related to radial velocity (RV) measurement.
These include new routines to replace the old IDL routines for RV determination and visit combination. The new routines are based on the use of David Nidever’s doppler package, which is included in the apogee software data product as a sub-package.
RVs are processed at the field level. For each field, information about all of the visits are saved by the ap1dvisit processing in apVisitSum files. The rv.doppler_rv() routine concatenates these files into an allvisit table. Unique objects are identified in this table, and a list of visit file names for each objecct is accumulated. These lists are then passed to the wrapper routine rv.dorv(), which calls doppler.rv.jointfit() to deterine RVs for each visit.
doppler.rv.jointfit() determines RV in several iterations. First each input spectra is cross-correlated against a pre-determined set of model templates. Stellar parameters from the template that produces the highest cross-correlation peak are stored, along with the RV corresponding to this peak. After all visits are processed, S/N-weighted average parameters and RV are determined, and these are used to provide first guesses for a least-squares fit to the stack of images, in which stellar parameters and individual visit RVs are the free parameters. The process goes through a few iterations, masking out poorly fitting pixels before determining a final set of parameters and RVs. The best fitting model is then used to provide a final set of cross-correlation functions, although these are not used for the RVs, as the least-squares fit provides the final RVs.
The output CCFs, however, are used to attempt to identify multi-component systems. This is done using autonomous gaussian decomposition as implemented in the (external) gausspy package, also included as a sub-package. This is implemented in the driver routine gauss_decomp(), which also includes a simple algorithm for filtering out likely spurious peaks.
The rv.dorv() wrapper does both the doppler.rv.jointfit() and the rv.gauss_decomp(), as well as a rv.dop_plot() routine to make a series of plots. The wrapper routine is used so that the driver routine rv.doppler_rv() can run multiple stars in different threads. Note that, for this to be effective, the doppler.rv and lower level routines must be single-threaded, accomplished by setting environment variables:
|setenv OMP_NUM_THREADS 1 |setenv OPENBLAS_NUM_THREADS 1 |setenv MKL_NUM_THREADS 1 |setenv VECLIB_MAXIMUM_THREADS 1 |setenv NUMEXPR_NUM_THREADS 1
before loading the packages. This is significantly more efficient that running a single object at a time with multi-threaded lower levels.
After all of the objects have been run, the RV results are loaded into the allvisit structure. In addition, a new allstar structure is created with an entry for each star that includes the average heliocentric (actually, barycentric) RVs, and the VSCATTER measurement of scatter.