| findgain | noao.obsutil | findgain |
findgain -- calculate the gain and readout noise of a CCD
FINDGAIN uses Janesick's method for determining the gain and read noise in a CCD from a pair of dome flat exposures and a pair of zero frame exposures (zero length dark exposures).
findgain flat1 flat2 zero1 zero2
FINDGAIN uses Janesick's method for determining the gain and read noise in a CCD from a pair of dome flat exposures and a pair of zero frame exposures (zero length dark exposures). The task requires that the flats and zeros be unprocessed and uncoadded so that the noise characteristics of the data are preserved. Note, however, that the frames may be bias subtracted if the average of many zero frames is used, and that the overscan region may be removed prior to using this task.
Bad pixels should be eliminated to avoid affecting the statistics. This can be done with sigma clipping and/or an image section. The sigma clipping should not significantly affect the assumed gaussian distribution while eliminating outlyers due to cosmic rays and unmasked bad pixels. This means that clipping factors should be symmetric and should have values four or more sigma from the mean.
The formulae used by the task are:
flatdif = flat1 - flat2
zerodif = zero1 - zero2
gain = ((mean(flat1) + mean(flat2)) - (mean(zero1) + mean(zero2))) /
((sigma(flatdif))**2 - (sigma(zerodif))**2 )
readnoise = gain * sigma(zerodif) / sqrt(2)
where the gain is given in electrons per ADU and the readnoise in electrons. Pairs of each type of comparison frame are used to reduce the effects of gain variations from pixel to pixel. The derivation follows from the definition of the gain (N(e) = gain * N(ADU)) and from simple error propagation. Also note that the measured variance (sigma**2) is related to the exposure level and read-noise variance (sigma(readout)**2) as follows:
variance(e) = N(e) + variance(readout)
Where N(e) is the number of electrons (above the zero level) in a given duration exposure.
In our implementation, the mean used in the formula for the gain may actually be any of the mean , midpt (an estimate of the median), or mode as determined by the center parameter. For the midpt or mode choices only, the value of the binwidth parameter determines the bin width (in sigma) of the histogram that is used in the calculation. Findgain uses the imstatistics task to compute the statistics.
To calculate the gain and readnoise within a 100x100 section:
ms> findgain flat1 flat2 zero1 zero2 section="[271:370,361:460]"
To calculate the gain and readnoise using the mode to estimate the data level for each image section:
ms> findgain.section="[271:370,361:460]"
ms> findgain flat1 flat2 zero1 zero2 center=mode
The effects of cosmic rays can be seen in the following example using artificial noise created with the artdata.mknoise package. The images have a gain of 5 and a readnoise of 10 with 100 cosmic rays added over the 512x512 images. The zero level images have means of zero and the flat field images have means of 1000. The first execution uses the default clipping and the second turns off the clipping.
cl> findgain flat1 flat2 zero1 zero2
FINDGAIN:
center = mean, binwidth = 0.1
nclip = 3, lclip = 4., uclip = 4.
Flats = flat1 & flat2
Zeros = zero1 & zero2
Gain = 5.01 electrons per ADU
Read noise = 10.00 electrons
cl> findgain flat1 flat2 zero1 zero2 nclip=0
FINDGAIN:
center = mean, binwidth = 0.1
nclip = 0, lclip = 4., uclip = 4.
Flats = flat1 & flat2
Zeros = zero1 & zero2
Gain = 2.86 electrons per ADU
Read noise = 189.5 electrons
The image headers are not checked to see if the frames have been processed.
There is no provision for finding the "best" values and their errors from several flats and zeros.