Fringe and Low-Order Additive Corrections in Wide-Field Mosaic Cameras

Introduction

Astronomical CCD images require substantial pre-processing before they can be used for scientific measurements. It is necessary to remove a variety of instrumental signatures. These include correction of the bias level, any significant dark current, and flattening the image. This set of corrections produces an image which is `flat': all pixels have a uniform response to the light falling on them. Although these images can be used to measure accurate stellar fluxes, a further correction may be necessary to make the best use of the images: idiosyncratic variations in the background level should be removed. In this article, we discuss several types of idiosyncratic background variations which are particularly important in wide-field cameras, and demonstrate correction recipes which have been developed specifically for the CFH12K camera, but which can be applied generally.

An idiosyncratic variation in the background implies an additional signal in the image which is not actually a feature of the sky. An important aspect of all such features is that they introduce an additive contribution to the signal in the image: they should be subtracted to perform a photometrically consistent correction. As a consequence, since they are additive and generally distinct in shape from a stellar profile, they do not strongly affect stellar photometry measurements; the major effect is to elevate the background in the vicinity of a star, making detections more difficult. Surface brightness measurements, however, may be affected if the scale of the background enhancement is comparable to or smaller than the structure being measured.

There are several possible sources of idiosyncratic variations in the background. `Fringes', caused by thin-film interference effects in the detector, are one important example. Other examples include scattered moon light, or scattered star light. Scattered star light is frequently observed in images as bright `spurs' or `streaks', extended, frequently narrow regions of elevated light caused when the light from a bright star in the vicinity of the detector field-of-view is reflected at an oblique angle on the detector. This particular type of idiosyncratic background is highly random and difficult to predict, but typically corrupts only a small area. In this article, we will limit our discussion to effects which vary only slowly with time, and which therefore may be measured on a series of images.

We have found it useful to divide the observed idiosyncratic backgrounds in two categories: high spatial frequency structures, which are dominated by the fringe patterns, and low spatial frequency structures, which include several unrelated effects. This separation can be very useful as different techniques are better suited to the different scales. In addition, it is convenient to segregate the effects of the fringes, which have a well-understood and fairly stable physical origin, from the variety of low-frequency terms for which the physical origin is more varied, and often less obvious. Image Selection and Preparation

In order to measure and correct for both types of additive effects, it is necessary to gather a collection of appropriate images. These effects can most easily be measured and corrected using images of the night sky, taken through the filters of interest. An appropriate collection of images would consist of several (or many) images taken in the filter of interest, with sufficiently long exposure times to collect a significant number of counts per pixel. There are several other characteristics which improve the measurement. For reasons which will become apparent below, it is important to use images which are clearly obtained in the night-time and generally free from residual twilight flux. The collection of input images should span a variety of pointings on the sky so that no particular sky features (ie, bright stars, large galaxies, etc) dominate or skew the measurement. Similarly, the collection of input images should be generally free from very large-scale structures (ie, dark clouds, nebulosity, or large galaxies) which would mask the signal of interest.

There is a balance which must be considered in the choice of how much data to use to measure the effects. If too little data, or images spanning too narrow a range of sky pointings, is chosen there will likely be significant residual errors. However, particularly for the high-spatial-frequency components, using images which span a wide range of time may smear out the effect of interest if the signal varies on those time scales. For an independent observer with only the data from a single run, the typical collection of science images may have too limited a range of pointings; such an observer may need to schedule additional 'blank-field' images to guarantee an appropriate set of images for the correction. At CFHT, the Elixir project (Elixir REF) has the luxury of being able to use all images obtained with the CFH12K imager over a wide range of time, longer than an entire semester. Our large disk farm can store in the vicinity of 9 months of CFH12K images on spinning disk. This allows us to explore a wide range of input images in developing the corrections.

Once an appropriate collection of images has been identified, they must be prepared for the measurement by correcting for the bias, dark, and flat-field effects. For the CFH12K images, we create a binned image, replacing each 4x4 pixel group with the median. This step reduces the total data size, making the later calculations faster and the disk-space requirements less taxing. This step does not diminish significantly the measurement of the fringe pattern (and certainly not the low-frequency structures) because the observed fringe structures in our detectors are on larger spatial scales than 4 pixels.

To separate out the high and low spatial frequencies, we extract a very low-order model for the sky \& background from the image. To create the model, we first generate an image for each CCD consisting of 8 x 16 pixels, where the value is given by the average of the inner 50\% pixels of the corresponding 256x256 pixel region in the original image (in fact, we use the equivalent 64 x 64 pixels from the previously binned image). The resulting mosaic image then has the median value subtracted so that these small images represent the low-frequency deviations from a flat image. This small image is used as the set of measurement points to generate a spline for the full-sized image, which is then subtracted from the 4x4 binned image. The result of this process is two images for each input mosaic frame. The first is binned 4x4 from the original image, with a median of the original sky value and only small-scale deviations from a uniform background; we call this image `med'. The second is binned 256x256 from the original, and contains the large-scale variations in the sky across the field of the image; we call this image `map'. The details of these steps, in particular the binning scales, are chosen for the CFH12K mosaic, but the concepts are applicable to any large-scale mosaic camera. [FIGURES: example with Z-band image. 1) detrended frame 2) med 3) map] Fringes Origin of the fringes

