APOGEE Visit Spectra Combination

Most APOGEE fields are observed multiple times in order to build up the signal-to-noise ratio for faint stars and to detect stellar binaries from their radial velocity variations. For the analysis to be performed at maximum S/N, these multiple "visit" spectra (as output by ap1dvisit) are combined into one spectrum for each star. This process is called "visit combination" and involves several steps.

The output of this process is a single apStar file for each star. This file contains the combined spectrum as well as all of the resampled visit spectra on the same wavelength scale.

Visit Combination Steps
  1. Re-determination of Doppler shift (i.e., radial velocity) for each visit spectrum.
  2. Resampling of each visit spectrum onto the same rest wavelength scale (i.e., no doppler shift).
  3. Continuum normalization of each visit spectrum using a median filter.
  4. Weighted combination of all the resampled visit spectra.
  5. Re-application of mean continuum shape.

Radial Velocity Determination

The final absolute radial velocities (RV) in the visit combination are derived in several separate steps (and see below):

  1. Relative radial velocities are determined via the cross-correlation of each visit spectrum against the combined spectrum or a spectrum selected from a grid of synthetic spectra, which functions as the correlation template. This is done in an iterative fashion, where the first iteration uses the highest S/N visit spectrum of the object.
  2. The absolute radial velocity of the combined spectrum is determined with respect to a grid of synthetic spectra spanning a large range of stellar parameters.
  3. The visit relative radial velocities and the absolute velocity of the combined spectrum are then combined to produce absolute velocities for all visit spectra.

This scheme was employed because relative RVs derived from the combined spectrum (of the star itself) should be more accurate than RVs derived in comparison to a grid of synthetic spectra given the absence of template mismatch (although it may lead to problems in the case of objects with lower S/N spectra). This process allows us to create a high-quality combined spectrum without even knowing what type of object with which we are presented. However, in some cases, particularly at low S/N, RVs derived using a synthetic template were found to be more precise, so we elected to give the iterative procedure a choice between the two methods. Furthermore, the final combined spectrum must be on the rest wavelength scale so that it can be properly compared to the large grid of synthetic spectra in the abundance pipeline (ASPCAP). Therefore, the second step in the RV determination is to derive the absolute radial velocity of the combined spectrum against a small grid synthetic spectra (the "RV mini-grid").

The procedure for determining radial velocities is described in more detail here.


To combine the visit spectra, their individual Doppler shifts must be removed and then, they must be resampled onto the same wavelength scale. With the radial velocity determined in step (1) above, the wavelengths are corrected to the rest wavelength values (λrestobs/(1+RV/c), where c is the speed of light). Using the tabulated rest wavelengths, the spectrum is resampled onto the final logarithmically-spaced wavelength scale using sinc interpolation.

Continuum Normalization

Because the visit spectra are taken under different conditions (e.g., airmass) and the flux calibration is not perfect, the relative fluxes as a function of wavelength can vary from visit to visit. Therefore, each visit spectrum is roughly continuum normalized before the ensemble may be combined. A 500-pixel median filter (excluding bad pixels) is used to calculate the continuum and normalize each spectrum. This continuum is saved for a final re-normalizing step at the end.

Weighted Combination

The final step is to combine the rest-frame shifted, resampled and normalized visit spectra. The combination is done in two different ways: (1) global weighting, where each visit spectrum is weighted by its (S/N)2, and (2) pixel-by-pixel weighting, where each pixel is weighted by its (S/N)2. In both cases, bad pixels in individual visit spectra are discarded before combination. The two schemes give similar results in most cases, but both are saved. For visit spectra with 1 < S/N < 10, the spectra's weights are set to zero if its S/N is less than three standard deviations below the median S/N of all of the visit spectra for the star. For visit spectra with S/N < 1, the spectra's weights are always set to zero.

Finally, the combined spectra are multiplied by the average (over the multiple visit spectra) of the continuum shape to return the continuum to the combined spectrum.

Output Star Spectra: apStar files

As described in the data access description, the combined spectra are provided in apStar files in FITS format. The primary HDU of each file contains an image which gives the two versions of the combined spectrum mentioned above for each object, plus the individual visit spectra that went into these combinations.

For these files, all of the individual spectra have been resampled to a common logarithmically-spaced wavelength scale, with the radial velocity of each individual visit spectrum removed. Note that the APOGEE wavelength scale is based on vacuum wavelengths. The logarithmic wavelength grid spacing is the same for all objects (log10 λi+1 - log10 λi = 6E-6) with a common starting wavelength of 15100.802 Angstroms.

These spectra are roughly flux-calibrated. Additional HDUs contain the estimated uncertainties in each pixel, masks, and other information. HDU2 stores the uncertainty per pixel. The pixel mask information is stored in HDU3. These images yield a bitmask for each pixel, in particular the APOGEEPIXMASK bitmask. As the final spectrum is a combination of 3 or more individual exposures, it may be that some bits were flagged in some exposures but not in others.

The headers also include a global STARFLAG bitmask that flags global conditions about the spectra. The global STARFLAG bitmask starts as a bitwise OR of the individual visit STARFLAG bitmasks, while the ANDFLAG bitmask is a logical AND of the individual visit bitmasks; however, in addition the the visit-level bits, there are a few bits related to the radial velocities used for the combination that can be set in the global STARFLAG.