# APOGEE Radial Velocities

This page provides a description of how radial velocities are measured from the APOGEE spectra. See the Using APOGEE Radial Velocities page for instructions on how best to use these quantities. See Nidever et al. (2015) for further details.

## Calculation of Radial Velocities

The APOGEE radial velocities (RV) are derived in several steps:

1. Visit Spectra Reduction: As each visit is reduced, an RV estimate is determined by cross-correlating the visit spectrum against a grid of synthetic spectra. This provides an "estimated RV" for the visit, which is stored in the apVisit/asVisit files. These velocities are currently not used in subsequent reduction steps, but are saved (in fields named ESTVHELIO, etc.) for potential future use.
2. Visit Spectra Combination: Radial velocities for each visit are re-derived when the visit spectra are combined. This is done in three steps:
1. For each visit, a relative radial velocity is iteratively calculated using either the combined spectrum or a synthetic spectrum selected from the RV mini-grid as the spectral template.
2. An absolute radial velocity is calculated by comparing the combined spectrum against the RV mini-grid.
3. The relative radial velocities for each visit and the absolute radial velocity are then used to calculate absolute velocities for all visit spectra.

This scheme was employed because RVs derived using a template made from the combined spectrum (i.e., of the star itself) should be more precise than RVs derived from a grid of synthetic spectra, none of which match the observed spectra perfectly. This procedure allows us to create a high-quality combined spectrum without even knowing what type of object with which we are dealing. 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 absolute RV is a critical science product and 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) and used for kinematic studies. This then requires the derivation of the absolute radial velocity of the combined spectrum against a grid of synthetic spectra (the "RV mini-grid").

## Preparing the Spectra

The spectra are "prepared" for cross-correlation by applying the following processes:

1. Pixel masking. Pixels marked as "bad" in the mask array (usually, from bad pixels in the detector array), or those that have skylines in the sky array are masked out for the rest of the RV determination.
2. Continuum normalization. The spectra taken on each of the three chips are normalized independently. The chip spectrum is separated into 40 blocks (covering approximately 14 ångstroms each), and the 95th percentile value is calculated for each block. A robust third-order polynomial is then fit to the block 95th percentile values. Finally, the spectrum is normalized (divided) by the polynomial fit.

The RV template spectra (observed combined or synthetic spectrum) are prepared in the same way as each of the visit spectra.

## Cross-Correlation

After a given spectrum is continuum-normalized, radial velocity is determined by cross-correlating the spectrum against a template spectrum. Both spectra are on the same logarithmic wavelength scale, i.e., such that a Doppler shift is identical to a constant shift in the x-dimension (Tonry & Davis 1979). A Gaussian is fit to the peak of the cross-correlation function to determine more accurately the best spectral shift. Finally, the shift and its uncertainty are converted to velocity units.

## The RV mini-grid

The RV mini-grid is composed of 519 synthetic spectra at a resolution of 23,500 and on the same logarithmically-spaced wavelength scale as the APOGEE combined spectra. The grid spans a large range of stellar parameters:

3000 < Teff < 20,000 K
0.5 < log g < 5.0
-2.0 < [M/H] < +0.5

Note, the step sizes and ranges for log g and [Fe/H] vary with effective temperature, but no interpolation is performed within the grid. A number of spectra with both high carbon and high $\alpha$-elements are included to help serve as templates for carbon-rich and oxygen-rich stars. The range of stellar parameters permitted to be searched is restricted in logg based on the APOGEE_WASH_GIANT and APOGEE_WASH_DWARF bits. If theAPOGEE_WASH_GIANT bit is set in the APOGEE_TARGET1 bitmask, then the grid is restricted to log g < 4. Likewise, if the APOGEE_WASH_DWARF bit is set, then the grid is restricted to log g ≥ 3.5. If neither is set, then no restriction is placed on log g

The parameters for the RV template are stored in the summary data files and the FITS headers (as RV_TEFF, RV_LOGG, RV_FEH, etc.), but these values are not the best estimates of the stellar parameters of the stars . The ASPCAP stellar parameter and abundance pipeline provides much more sophisticated results.

When choosing a "best-fit" to an observed spectrum, the observed spectrum is cross-correlated against each synthetic spectrum in this "RV mini-grid." For each synthetic spectrum, the best RV and χ2 of the observed spectrum are derived. The template spectrum yielding the lowest χ2 is chosen as the best-fitting spectrum.

## Barycentric Correction

Radial velocities in APOGEE are reported with respect to the center of mass of the Solar System - the barycenter. The individual exposures are corrected for the relative motion of the Earth along the line of sight to the star during each observation. This correction is called the "barycentric correction," and it can be calculated very accurately (to m/s levels). When these corrections are applied to the absolute RVs, we determine the RV with respect to the barycenter or Vhelio for short.

Note: The header keyword VHELIO is retained for historical reasons, but the pipeline is calculating a true barycentric velocity, not a heliocentric velocity.

## Relative Radial Velocity Refinement Iteration Procedure

The combined spectrum and the relative radial velocities are constructed in an iterative process.

