This document describes the basics of reducing flats.
Review the pipeline process first.
Before following this thread, you need to have taken flats and darks. A set of flats is needed for every filter used. For every exposure duration of the flats, you need a set of darks.
For this thread, I have the following files:
Dark-1.6s-1.fits
Dark-1.6s-2.fits
Dark-1.6s-3.fits
Dark-10s-1.fits
Dark-10s-2.fits
Dark-10s-3.fits
Dark-120s-1.fits
Dark-120s-2.fits
Dark-120s-3.fits
Flat-B-120s-1.fits
Flat-B-120s-2.fits
Flat-B-120s-3.fits
Flat-R-1.6s-1.fits
Flat-R-1.6s-2.fits
Flat-R-1.6s-3.fits
Flat-V-10s-1.fits
Flat-V-10s-2.fits
Flat-V-10s-3.fits
Here's a quick overview of the process. For each of the filters (B, V, & R in this example), do the following:
The tricky step is 5. See Step 5 in detail for more details.
The processing can be done in a number of ways. You can use IRAF, ftools, or many popular commercial and free packages.
I suggest using Matlab. It is perhaps not the easiest, but it is the least 'black-boxed'.
Download the Matlab script, ProcessFlats.m.
ProcessFlats.m should be treated as a guide. At the least, you need to edit the first few lines of the file.
Running the script in Matlab will produce the following files:
Flat_B.fits
Flat_R.fits
Flat_V.fits
Slight variations in voltage to the lamps, CCD temperature, or transparency in the dome will lead to offsets in the baselines between the flats (Fig. 1).
The variations are small, on the order of 0.1%, but significant. Consider what the median of three values is; if you have three flats that have natural Poisson variation with sigma=10 counts, but differences in baselines of 50 counts, then taking the median of the frames will simply select all the values from the flat with the intermediate baseline. The Poisson variation of 10 counts will be carried over.
But now consider if we correct for the baseline shift ahead of time. Then for each pixel, the difference between the values for the three flats will be due simply to Poisson noise (or the occasional cosmic ray). Taking the median of those values will reduce the Poisson noise by a factor of 31/2 leading to a Poisson error of about 5 counts (Fig. 2).
|
Figure 2 (click to examine in detail) |
How is the baseline calculated?
For a good first approximation, normalise each flat by its mean value. However,
the presence of cosmic rays and other sporadic strong peaks can skew the mean, as does
the presence of dead pixels.
To determine the normalisation, I prefer to fit a gaussian to the peak in the distribution of counts in each pixel. Most of the pixels will have about the same number of counts. The local distribution will often be normal. But not always, so this method is sometimes flakey or does no better than simply taking the mean.