### CALCFLAT

Calculate a flatfield solution from a flatfield observation

#### Description:

This routine calculates a flatfield solution from a flatfield observation.

The flatfield observation consists of a series of measurements taken at various pixel heater settings. One standard SCUBA-2 raw data file is stored for each measurement.

An optimum pixel heater setting is chosen at the time of observation. The procedure is to record measurements at heater settings around this optimum value, continually returning to the optimum, which is used as a reference to subtract pixel zero-point drifts.

#### Parameters:

Input files to be processed. Must all be from the same observation and the same subarray.
Method to use to calculate the flatfield solution. Options are POLYNOMIAL and TABLE. Polynomial fits a polynomial to the measured signal. Table uses an interpolation scheme between the measurements to determine the power. [POLYNOMIAL]
Control the verbosity of the application. Values can be NONE (no messages), QUIET (minimal messages), NORMAL, VERBOSE, DEBUG or ALL. [NORMAL]
##### NGOOD = _INTEGER (Write)
Number of bolometers with good responsivities.
##### OUT = NDF (Write)
Output flatfield file. The primary data array contains the dark subtracted measurements for each heater setting. The flatfield itself is stored in the .MORE.SCUBA2.FLATCAL extension. A default output filename based on the date of observation number, subarray name and observation number will be suggested.
The order of polynomial to use when choosing POLYNOMIAL method. [1]
Reference pixel heat resistance. Defines the mean power scale to be used. [2.0]
A group expression containing the resistor settings for each bolometer. Usually specified as a text file using " ^" syntax. An example can be found in $STARLINK_DIR/share/smurf/resist.cfg [$STARLINK_DIR/share/smurf/resist.cfg]
##### RESP = NDF (Write)
Responsivity image with variance. No image is written if NULL. [!]