This section of code determines the maximum continuum and average background DN levels for data utilizing the same rotated raw image as described in Chapter 4.6. This information is stored in the FITS header and history portion of the label as keywords. Although this information is not used in subsequent portions of image processing, it provides the user with a consistent quick-look estimate of the exposure level for a given image. The continuum levels for low- and high-dispersion wavelength calibration and flat-field exposures are set to zero, regardless of the output from the code.
The continuum level is determined in the following manner. Several
predefined 2-D regions along the dispersion direction, encompassing both
background and spectrum, are sampled. The sample areas are placed so as
to avoid most emission lines and were carefully chosen after examining a
variety of exposures of stars with different spectral types. The
brightest pixels within each zone are averaged together to derive a peak
continuum level for that region. The DN averages for each region are
compared, and the maximum is chosen as representative of the continuum
level. An image is considered to be overexposed (i.e., continuum level
set to 255 DN) if 5 or more pixels in any single region are saturated.
The approximate low-dispersion wavelengths for each sample area are
listed in Table 4.8.
Low-dispersion background levels are calculated by averaging the DN values for a line of pixels (see Table 4.8 for the wavelength boundaries) sampled parallel to the dispersion and midway between the large- and small-apertures. For high-dispersion, a swath of interorder pixels adjacent to the respective continuum section is averaged. The background level corresponding to the maximum continuum region is recorded.