SEE_ALSO

## NAME

twodpolyfit -- Fit a polynomial function of temperature and epoch.

## USAGE

`twodpolyfit intable outtable scheme threshold order1 order2 `
`yname yerrname x1name x2name base_temp base_time `
`nattrib attrib1 attrib2 attrib3 attrib4 attrib5`

## DESCRIPTION

This task will fit any quantity (for example, dark count), as polynomial functions of temperature and 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, pre-amp noise, current to voltage converter (CVC) offset, and other quantities. This task fits the 2-dimensional polynomial function in both dimensions at the same time by using the singular value decomposition (SVD) method. Although the current pipeline only requires third order polynomials in each dimension, this task is a more generalized and flexible tool which can fit polynomials up to 6 orders in each dimension, allowing the user-definable column names in the input table to be used for other purposes.

Input data are single precision, but double precision calculations are performed. Epoch is in double precision throughout. Any number of input data points can be used.

## PARAMETERS

- intable [file name]
- Name of the input table; this table has the following columns:
(yname) Measured quantity to be fitted with a polynomial function, e.g., dark counts (real). The actual column name is passed from the 'yname' parameter. (yerrname) Standard deviations of the measured quantity (real). The actual column name is passed from the 'yerrname' parameter. (x1name) Independent variable of the first dimension, usually the temperature (real). The actual column name is passed from the 'x1name' parameter. (x2name) Independent variable of the second dimension, usually the epoch (double). The actual column name is passed from the 'x2name' parameter. 'TYPE' Data type of the observation (char*7). (attribi) Attributes to be copied directly from the input table to the output table. The actual column names and data types are passed from the parameters 'attrib1' through 'attrib5'.

- outtable [file name]
- Name of the output table created by
`twodpolyfit`; this table has the following columns:'BASE_VALUE' Base value of the calibration coefficients (real). 'A00', 'A01', etc. Calibration polynomial coefficients (real). 'SIGMA00', 'SIGMA01', etc. Uncertainties of 'A00', 'A01', etc. (real). 'C(10,00)', 'C(20,00)', etc. Covariances between 'A10', 'A00', and 'A20', 'A00', etc. (real). 'CHISQ' Chi-square of the polynomial fit (real). 'PROBABILITY' The chi-square probability of the fit (real). 'BASE_TEMP' Reference temperature (real). 'TEMPMIN' Lower limit of temperature (real). 'TEMPMAX' Upper limit of temperature (real). 'BASE_TIME' Reference epoch (double). 'EPOCHMIN' Lower limit of epoch (double). 'EPOCHMAX' Upper limit of epoch (double). 'ORDER1' Order of the polynomial fit in the first dimension (int). 'ORDER2' Order of the polynomial fit in the second dimension (int). 'NPOINTS' Number of valid input data points (int). 'TYPE' Data type of the observation (ch*7). (attribi) Attributes to be copied from the input table to the output table as passed from the 'attrib1' through 'attrib5' parameters.

- scheme [string, allowed values: auto | exam | fixed]
- Fit scheme to be used in this task. If this parameter is passed a value
of "fixed", the fit will be carried out once
at the specified polynomial orders and the results will be written
to the output
table. If the value "exam" is passed, then the fit will
be carried out to all orders no larger than the specified orders,
a matrix of chi-square probabilities and a matrix of chi-squares
are output to the screen and the log file, and no result is written to the
output table. If the value "auto" is passed to
`scheme`, all lower orders are carried out in the same way as the "exam" mode, and the lowest order that has a chi-square probability larger than`threshold`will be used for the final result. If no order has a probability larger than`threshold`, the specified orders are used.

- threshold = 0.[real, min = 0, max = 1]
- The minimum chi-square probability used in "auto" mode. (See the description
of the
`scheme`parameter for more information).

- order= 3 [integer, min = 0, max = 6]
- The maximum degree of the fitting polynomial in the first dimension. If
this task is being used for one-dimensional fitting, set
`order2 = 0`.

- order= 3 [integer, min = 0, max = 6]
- The maximum degree of the fitting polynomial in the second dimension. If using
this task for one-dimensional fitting, set
`order2 = 0`.

- yname = "DOBJ" [string]
- Column name of the quantity to be fitted.

- yerrname = "DOBJ_ERR" [string]
- Column name of the standard deviation of the quantity to be fitted.

- x1name = "DET_TEMP" [string]
- Column name of the independent variable in the first dimension.

- x2name = "EPOCH" [string]
- Column name of the independent variable in the second dimension.

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

- base_time = 32000. [double]
- Reference epoch in Julian days since 1900.0.

- 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 directly from the input table to the
output table. The following attributes are allowed to be passed to
these parameters:
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 of temperature and time to the quantity
"DOBJ" of the
input table `xtwodpolyfit$input1` and write the results in the table
`ytwodpolyfit$output1`. The standard deviation of "DOBJ" is in the
column "DOBJ_ERR",
temperature is in "DET_TEMP", and time is in "EPOCH". The reference temperature
is 0 and the reference epoch is 0. Copy detector ID's and aperture names from
the input table to the output table.

hs> twodpolyfit intable="xtwodpolyfit$input1" outtable="ytwodpolyfit$output1" scheme="fixed" order1=3 order2=3 yname="DOBJ" yerrname="DOBJ_ERR" x1name="DET_TEMP" x2name="EPOCH" base_temp=0 base_time=0 nattrib=2 attrib1="DET_NUM" attrib2="APER_NAME"

## BUGS

## REFERENCES

## SEE ALSO