The main steps in the reduction of NIR spectroscopic data are flat-field correction, subtraction of sky emission, wavelength calibration, correction for telluric absorption and correction for optical system plus detector efficency.
LonGSp NICMOS3 detector has a pattern of bad pixels. All raw frames are cleaned by substituting the corrupted values with an average of the neighbouring pixels taken along the direction with the lower gradient.
Flat field frames are badpixel corrected, dark subtracted and normalized. Then additive components are subtracted by fitting a high order two dimensional polinomial which eliminates reflexes due to optics but not the differential instrumental response. All raw frames are then dark subtracted and divided by the normalized flat field.
If the order of observed frames is A1,B1,B2,A2 the sky is subtracted by considering (A1+A2)/2-(B1+B2)/2. However a simple sky subtraction is almost never enough to properly eliminate the bright OH lines whose intensity varies on time scales comparable with object and sky observations. Moreover the grating can move by tiny amounts (usually a few hundreds of a pixel) which are nevertheless enough to produce residuals well over the detector noise. To correct for these two effects the sky frame are multiplied by a correcting factor and shifted along the dispersion direction by a given amount. These factors and shifts could be chosen automatically by minimizing the standard deviation in selected detector areas where only sky emission is present. Because this effect increases with the integration time it is adviceble to use the upper limits of 40 seconds in J and H and 60 seconds in K for the elementary integration time.
Slit images at various wavelengths are tilted as a consequence of the off-axis mount of the grating. Sky subtracted frames are corrected computing analitically the tilt angle from the instrumental calibration parameters or directly measuring it from the data.
Wavelength calibration in LonGSp data is ususally made using OH sky emission lines. The wavelength dispersion on the array is linear within a small fraction of the pixel size and is computed analitically once the central wavelength of the frame is known. At beginning the nominal central wavelength used in the observations is assigned to a properly chosen sky frame. Then the calibration is refined using the brigth OH sky lines (precise wavelengths of OH lines as well as a discussion of their use as calibrators are given in Oliva & Origlia, 1992; A&A, 254, 466).
The same procedures are applied to the reference stars frames to obtain the calibration spectra. The object frame is then divided by the reference spectrum to correct for telluric absorption. The spectrum of a photometric standard star can be used to flux calibrate the final frames.