Fringes are caused by thin-film interference, particularly in thinned CCDs (REF). The structure of a thinned CCD consists first (in the direction of travel of the incoming photon) of a layer of undoped silicon followed by the pixel structures. The photons generally interact with the silicon, ejecting a photo-electron, in this first layer. Since the optical depth for photons increases with photon energy from red to blue, the blue photons are converted to photo-electrons in the top portion of this silicon layer. Longer wavelength photons penetrate more deeply into the silicon. For photons with wavelengths longer than a certain limit, the optical depth is larger than twice the thickness of this first layer. Photons with these energies can reflect off the gate structures, travel back to the top surface, and reflect again back into the silicon. Such photons can interfere with other photons arriving in the detector. The result is a pattern of enhanced or reduced quantum efficiency depending on whether the photons experience constructive or destructive interference. If the CCD is illuminated with mono-chromatic light of an appropriately long wavelength, the detected photons will show a pattern which varies across the detector, and which depends at any location on the thickness of the silicon structures causing the interference. In practice, the observed patterns typically show ripples with wavelengths of a few to tens of pixels, illustrating the small gradients in the silicon thickness. FIGURE: example of fringing (already above) FIGURE: side-view schematic of fringing?

If the same detector is illuminated with a uniform broad-band source, the range of wavelengths washes out the appearance of the ripples. The flat-field image for such chips therefore includes a fringe pattern with a reduced amplitude. A typical astronomical source with broad-band spectrum will be subjected to the same positional sensitivity variations as the broad-band flat-field illumination, and will therefore be well-corrected with a flat-field image created with a near-continuum spectrum. Although most stars have generally continuum spectra, the night sky has very different spectral characteristics. It is dominated by emission lines, particularly at the red end of the optical region. With a fringing chip, these sky lines create a fringe pattern caused by the combination of the thin-film interference for the different monochromatic lines. The observed fringe patterns therefore depend in part on the variation in the silicon thickness across the chip, and in part by the particular lines which are strong in the night sky. Since the composition and conditions of the night sky do not vary by large amounts, it is not surprising that in general, the observed fringe patterns do not vary strongly from image to image.

Although the fringe pattern is generally consistent, the amplitude of the fringes, and their strength relative to the uniform sky background may vary significantly. Any continuum emission which varies independently of the line emission will change the uniform background relative to the fringe pattern. The most obvious sources of continuum emission from the night sky are the excess scattered light from the moon or from the sun near twilight, both of which generally exhibit a solar spectrum, modified by Raleigh scattering. This effect is very apparent in a series of images taken soon after sunset. There is a gradual transition from images with the appearence of a twilight flat to images dominated by the fringe pattern. [FIGURE] In addition to changes in the continuum background, the line strengths may vary with changes in the conditions at high-altitude, such as temperatures or solar-wind particle backgrounds. The first-order effect of changes in the conditions is simply a change in the amplitude of the fringes compared to the sky. However, if the line {\em ratios} change significantly, the pattern of the fringes may also shift: ie, the width of the ripples or the relative intensity of the ripples in different parts of the detector may change.

The practical result of the two effects discussed above is two-fold. First, the dominant effect is that the relative intensity between sky and fringe amplitude varies significantly. This means that, unless the collection of images are particularly consistent, it is insufficient to depend on the sky as a measure of the fringe pattern. [DEMONSTRATE WITH DATA]. The fringe amplitude must be measured on its own accord. Second, the fringe {\em pattern} is largely stable, but second-order changes in the fringe pattern make it difficult to apply a single fringe pattern to all images obtained over a long period. Measuring the fringes

