input raw frames: SCI_SLIT_OFF_<arm> (arm = UVB/VIS/NIR)
Purpose: Processes the data up to merged 1D spectra
Description: The raw frames are composed of a series of couples with object(+sky, on) and sky only (off). Each couple (on, off) is reduced separately. The frame difference on-off is computed to subtract the sky contribution. The order table is used to locate the inter-order regions where the residual background (after the off subtraction) is fit, which is then subtracted from the difference data. In order to detect both the positive cosmic ray hits (from on) and negative ones (from off) in on-off, the frames |on-off| and sign(on-off) are computed so that on-off = sign(on-off) x |on-off|. The cosmic ray hits are corrected using the Van Dokkum algorithm (van Dokkum 2001, PASP 113, 1420) on |on-off|, and the resulting frame is multiplied by the sign(on-off) frame. The frame on-off is flat-fielded and rectified, i.e. transformed from pixel-pixel space onto a regular grid in wavelength-slit space. The localization is done on the rectified frame to derive the position along the slit. The on-off frame is shifted to the position of the first on frame. A 1D spectrum is produced by collapsing the 2D product on a user-specified range of slit positions. The OFF frame is processed as well to provide a measuerment of the sky background.