The flat is the normalised difference of two images, one with the lamp on and another with the lamp off. In general, three pairs of images are taken.
The eclipse recipe that produces the master flat fields that are given to the users is called isaacp sw_spflat. The input file(s) is an ASCII file containing an even number of FITS files. The list consists of a series of image pairs. Each pair consists of a exposure with the lamp on and one with the lamp off.
The recipe starts by classifying images by instrument setting. A setting is defined by the slit used, the central wavelength and the grating name, which are obtained from the FITS header. Each pair of on-off spectra are then reduced as follows:
The algorithm is illustrated in figure .
The output consists of one master flat for each instrument setting and a PAF file. The master flats are named [outname]_X.fits where X goes from 1 to the number of settings and outname is the basename used for output files (specified by the user or defaulted to the input file basename).
The PAF file is an ASCII file containing keywords for quality control.
A weakness of the recipe is that a residual bias remains after the exposure with the lamp off is subtracted from the one with the lamp on. This is a fundamental property of the array - the bias is a function of the amount of flux that the array sees. It may be possible to use the parts of the array that are not exposed to light to partially remove the residual bias; however, this is not yet part of the recipe.
At some wavelengths, the spectral response of the lamp is a very strong function of wavelength, and it is possible, in extreme cases, for the frame with the lamp off to have a higher level in some regions that the frame with the lamp on. In these cases, it is better to estimate the bias from the regions which do not have direct flux, i.e. the 50 or so pixels at the top and bottom of the image.
The recipe does not remove the wavelength dependence of the lamp from the flat field. This is removed when the telluric standard is divided into the spectrum of the science target. Implicit in this statement is that the same flat was used for both the target and the standard and that the target and the standard were observed at roughly the same place on the array. If neither of these things are true then flux calibration (relative and absolute) will be less accurate.