This is an old revision of the document!
PyWiFeS Data Reduction
This page details the algorithms and techniques employed in PyWiFeS data reduction procedures. For details on how to actually run the reduction script, see the main documentation page. For the ordered list of reduction steps in the default reduction script, see the default reduction steps page.
Image Pre-Processing
Overscan Subtraction
stuff
Bias subtraction
Bad Pixel Cleanup
stuff
Conversion to Multi-Extension Fits (MEF)
Cosmic Ray Rejection
Wavelength Solution
The WiFeS wavelength solution is derived in three steps:
- Find emission lines in arc lamp data
- Determine the true wavelengths of those found lines.
- Fit for the wavelength solution across the entire detector, using the WiFeS optical model.
1. Finding the Lines: The first step, finding emission lines, is performed by default using the 'mpfit' method (see paper for details). This fits emission lines as Gaussians in linear wavelength space. A faster but less robust technique, 'loggauss', fits the emission lines in logarithmic flux space, where a Gaussian is merely a quadratic polynomial fit. Because this 'loggauss' method operates in logarithmic space, it cannot use fluxes close to zero, and provides a less robust fit (see Figure below), but is far more rapid due to the speed of polynomial fitting in NumPy, so is suitable only for times when a wavelength solution must be derived rapidly.
2. Associating lines to true wavelengths: Once the emission lines have been found, they must be associated with a true reference wavelength for the emitting atomic species. This is done by first calculating a predicted wavelength for the line's physical position on the detector, based on a reference wavelength solution. This then must be adjusted to determine the offset between the observed wavelength solution and the reference one. This step is generally performed by running a cross-correlation of the observed spectrum for each detector row with a known reference spectrum (with correct wavelength calibration) to derive a coherent shift for all lines in a given row. Each line's guessed wavelength is adjusted for this 'xcorr' shift, and a reference wavelength can then only be associated with a found emission line if they are nearest neighbours to each other.
3. Optical Model Wavelength Solution: Armed with the arc lamp emission line locations and reference wavelengths, these values can be used to constrain the parametrised optical model of the instrument wavelength solution (Sharp & Nielsen). A schematic of the incidence angles for light from the different slitlets is shown below, and illustrates how the optical geometry affects the wavelength solutions realised for each slitlet on the detector.
The optical model fitting routine proceeds in a number of steps, constraining groups of model parameters together. The final 42-parameter model consistently provides high precision wavelength solutions (RMS ~ 0.05Å for the R=7000 gratings, see residual plot below) which also has the advantage of behaving smoothly at the slitlet boundaries (as opposed to edge effects common to polynomial wavelength solution techniques).
Wavelength Solution Stability: For science applications requiring the most precise wavelength solutions (e.g., kinematic studies), WiFeS users should be aware that the instrument wavelength solution can drift by 50-100 km/s during a given night (see Figure below). This is due to the temperature dependence of the grating's effective dispersion (i.e., the l/mm count). For applications requiring better precision than this, local arc frames taken during the night are recommended.