To measure the fringe pattern strength for the CFH12K mosaic, we have developed a recipe which balances the need for flexibility, with the need for a rapid measurement. In summary, the process is as follows: First, we perform a measurement of the fringe pattern intensity on the CCDs independently. Next, we determine the correlation of the fringe strengths between the different chips using the measurements from many images. Each CCD may have a different fringe intensity caused by different treatment of the silicon in the manufacturing process, however, since all CCDs are illuminated by the same emission lines, variations in the fringe amplitudes on the different chips are strongly correlated. The fringe strength correlation allows us to use the information from each CCD as an independent measurement of the intensity of the lines causing the fringe pattern. We then use these measurements to determine an optimum `fringe pattern strength' for the full-mosaic image. This optimum fringe pattern strength is then used to determine an optimum fringe strength for each CCD, which is then used to guide the generation of a master fringe frame. For the measurement of the fringe pattern, we use only the `med' images described above. These images sample the high-frequency structures, and are not strongly affected by large-scale features of the images.

To measure the fringe pattern strength on a single image, we construct a collection of points which sample the peaks and valleys of the fringe pattern. The points are grouped in pairs, with one point for a peak and one for an associated valley. The sky value is measured for each of these points. This measurement can be done by finding the minimum or the median in a box of a fixed size for each point. For the CFH12K, we use the median in a 7x7 box for each point. The result for each pair of points is a measurement of the local fringe strength, $dF = max - min$, and the sky value (the value of the 'min' point). The pattern of fringe sample points depends on the filter, but may be generated only once for each combination of chip and filter.

For a given CCD, we can now calculate the fringe pattern strength. This can be done in several ways. One option is to use the median of the collection of $dF$ values. Although the $dF$ values for a single CCD image may have a large range, the median measures a fairly consistent portion of the collection of $dF$ values. An alternative is to assemble all $dF$ values for a given CCD image into a vector $\bar{F}$, using a fixed order for the point pairs. Taking the collection of all vectors $\bar{F}_i$ for all images from the specific CCD, we generate a master vector $\bar{F}_o$ by calculating the median vector or all $\bar{F}_i$. The fringe strength may then be calculated as the median of the ratio between $\bar{F}_i$ and $\bar{F}_o$. This operation is somewhat more stable than the simple median because the intrinsic variation in fringe strength across the image is removed, and outliers should have less impact on the measurement. A third possibility is to construct a rough master fringe image by median-combining the input images without corrections (or a simple scaling by the sky). The fringe point pairs may then be measured, and the equivalent master vector $\bar{F}_o$ generated from this master image. The fringe strength of an input image would then be derived from the ratio of this master vector to the vector of the input image as in the previous method. In practice, we find that the the simplest version, the simple median of the $dF$ values, is sufficiently accurate.

The result of the previous step is a collection of measurements of the fringe pattern strengths $F(j,i)$ for each CCD $j$ from each image $i$. The accuracy of this measurement may depend on several factors, the most important being the presence of large scale structures or bright stars. In a typical large mosaic image, it is not unusual for one or two CCDs to be affected by bright stars, leaving the rest to provide a clean measurement of the fringe strength. An improved measurement of the fringe strength for an image may be determined by combining the measurements from all chips. The fringe strengths may be very different from CCD to CCD as a result of the different manufacturing details. However, the variations in the fringe pattern strengths between chips are strongly correlated. The explanation for this lies in the fact that the variations in the fringe pattern strength from image to image is caused by real changes in the line strength that is causing the fringe pattern. Since the fringing in all chips is caused by the same lines, the variations in the amplitude should be correlated, even though the specific response of each chip depends on the details of its construction.

To combine the measurements from the different chips, we determine the correlation between the fringe strengths in the different chips. In practice, we choose a reference chip, generally the chip with the strongest fringing pattern, and determine the relationship between the fringe strength on a specific chip $j$ with that reference $j_{ref}$: $F(j,i) = C0_j + C1_j*F(j_{ref},i)$. For the collection of fringe strength measurements, we determine the $2 Nccd$ coefficients $C0_j, C1_j$ by determining the linear fits.

