- Form: ROWFIT source [BOX=b] [FIT=cs,ce] [NCOEF=m] [LOAD=bp]
[UNLOAD=bp]
-
- [SUB] [DIV] [POLY] [FOUR] [CLIP=f] [FITONLY] [XBUF=buf]
- BOX=b
- Box within which the pixels will be substituted.
- FIT=cs,ce
- Column limits of up to 4 fitting regions.
- NCOEF=m
- Number of coefficients to fit, default 1.
- LOAD=bp
- Loads in buffer bp the coefficients, the errors,
and the standard deviation from the fit.
- UNLOAD=bp
- Uses the pre-loaded coefficients in buffer bp,
to evaluate the fit and operate on the image.
- CLIP=f
- Clips out pixels that deviate more than f sigmas from
the fit.
- SUB
- Subtract the fit from the image.
- DIV
- Divide the image by the fit.
- XBUF=buf
- Use as abscissae not the column number but the spectrum
in buffer 'buf'.
- WBUF=buf
- Uses the spectrum in buffer 'buf' to weight individual
pixels in the fit.
- POLY
- Fit polynomial of order NCOEF-1.
- FOUR
- Fit a Fourier series up to order (NCOEF-1)/2.
- FITONLY
- Does not substitute fit in image. If CLIP is specified,
only clipped pixels are replaced.
ROWFIT substitutes, subtracts, or divides, each row by a fit from a menu
of functions (all linear in the coefficients). By default, the image is
replaced by the fits, unless the SUB, DIV, or FITONLY keywords are
specified. Either a polynomial or a Fourier series can be used for the
fitting function, with the number of polynomials (or sins and cosines)
specified by the NCOEF=m keyword. The default is a polynomial of order 0
(i.e. a constant term).
The XBUF=buf keyword allows using any physical quantity (instead of the
default column number) as independent variable for the fit. In this case
the pixel values of the spectrum in buffer 'buf' will be use as the values
of the independent variable at each column. Useful application include the
fitting and subtraction of continuum or absorption spectra from emission
line objects, sky-level estimation and sky subtraction in long-slit
spectroscopy, or the fitting of many highly non-linear functions. The
WBUF=wbuf keyword allows the user to give individual pixel weights for the
fit, with the weights for the given pixel given by the value in buffer
'wbuf'.
The parameters of the fit can be saved for inspection or for later use with
the LOAD=buf keyword. The image loaded into buffer 'buf' will have, for
each row, the coefficients of the row fit and their estimated error as
well as the standard deviation from the fit in the following format:
Column 0 holds the standard deviations from the fits,
Column 1 holds the first coefficient of the fits (The constant term),
Column -1 holds the estimated error on the first coefficient,
Column 2 holds the second coefficient of the fits (The linear term),
Column -2 holds the estimated error on the second coefficient,
Column 3 holds the third coefficient of the fits (The quadratic term),
Column -3 holds the estimated error on the third coefficient,
and so on until column +/- the m coefficients fixed with the NCOEF=m
keyword.
The LOADed coefficients can be smoothed, averaged with other fits, or
manipulated in any fashion before used to operate in other images with the
UNLOAD=buf keyword. In this case ROWFIT evaluates (DOES NOT FIT) the
function defined by the coefficients in buffer 'buf' and operates
(substitutes, divides or subtracts the function) on the 'source'
buffer. These coefficients can also be used to remove distortions from an
image when used in command ALIGN.
Note that when evaluating a function with the UNLOAD= keyword the user has
to specify the kind of function (FOUR or POLY) and the abscissae buffer
(XBUF=) when appropriate.
Examples
- ROWFIT 1 NCEOF=2 LOAD=3 FIT=100,150 FIT=300,350 SUB
- Fits a
line to each row of the image on buffer 1 using only columns 100 to
150 and 300 to 350, subtracts the fits from the whole image and
saves the fit parameters in buffer 3.
- ROWFIT 5 UNLOAD=3 DIV
- Divides buffer 5 by the fit generated
in example 1).
- ROWFIT 10 XBUF=11 NCOEF=2 CLIP=5
- Fit buffer 10 with a
constant plus a scaled spectrum (buffer 11) but do not take into
account pixels that deviate more than 5 sigmas from the fit.
- ROWFIT 5 BOX=10 CLIP=5 NCOEF=5 FITONLY
- Fitting a 4th-order
polynomial to each row of buffer 5, substitute by the fit only those
pixels that deviate more than 5 sigmas, do so only in the defined by
box 10. (a way to identify and CLIP ion hits or bad columns).