input raw frames:SCI_SLIT_STARE_<arm> (arm = UVB/VIS/NIR)
Purpose: Processes the data up to merged 1D spectra
Description: The spectra are bias- or dark-corrected. The order table is used to locate the inter-order regions where the background is fit with a polynomial, which is then subtracted from the data. The frame is flat-fielded. In order to perform an automatic object localization and a single frame cosmic ray rejection a preliminary single frame sky subtraction is performed, followed by an object localization and a single frame cosmic ray rejection (van Dokkum method; van Dokkum 2001, PASP 113, 1420). Finally the estimated sky is put back on the cosmic ray cleaned object spectrum and another sky subtraction is performed. To estimate the sky component, a 1D spectrum of the sky is built. The pixels whose slit position lie outside the localization mask and are far enough from the slit edges are retained to estimate the sky contribution. Their associated wavelength is taken from the wavelength map. The interpolation of the resulting 1D sky spectrum is done with a running median. With the help of the wavelength map the 1D sky spectrum is expanded into a 2D one , which is then subtracted from the science data.The spectra are then rectified, i.e. transformed from pixel-pixel space to wavelength-slit space, and a simple sum extraction is done on the 2D rectified orders before they are merged. For the localization of the target spectrum the rectified merged 2D spectrum is collapsed in wavelength chunks to give a 1D profile along the slit. The center of that profile is determined as the position of the maximum flux, and the edges as the positions where the flux get below a certain fraction of the central flux. These positions are then fit by polynomials. No bad pixel is rejected from the simple sum, and a bad pixel in the 2D rectified frame will contaminate the pixel in the 1D extracted frame at the corresponding wavelength position.