SEE_ALSO

## NAME

polyepoch -- Fit a set of quantities as polynomial functions of epoch.

## USAGE

`polyepoch intable outtable order weight ncoeff base_temp base_time`
`y_root dy_root base_value_key trefname tminname tmaxname`
`nattrib attrib1 attrib2 attrib3 attrib4 attrib5`

## DESCRIPTION

Fit a set of quantities (e.g., temperature-dependent coefficients of dark count) as polynomial functions of epoch. This routine is usually used to obtain the 16 polynomial coefficients that the Routine Science Data Processing (RSDP) system needs to calibrate the dark signal, the pre-amp noise, the current to voltage converter (CVC) offset, and other quantities. We will hereafter refer to the coefficients to be fitted as temperature-dependent coefficients, and they are to be expressed as polynomials of epoch. However, this routine is NOT limited to such application, as its flexibility is reflected in the user-defined column names of input and output tables and degrees of the input and output polynomial functions.

The minimum order of the fitting polynomial is 1, the maximum is 9, and the default is 3. The maximum number of input data points (number of rows in the input table) is 2,000. Input temperature-dependent coefficients are in single-precision but are double-precision during the polynomial regression. Epoch is in double-precision throughout.

## PARAMETERS

- intable [file name]
- Name of the input table, which has the following columns:
(y_root)0, (y_root)1, etc. These are temperature-dependent coefficients (real). The actual column names must be specified by the user through the 'y_root' parameter. For example, if 'y_root' has a value of "A", then the names of the columns that actually contain the temperature-dependent coefficients are 'A0', 'A1', etc. (dy_root)0, (dy_root)1, etc. Standard deviations of temperature-dependent coefficients (real). 'ORDER' Order of polynomial used in temperature fitting (int). (trefname) Reference temperature, as passed from the 'trefname' parameter (real). (tminname) Minimum temperature, as passed from the 'tminname' parameter (real). (tmaxname) Maximum temperature, as passed from the 'tmaxname' parameter (real). 'TYPE' Data type of the observation (char*7). 'EPOCHAVE' Average epoch (double). 'EPOCHMIN' Lower limit of input epoch (double). 'EPOCHMAX' Upper limit of input epoch (double). (attribi) Attributes to be copied from the input table to the output table, as passed from the 'ATTRIBi' parameters.

- outtable [file name]
- Name of the output table created by
`polyepoch`. This table will contain the following columns:(base_value_key) Base value of the calibration coefficients (real). The actual column name is passed from the 'base_value_key' parameter. 'A00', 'A01', etc. Calibration polynomial coefficients (real). 'CHISQ0', 'CHISQ1', etc. Chi-squares of the polynomial fits (real). 'WEIGHT' Weighting flag of the fit (real). 'BASE_TEMP' Reference temperature (real). 'TEMPMIN' Overall lower limit of epoch (real). 'TEMPMAX' Overall upper limit of epoch (real). 'BASE_TIME' Reference epoch (double). 'EPOCHMIN' Overall lower limit of epoch (double). 'EPOCHMAX' Overall upper limit of epoch (double). 'ORDER' Order of the polynomial fit (int). 'NPOINTS' Number of input data points (int). 'TYPE' Data type of the observation (char*7). ('ATTRIBi') Attributes to be copied from the input table to the output table. The actual attributes are passed from the parameters, 'attrib1' through 'attrib5'.

- order = [integer, min = 1, max = 9]
- Maximum degree of the fitting polynomial.

- weight = -2. [real]
- Weighting flag of the temperature-dependent coefficients. The weight
of each data point is proportional to the standard deviation with this
flag as its exponent. For example, if
`weight = 0`, equal weights is applied (real).

- ncoeff = [integer, min = 1]
- Number of input temperature-dependent coefficients.

- base_temp = 0. [real]
- Reference temperature in degrees Celsius.

- base_time = 32000. [double]
- Reference epoch (number of Julian days from 1900.0).

- y_root = "A" [string]
- Root name of the column names of input temperature-dependent coefficients.

- dy_root = "DA" [string]
- Root name for the column names containing standard deviations of the input temperature-dependent coefficients.

- base_value_key = "BASE_VALUE" [string]
- Output table column name of the base value.

- trefname = "BASE_TEMP" [string]
- Column name of reference temperature in the input table.

- tminname = "TEMPMIN" [string]
- Column name of minimum temperature in the input table.

- tmaxname = "TEMPMAX" [string]
- Column name of maximum temperature in the input table.

- nattrib = [integer, min = 0, max = 5]
- Number of attributes to be copied from the input table to the output table.

- attrib1, attrib2, attrib3, attrib4, attrib[strings]
- Attributes to be copied from the input table to the output table. Allowed
attributes are:
DET_NUM Detector ID (int). APER_NAME Aperture name (char*10). VOLTAGE High voltage setting (real). VGAIND Gain setting (real). THRESH Discriminator threshold setting (real).

## EXAMPLES

1. Fit third order polynomials to temperature-dependent coefficients `A0`, `A1`,
`A2`, and
`A3`, as functions of epoch. The input data are in a file called
`xpolyepoch$input` and
the results will be written to an output table called `ypolyepoch$output`.
The weight of each
data point is inversely proportional to its variance. The reference temperature
is 0 and reference epoch is 32000. Copy detector ID's and aperture names from
the input table to the output table.

hs> polyepoch "xpolyepoch$input" "ypolyepoch$output" 3 -2 4 0 32000 "A" "DA" "BASE_VALUE" "BASE_TEMP" "TEMPMIN" "TEMPMAX" 2 "DET_NUM" "APER_NAME" " " " " " "

## BUGS

## REFERENCES

## SEE ALSO