# Averaged dark frame

Compute an average dark frame of a set of dark frames.

## Synopsis

`munipack dark [-bias file] [..] file(s)`

## Description

A dark frame is a map of a dark current, thermally generated charged particles captured in pixels. Amount of the dark current is proportional both temperature and exposure time. This routine creates an average dark frame, sometimes named as a masterdark.

An output image Oij is computed as the average of every pixel of input images (Ik)ij:

Oij = 〈Ik - B〉ij,

where i,j is an index of a pixel and k is an index of an image. The bias frame Bij is optional. When one is available, one is subtracted from dark exposures before averaging.

It is strongly recommended correct setting of FITS_KEY_EXPTIME (environment variables) because the exposure time will usable for later processing. Chip temperatures are checked to be equal during processing when FITS_KEY_TEMPERATURE is valuable.

## Input and output

On input, list of dark frame frames is expected. Optionaly, a bias can by pre-applied on every frame.

On output, a single file representing of mean dark frame is created. The file has STDERR extension with standard errors. Masked values (if parameter `-bitmask` is presented) are set to the frame mean.

## Parameters

`-bias file`
  use the specified bias frame
`-bitmask file`
  mask frame (see phcorr for description). Only pixels, marked by this mask are processed.
`-st, --saturate s`
  Set saturate limit in units of input frames. Any pixel out of the range th < pixel < s (see also --threshold) is rejected the processing. This switch is useful mainly for over-exposed parts of frames and elimination of non-linear parts of gradation curve. If unset, the value is determined from FITS header (by FITS_KEY_SATURATE, see). If the keyword is not found and the frame contains an integer number type, the maximum value 2**BITPIX-1 is provided, otherwise the maximum value of given data-type is used (which practically switch-off the saturation bound check). The value is set in ADU (values reported by camera).
`-th, --threshold th`
  Set threshold limit in units of input frames. Any pixel below the value is rejected from the processing. If unset, the value is number one. Threshold is minor significance parameter. It should help for faulty values or filtering of bad pixels. The value is set in ADU (values reported by camera).
`-B bitpix`
  set numerical type of output images, see Common options (default -32)
`-o filename`
  save to the output file, see Common options

Also see Common options. A temperature and exposure time parameteres are set via Environment variables.

## Examples

    $ munipack dark -o d120.fits d120_*.fits

Single dark image
Mean of dark frames.

## See also

Light Curve Tutorial, Photometric corrections tutorial, Averaged bias frame.