Skip to content

Preparing HARPS spectra for measuring absorption feature profiles

Daniel Berke edited this page Feb 24, 2022 · 2 revisions

The official HARPS reduction pipeline produces 1D spectra which unfortunately are not able to used, due to their lack of uncertainties array and the fact that by blending together overlapping regions of echelle orders it becomes impossible to create one from the data. Instead, for VarConLib, we use data products from an intermediate stage of the reduction pipeline. I've called the "e2ds" files, from that string in their file names, which stands for extracted 2 dimensional spectra. These files contain a single array of 72 rows and 4096 columns, with each row representing the extracted value (using optimal extraction) of one of the echelle orders that fall on the HARPS detector. The detector is made up of two CCDs, 'Jasmine' (which covers the red portion of the visible spectrum) and 'Linda' (which covers the blue portion).

The code responsible for preparing these files is the HARPSFile2DScience class, in the obs2d module. (There is also an obs1d module, written to open 1D spectra before realizing they weren't useful, but this is deprecated and quite likely may not work.) HARPSFile2DScience is itself a child of the minimal HARPSFile2D class, which mainly provides a few methods for getting the data of observations as a Python datetime.datetime objection for chronological ordering and getting the value of header cards with the getHeaderCard() function, which takes the value of a FITS keyword in a HARPS file as a string and returns the matching value.

HARPSFile2DScience takes as input the path to a HARPS e2ds file and performs the following actions after verifying the path is valid:

  1. Try to read a wavelength array from the file, or create one if it doesn't exist. This requires getting coefficients for the third-degree (cubic) polynomial used to fit each echelle order. These coefficients are stored in FITS files, with each e2ds file saving the filename of the file associated with it. These FITS files came from C. Lovis (priv. com.), and are found in the directory specified as "harps_wavelength_cals_dir" in VarConLib's config file.
  2. Try to read an array of wavelengths converted to vacuum in a barycentric-frame, or create if it doesn't exist.
  3. The previous arrays are for the centers of pixels, so try to read (or create if they don't exist) two arrays of wavelengths calculated at the edges of each pixel.
  4. Try to read a flux array, or create it if it doesn't exist. While the e2ds files contain a flux array, it is in ADUs rather than photons and has not been corrected for the blaze function, so this step performs both corrections. (If this is the first time the file is being read by HARPSFile2DScience, the blaze array is only created two steps later, but it will pull the data from the associated blaze file.)
  5. Try to read an uncertainties array, or create it if it doesn't exist. This is calculated as the quadrature sum of the square root of each pixel's flux (in electrons) plus a tiny contribution of 12 photo-electrons from dark and read noise.
  6. Try to read a blaze array, or create it if it doesn't exist. The blaze array comes from an external file, where similar to the wavelength array the filename is stored in the e2ds FITS keywords. That file is searched for in the path denoted in VarConLib's config file as "harps_blaze_files_dir".

Clone this wiki locally