Fits a polynomial or bi-cubic spline surface to two-dimensional data array SURFIT
There is a selection of estimators by which representative values for each bin are determined. There are several options to make the fit more accurate. Values beyond upper and lower thresholds may be excluded from the binning. Bad pixels are also excluded, so prior masking may help to find the background more rapidly. -sigma clipping of the fitted bins is available so that the fit is not biased by anomalous bins, such as those entirely within an extended object. If a given bin contains more than a prescribed fraction of bad pixels, it is excluded from the fit.
The data array representing the background is evaluated at each pixel by one of two methods. It is written to the output NDF structure.
The raw binned data, the weights, the fitted binned data and the residuals to the fit may be written to a logfile. This also keeps a record of the input parameters and the rms error of the fit.
!
) value is supplied, the value used is such that
32 bins are created along each axis. [!]
[2,3]
"Mean"
for the mean value, "Ksigma"
for the mean with
-sigma
clipping; "Mode"
for the mode, and "Median"
for the median. "Mode"
is only available
when there are at least twelve pixels in a bin. If a null (!
) value is supplied,
"Median"
is used if there are fewer than 6 values in a bin, and "Mode"
is used
otherwise. [!]
"Interpolate"
where
the values at the corners of the bins are derived first, and then the pixel values are
found by linear interpolation within those bins; or "All"
where the surface-fit is
evaluated for every pixel. The latter is slower, but can produce more-accurate
results, unless the surface is well behaved. The default is the current value,
which is initially set to "Interpolate"
. []
!
) means no clipping of the binned array
will take place. Between 1 and 5 values may be supplied. The default is the
current value, which is !
initially. []
"Polynomial"
for a Chebyshev polynomial or "Spline"
for a bi-cubic spline. The default is the current value, which initially is
"Spline"
. []
TRUE
, a constant variance array is
created in the output NDF assigned to the mean square surface-fit error. [FALSE]
[!]
1
creates one interior knot, [5,4]
gives 5
along the x axis and 4 along the y direction. Increasing this parameter’s
values increases the flexibility of the surface. Normally, 4
is a reasonable
value. The upper limit of acceptable values will be reduced along each axis
when its binned array dimension is fewer than 29. KNOTS is only accessed when
FITTYPE="Spline"
. The default is the current value, which is 4
initially. []
0
gives a constant, [3,1]
gives a
cubic along the x direction and a linear fit along the y axis. Increasing this
parameter’s values increases the flexibility of the surface. The upper limit
of acceptable values will be reduced along each axis when its binned array
dimension is fewer than 29. ORDER is only accessed when FITTYPE="Polynomial"
. The
default is the current value, which is 4
initially. []
!
) there will be no upper
threshold. [!]
!
) there will be no lower threshold. [!]
[!]
[!]
For further details of the CHEBYSHEV variant see SGP/38. The CHEBYSHEV variant includes the fitting variance for each coefficient.
The BSPLINE variant structure is provisional. It contain the spline coefficients in the two-dimensional DATA_ARRAY component, the knots in XKNOTS and YKNOTS arrays, and a scaling factor to restore the original values in SCALE. All of these components have type _REAL.
Also stored in the SURFACEFIT extension is the r.m.s. deviation to the fit (component
RMS); and the co-ordinate system component COSYS, set to "GRID"
.
comaB_fit.lis
records a log of the surface
fit. This routine correctly processes the AXIS, DATA, QUALITY, LABEL, TITLE, UNITS, WCS, and HISTORY components of the input NDF. Any input VARIANCE is ignored.
Processing of bad pixels and automatic quality masking are supported.
All non-complex numeric data types can be handled. Arithmetic is performed using
single- or double-precision floating point for FITTYPE="Spline"
or "Polynomial"
respectively. The output NDF’s DATA and VARIANCE components have type _REAL
(single-precision).