Once the coefficients $C0_j, C1_j$ have been determined, each CCD image represents a measurement of the fringe strength on the reference chip: $F(j_{ref},i) = (F(j,i) - C0_j) / C1_j$. The collection of $Nccd$ CCDs from a single full mosaic image represents $Nccd$ independent measurements of the reference chip fringe strength $F(j_{ref},i)$. We can determine the optimum value for $F(j_{ref},i)$, which we will call $F_{ref}(i)$, from the average, weighted average, or other equivalent statistic of the $Nccd$ measurements. This optimum value of the reference chip fringe strength can then be used to determine the optimum values for the fringe strengths on each of the individual chips: $F_{opt}(j,i) = C0_j + C1_j*F_{ref}(i)$. These optimal per-chip fringe strengths are then used to guide the construction of a master fringe frame.

The master fringe frame is constructed by removing the local sky on each chip and scaling the remaining fringe pattern to a consistent level. This could be done by normalizing the fringe strength, dividing each image by $F_{opt}(j,i)$ determined above. In the Elixir system, we generate a master frame which is normalized to the amplitude on the frame with the maximum fringe strength, and has the sky value of that frame. The resulting image has the appearence of an image of the night sky, without the stars or other features specific to the sky. The values for each chip of the fringe strength and the sky are maintained in the header for the master image so these values do not need to be re-measured when the master is applied. The correlation coeffiecients $C0_J$, $C1_J$ are also stored in the image headers.

The construction of a final set of master fringe frames is an iterative process. An initial master frame is constructed using all input images with the recipe described above. This master frame is then applied to each input image to generate a residual image. By examining these residual images, and the variations in the residual fringe amplitude, we find that those images with substantial real sky structures (large galaxies, bright stars, nebulosity, etc) can be easily recognized. The worst of these images are excluded from the creation of a second master. This process is repeated until the errors introduced by real sky structures are minimized. The final fringe frame is returned to the full pixel resolution to make it easier to apply the image to a science frame. In the Elixir system, we also add the final master fringe frame to a database of all detrend images for the camera.

To apply the master fringe frame to a science frame, we first measure the fringe strength in the science image using the same technique described above. Since the header of the master fringe frame contains the fit coefficients, we can calculate the value of $F_{ref}(i)$ for a single input science frame and therefore determine an optimal fringe strength for each CCD, even if there are structures on some of the CCDs. The master frame is scaled to match the science frame fringe amplitude and the result is subtracted. Low-spatial frequency structures

Low-spatial frequency idiosyncratic backgrounds may be a serious detriment to projects which need to combine images with large offsets. This is particularly true for projects which need to determine the difference image between input images which are offset by multiple chips in a mosaic camera. They may also be a concern for determining surface-brightness measurements of large structures. A uniform correction for these large-scale deviations may help in many situations.

There are a variety of possible causes of large-scale excursions in the background of mosaic images, and many of them can be identified in CFH12K data. One frequent effect is a simple chip-to-chip offset in the flattened sky value. The most likely cause of this is the difference in the spectral characteristics of the night sky and the twilight sky used to generate a flat-field image, combined with the varying spectral responses of the different CCDs. This type of pattern will be particularly strong in mosaic imagers which incorporate multipe types of CCDs. In the CFH12K, there are two different CCD types (EPI vs HiRO) as well as multiple run lots among those of the same design.

Another cause of low-frequency background variations is scattered light. We have documented elsewhere (REFs) the presence of scattered light which contaminates the twilight flats in a generally consistent way from twilight period to twilight period. This scattered light most likely comes from a variety of surfaces visible to the mosaic which scatter a small amount of light in a wide range of angles. The resulting pattern has the general character of a wide, vignetted beam, with excess light near the center and a gradual fall-off; the shape of the pattern is smooth, vaguely dome-like. The scattered light is present in both twilight flats and night-time sky images. The flat-field images we use for CFH12K have been corrected to remove this effect, which would otherwise cause systematic errors in the photometric calibration of the images. This important effect has been described elsewhere for the Elixir system (REF), and has also been described for other telescopes as well (eg, WFI ref).

A properly flattened image of the night sky will also show background variations resulting from this effect. For the twilight period, the ratio of the direct to the scattered light is fairly constant, since both are dominated by the brightness of the twilight sky. However, for the night-time sky images, the strength of the scattered light pattern will depend on the intensity of the illumination in the dome, in particular if there is any moon light entering the dome, this pattern should be quite strong. This large-scale scattered light contamination will likely be present in all large-scale mosaic cameras as it is extremely difficult to completely baffle the incoming light sources.

