POLY: Fit a Polynomial to a Spectrum

Form:POLY source ORD=n [SUB] [DIV] [LOAD] [NOZERO] [SILENT]
source
is the number of the spectrum to fit,
ORD=
is the order of the polynomial to fit (<7),
SUB
subtracts the polynomial from the data,
DIV
divides the polynomial by the data,
LOAD
loads the VISTA variables COEFF0, COEFF1, ..., COEFFn with the coefficients of the fit, and DCOEFF0, DCOEFF1,..., with their estimated error.
NOZERO
ignore pixels with value= 0 in the fit
SILENT
suppresses terminal output

POLY fits a polynomial to the spectrum in image buffer 'source'. The order of the polynomial is specified by the keyword 'ORD=n', where n=1 is a line, n=2 is a quadratic, and so forth. Here a ``spectrum'' is any 1-D image vector (an ``image'' with 1 row and NC columns).

As in the SPLINE command the keywords SUB and DIV can be used to tell the program to subtract or divide (respectively) the original spectrum by the fit. (Without both of these keywords the spectrum will be replaced by the fit.) As in the SURFACE command the keyword LOAD will load VISTA variables with the computed polynomial coefficients, so that they are accessible by other commands. The names of the variables loaded are COEFF0, COEFF1, ..., COEFFn, where 'n' is again the order of the fit. The formula using these coefficients is

   y = COEFF0 + COEFF1 * x + COEFF2 * x * x + ...
where y is the intensity and x is the pixel number.

Examples:

POLY 14 ORD=3
Fits a cubic polynomial to the spectrum in buffer 14. The spectrum is replaced by the polynomial fit.

POLY 3 ORD=2 SUB
Buffer 3 is fit with a parabola, which is then subtracted from the original data.

POLY 5 ORD=3 LOAD
Buffer 5 is fit with a third-order (cubic) polynomial which then replaces the original data in the buffer. The four VISTA variables COEFF0, COEFF1, COEFF2, and COEFF3 are loaded with the fit coefficients, and variables DCOEFF0, DCOEFF1, DCOEFF2, and DCOEFF3 with the fit coefficient errors.