An average flat-field frame of a set of flat-field frames.
munipack flat [.. parameters ..] file(s)
The flat-field frame is a map of the photometric response of an instrument (both detector and optical configuration together). Flat-fields are used to remove defects like dust, vignetting and other imperfections on a single pixel base. Flat-fields can be acquired on sky during twilight, as night sky images and the dome flats. This routine creates the flat-field frame by averadging of a serie of such images.
The output flat-field Fij is computed as the (robust) average of every pixel of pre-scaled input images (I'k)ij:
Fij = 1/(1 - 〈I'k〉ij),
where i,j is an index of a pixel and k is an index of an image. Input images (Ik)ij are pre-scaled as
I'ij = (Iij - 〈Iij〉) / 〈Iij〉,
where the average of whole image is 〈Iij〉 . The rescaling is used to unifying possible different light levels (in twilight flat-fields).
The averaging of flat-fields is computed by the robust algorithm. Amount of frames is not limited. Just a single frame can be provided, which normalizes the input. Robust method works very well for thirteen and more frames.
The input flat-fields can be pre-corrected for both bias and dark:
Iij → Iij - x Dij - Bij.
The meaning of x and the algorithm itself are the same as in photometric corrections.
The flat-field can be scaled onto an output level. The default value is 1.0 which is suitable for any situation when output is stored as float numbers (BITPIX=-32). When integer numbers are preferred (a litle bit reduced numerical precision is acceptable), set the output level to the half of range for the integer data-types (for BITPIX=16 is range 65536 and half about 30000. In the case, any photometric information is lost!
It is strongly recommended correct setting of FITS_KEY_FILTER (environment variables) because the filter should be usable for later processing.
Flat-fielding can be used to estimate of gain of a camera. The estimation determines the standard deviation σ of residuals between output mean and a single flat-field frame. σ ≈ 1 is near to one for correct value of gain. This is basic property of Poisson distribution which has bounded value of number of detected particles n and its standard deviation σ by relation σ=√n. The relation can be used for only when other sources of noise are negligible. Therefore, the ideal value of n is about half of full well capacity of detector (not ADU!).
The gain g is determined by the relation
g = 1 / σ²
The estimated values of standard deviation σ and gain are printed in the output of the routine as last two columns of the table:
... Filename, mean, correction, std.dev., gain: flat_V_000001.fits: 2.08154E+05 -16.34081 1.92080 0.271 flat_V_000002.fits: 1.84904E+05 -16.02431 1.89552 0.278 [σ] [g] ...
Determination of gain is so slow that one is computed only on request by using of --gain-estimate switch (verbose mode is invoked).
When gain keyword is available in the header, the values are pre-scaled by the gain so results will realtive against to the value. To suppres use of the value, set gain by providing -gain 1.
The estimation of value of gain is just indicative and the check by some alternative method (factory provided, …) is highly recommended!
On input, list of frames representing the flat-fields is expected. Optionaly, both bias and dark can by pre-applied on every frame.
On output, just the flat-field frame is created.
Also see Common options
$ munipack flat -o f_R.fits -dark d10.fits f10_*R.fits
If one needs frame with natural light-level and 16-bit depth, one is using
$ munipack flat -B 16 --level 10000 -o f_R.fits -dark d10.fits f10_*R.fits
Light Curve Tutorial, Photometric corrections tutorial, Averaged bias frame, Averaged dark frame.