1. Template Setup and Visit Spectra Preparation: An observed template constructed from the combined spectrum (or the highest S/N visit spectrum in the first iteration when no combined spectrum is available). A synthetic template is chosen by finding the "RV mini-grid" spectrum, which best matches the observed template and is then placed on the same wavelength scale as the observed template. The visit spectra are "prepared" using the prescription provided above, and for the first two iterations, low S/N visit spectra are smoothed.
2. Velocity Calculations: Both templates are cross-correlated against all of the visit spectra, measuring the relative RV shifts of the visit spectra compared to the two templates. These velocities are relative to the previous combination, so they are added to the velocities used for combination (VREL) in the previous iteration to get the true relative velocities, which are saved as SYNTHVREL for synthetic template velocities and OBSVREL for the observed template velocities. The barycentric correction is applied to these velocities and saved as SYNTHVHELIO and OBSVHELIO.
3. Visit Rejection: A single visit with an erroneous RV measurement can contaminate a combined spectrum. For each template, individual visits were marked as not suitable for combination if:

1. The visit's measured relative velocity (SYNTHVREL/OBSVREL) exceeds 1000 km/s
2. The absolute difference between the visit's barycentric velocity (SYNTHVHELIO/OBSVHELIO) and the median barycentric velocity across all visits is greater than ten times the median absolute deviation of the star's barycentric velocity or 4 km/s, whichever is greater

These criteria were chosen to minimize the elimination of true astrophysical RV variations.

4. Visit Combination: The standard deviation of both SYNTHVHELIO and OBSVHELIO are calculated (excluding rejected velocities), and the velocity method that produces the smallest standard deviation is used to shift the visit spectra for the combination. The velocity method used for the combination is saved as COMBTYPE, and the relative and barycentric values are saved in VREL and VHELIO.

This iteration is performed 10 times, or until the velocity adjustments between iterations become insignificant, whichever comes first.

## Absolute Radial Velocities

After accounting for the relative RVs in the visit spectra to create the combined spectrum, the latter is still at the mean RV of the star. The combined spectrum is cross-correlated against each synthetic spectrum in the "RV mini-grid." For each synthetic spectrum, the best RV and χ2 of the observed spectrum are derived. The template spectrum yielding the lowest χ2 is chosen as the best-fitting spectrum, and cross-correlation with this spectrum provides the absolute RV of the combined spectrum. This correction is then applied to all of the velocities to put them on the same absolute velocity scale.

## Radial Velocity Finalization and Flagging

One final radial velocity iteration is performed using the final combined spectrum and the best-fit synthetic spectrum to get the final values of OBSVREL/OBSVHELIO/OBSVERR and SYNTHVREL/SYNTHVHELIO/SYNTHVERR, respectively, both of which reflect the absolute velocities of the star. The scatter across multiple observations between the two types of RVs is stored in SYNTHSCATTER. When this value is larger than 2 km/s or twice VSCATTER, whichever is greater, the SUSPECT_RV_COMBINATION bit is set in the APOGEE_STARFLAG bitmask. Similarly, if SYNTHSCATTER is above 10 km/s or 10 times VSCATTER, then the BAD_RV_COMBINATION bit is set. The most common culprits for triggering these flags are double-lined spectroscopic binaries.

## Radial Velocity Uncertainties

The RV uncertainty depends on the S/N, the resolution, and the information in the spectral lines themselves. A spectrum with lots of deep and thin lines (such as in cool and metal-rich stars) will have a much more precise RV than a spectrum with a few shallow and wide lines (such as in hot stars). We can easily estimate the RV uncertainty in the APOGEE spectra by looking at the RV scatter for stars with multiple visits. The histogram of the RV scatter peaks at ~70 m/s (much less than our original survey target of 500 m/s), but it has a long tail at larger scatter. Much of this is due to real variability from stellar binaries. The observed scatter is stored in the VSCATTER parameter for each star, and it is probably the best indicator to use to determine whether a star is a binary (for stars with multiple visits). If VSCATTER > 1 km/s (i.e., much larger than the typical uncertainties), then it is likely a binary. Note, however, that for stars with a single visit, VSCATTER will be set to zero.

## Saved Quantities

The barycentric radial velocities used in combination corrected by the absolute velocity from cross-correlation of the combined spectrum with a synthetic spectrum is stored in VHELIO for each visit spectrum; an estimated error is stored in VERR.

For the combined spectrum, a signal-to-noise weighted average is stored in VHELIO_AVG and the scatter around this average is stored in VSCATTER. The S/N weighted pipeline-reported uncertainty is stored in VERR, and the median visit RV error is stored in VERR_MED. We note, however, that VERR tends to be small and that VSCATTER may represent a better estimate of the true measurement precision.

Analogs of these velocities and multiple scatter/error parameters derived by the final cross-correlation of each visit with the best-fitting synthetic spectrum are stored in SYNTHVHELIO, SYNTHVERR, SYNTHEVHELIO_AVG, SYNTHVERR, and SYNTHVERR_MED, respectively.

The equivalent values derived by cross-correlation of each visit with the combined spectrum are stored in OBSVHELIO, OBSVERR, OBSVHELIO_AVG, OBSVERR, and OBSVERR_MED. The scatter between the two different RV methods is stored in SYNTHSCATTER.