A third effect we have observed is intrinsic to certain filters, and has been most well studied R filter images. The red edge of the R filter band-pass is coincident with a particularly strong night-sky emission line. Since the effective filter bandpass is a function of the incident angle, this line is admitted for certain beam angles, and excluded at other angles. The result is that the portion of the images near the center of the detector has a lower sky flux (since the line is rejected), while the outer regions have a higher sky flux, with a crisp, circular transition between the two level. - investigate the other filters Halpha, NB920, etc. FIGURE: examples of each effect. FIGURE: moon angle vs dome pattern strength?

The three effects described above, and perhaps others we have not yet identified, may be present in any image, with a somewhat arbitrary mixture of the different components. As a result, a single master frame cannot be created by simply averaging (or medianing, etc) a selection of input images, unless those input images are all very consistent in the contributions of the different possible components. What is needed is a process to determine, from a collection of input images, an appropriate set of basis functions which describe the components of interest. Having such a set of basis functions would allow us to construct a model of the backgrounds specific to a given image, which could then be used to remove these low-frequency structures. A variety of possible basis functions can be imagined, including Fourier series, or Bessel functions. Neither of these functions particularly well represents the general patterns observed in the actual images, however. We turn instead to Singular Value Decomposition to find an appropriate basis set.

Singular Value Decomposition (SVD) is an effective tool to construct a set of orthogonal basis vectors given a collection of independent input vectors. We provide the following description based on Press et al (REF): Consider a collection of $M$ images, each with $Nx \times Ny = N$ pixels. We can construct a single vector of dimension $N$ for each image in which the pixels are simply listed in sequence. We can construct a matrix $A$ from the $M$ such vectors by assigning the matrix columns to each successive image. The resulting matrix $A$ consists of $M$ columns, each representing an image, and $N$ rows, each representing a specific pixel in the images. SVD allows us to decompose $A$ into three separate matrices: $A = U w V^T$. The matrix $U$ consists of the eigenvectors of A, a set of $M$ orthonormal vectors each of length $N$, $w$ is a diagonal $M \times M$ matrix in which the diagonal elements are the weights for each of the eigenvectors, and $V^T$ is also an orthonormal matrix, with dimension $M \times M$ which represents the contributions of each weighted eigenvector to each of the original input vectors in $A$.

In practice, we perform SVD on the matrix A formed from the small 'map' images derived from a collection of input images. The resulting weights show that only the first few eigenvectors, or 'modes', contribute significantly to the dominant structures. We can therefore generate a model of the low-frequency backgrounds by combining an appropriate set of the strongest few modes for any input image. The appropriate contribution for each mode in a given input image can be found by taking the dot product of the equivalent vectors. Given an input image $I$ and a particular mode $M_i$, the appropriate coefficient $a_i = \Sigma (I * M_i)$, where the multiplication is performed on a pixel-by-pixel basis, and the sum is performed over all pixels. Given $n$ significant modes, the background model is constructed by summing each mode times its coefficient: $\Sigma a_i M_i$, where here the sum is performed on per-pixel basis.

We have performed SVD on input $R$, $I$, and $Z$ images from the entire first semester of 2001 operations of CFH12K. The results clearly demonstrate the viability of this technique for measuring the low-spatial frequency structure in an image. Figure N shows the first N modes from the R band data. These images clearly represent the scattered light 'dome', the filter 'skyring', and two terms which allow for admixture between the modes. Note that the determined modes must be orthogonal, while the real, physical effects are not necessarily orthogonal. The application of these modes to the input images shows how reliably this method can correct a wide range of input images. Using the same 4 modes, we can correct any image from the entire 2001A R-band dataset, with residuals which are NUMBER.

Similarly, the $I$-band and $Z$-band decomposition can be used to effectively correct the background variations in $I$ and $Z$ images from the entire period. The dominant $I$-band mode shows the chip-to-chip offset mode which is clearly apparent in the I-band images, but not in the R-band data. The next modes show the scattered light 'dome' pattern No 'skyring' type of pattern is present in either $I$ or $Z$. [FIGURE - Examples of R, I, Z complete processing] Conclusions

We have demonstrated effective techniques for extracting and correcting for both high-spatial-frequency and low-spatial-frequency idiosyncratic backgrounds in large mosaic images. The low-spatial frequencies are well corrected using a basis set of modes constructed from small model images, using the SVD technique. The high-spatial frequencies are corrected using a more direct measurement of the the fringe pattern. These recipes provide a useful technique for analysing any large-scale CCD images. In addition, the SVD process provides extra insight into the origin of the large-scale structures visible in CCD images.