Welcome to iraf.net Saturday, March 25 2017 @ 05:55 AM GMT

## FITCOORDS Database

The FITCOORDS fits are stored in text files in the subdirectory given by
the "`database`" parameter. The name of the file is fc<fitname> where
<fitname> is the specified fit name. The database text file contains
blocks of lines beginning with a time stamp followed by line with the
"`begin`" keyword. The value following "`begin`" is the fit name, which is
often the name of the image used for the fit. If there is more than one
block with the same fit name then the last one is used.

The "`task`" keyword will has the value "`fitcoords`" and the "`axis`" keyword
identifies the axis to which the surface fit applies. An axis of 1 refers
to the first or x axis (the first dimension of the image) and 2 refers to
the second or y axis.

The "`surface`" keyword specifies the number of coefficients for the surface
fit given in the following lines . The surface fit is produced by an IRAF
math package called "`gsurfit`". The coefficients recorded in the database
are intented to be internal to that package. However the following
describes how to interpret the coefficients.

The first 8 lines specify:

function - Function type (1=chebyshev, 2=legendre) xorder - X "order" (highest power of x) yorder - Y "order" (highest power of y) xterms - Cross-term type (always 1 for FITCOORDS) xmin - Minimum x over which the fit is defined xmax - Maximum x over which the fit is defined ymin - Minimum y over which the fit is defined ymax - Maximum y over which the fit is defined

The polynomial coefficients follow in array order with the x index varying fastest:

C00 C10 C20 ... C<xorder-1>0 C01 C11 C21 ... C<xorder-1>1 ... C<xorder-1><yorder-1>

The surface fitting functions have the form

fit(x,y) = Cmn * Pmn

where the Cmn are the coefficients of the polynomials terms Pmn, and the Pmn are defined as follows:

Chebyshev: Pmn = Pm(xnorm) * Pn(ynorm)xnorm = (2 * x - (xmax + xmin)) / (xmax - xmin) ynorm = (2 * y - (ymax + ymin)) / (ymax - ymin)

P0(xnorm) = 1.0 P1(xnorm) = xnorm Pm+1(xnorm) = 2.0 * xnorm * Pm(xnorm) - Pm-1(xnorm)

P0(ynorm) = 1.0 P1(ynorm) = ynorm Pn+1(ynorm) = 2.0 * ynorm * Pn(ynorm) - Pn-1(ynorm)

Legendre: Pmn = Pm(xnorm) * Pn(ynorm)

xnorm = (2 * x - (xmax + xmin)) / (xmax - xmin) ynorm = (2 * y - (ymax + ymin)) / (ymax - ymin)

P0(xnorm) = 1.0 P1(xnorm) = xnorm Pm+1(xnorm) = ((2m+1)*xnorm*Pm(xnorm)-m*Pm-1(xnorm))/(m+1)

P0(ynorm) = 1.0 P1(ynorm) = ynorm Pn+1(ynorm) = ((2n+1)*ynorm*Pn(ynorm)-n*Pn-1(ynorm))/(n+1)

Notice that the x and y values are first normalized to the interval -1 to 1 over the range of the surface as given by the xmin, xmax, ymin, and ymax elements of the database description.