STScI Logo

flatfit noao.imred.iids/noao.imred.irs



flatfit -- Sum and normalize flat field spectra


flatfit root records


The root file name for the input names of the flat field spectra to be accumulated and fit for normalization.
The range of spectra indicating the elements of the string. The names of the spectra will be formed by appending the range elements to the input root name.
This is the root file name for the names of the spectra which will be created during normalization. The aperture number for the observation will be appended to the root in form "root.nnnn" where nnnn is the aperture number with leading 0's.
function = "chebyshev"
The accumulated spectra are fit by this function type - either chebyshev or legendre polynomials, or spline3 or spline1 interpolators.
order = 4
The order of the fit using the above function. This should generally be a low order fit to avoid introduction of high spatial frequency wiggles.
niter = 1
The number of iterations to reject discrepant pixels upon initial startup of the solution.
lower = 2.0
The number of sigmas for which data values less than this cutoff are rejected.
upper = 2.0
The number of sigmas for which data values greater than this cutoff are rejected.
ngrow = 0
The number of pixels on either side of a rejected pixel to also be rejected.
div_min = 1.0
During the normalization process, a division by zero will produce this value as a result.
interact = yes
If set to yes, graphical interaction with the normalization process is provided for at least the first aperture for which sums are available. If set to no, no interaction is provided.
all_interact = no
If set to yes, then interaction will be provided for all apertures for which sums have been accumulated. If set to no then the parameter interact will determine if the first aperture data is to be interactive.
coincor = )_.coincor
If set to yes, coincidence correction is applied to the data during the summation process, and the following three parameters are required. See coincor for more about this correction.
ccmode = )_.ccmode
The mode by which the coincidence correction is to be performed. This may be "iids" or "photo".
deadtime = )_.deadtime
The detector deadtime in seconds.
power = )_.power
Power law IIDS non-linear correction exponent.
cursor = ""
Graphics cursor input. When null the standard cursor is used otherwise the specified file is used.


The specified spectra are added by aperture number to produce summations which are then fit by a specified fitting function. The fitting function is then divided into the sum to produce a normalized (to 1.0) sum in which the low frequency spatial response has been removed.

The resultant normalized images may then be divided into all other data to remove the pixel-to-pixel variations without introducing any color terms. The spectra may be used directly if they happen to be object spectra in which the low frequency response is to be removed.

During the accumulation process the spectra may be corrected for coincidence losses if the detector is subject to the phenomenon.

After accumulating all input spectra, the pixels in each sum are fit according to the specified function. If the interactive switches are set, then graphical interaction is made available. If only the interact parameter is set to yes, then only the data from the first aperture will be available for interaction. Data from subsequent apertures will be fit using the same parameters and number of iterations as the first. If the all_interact parameter is also set, then data from each aperture will be presented for interaction.

At each step in the fit, pixels which are discrepant by more than "upper" sigmas above the fit, or "lower" sigmas below the fit, are rejected. The rejection process may be applied many times (iterations) to continue rejecting pixels. If the upper and lower sigmas are not equal, the resulting fit will be biased slightly above the mean (for lower < upper) or below the mean (upper < lower). This is useful when the spectrum being fit is that of a star having either absorption or emission lines.

A display is presented of the sum and the fit through the data. A status line is printed containing the fit type, the order of the fit, the rms residual from the fit, and the number of data points in the fit after one iteration of rejection.

The following cursor keystrokes are then active:

Clear the screen and display the active keystrokes
Indicate active keystrokes on the status line
Change plot mode to an error plot. This display is defined as the deviation from the fit divided by the data values [ (data - fit)/ data] at each pixel
Change plot mode back to the fit through the data display
Change the order of the fit.
Change the lower rejection criterion (in units of sigma).
Change the upper rejection criterion.
Change both rejection criteria to the same value.
Reinstate rejected pixels.
Iterate one more time.
Iterate several more times - the user is prompted for the count.
Quit and accept the solution
RETURN is the same as q but a confirmation request to exit must be answered as yes.

All keystrokes but ?,/,e,f, and q force another iteration which will reject additional pixels. To fully inhibit pixel rejection, the sigmas should be set to a large value (e.g. 100).


The following example will accumulate 8 spectra and fit the first aperture data interactively but not the second, and apply coincidence corrections to the sums. The upper and lower rejection criteria have been altered to bias the seventh order fit to a higher level.

cl> flatfit nite1 1-4,201-204 coin+ low=1.4 up=3 order=7


For some reason, the error plot is supposed to have a zero level line drawn, but none appears.

As in most of the IRAF software, the order of a fit refers to the number of terms in the fit, so that a fit of order 1 implies a constant and order 2 implies a linear fit.


coincor, flatdiv

Source Code · Search Form · STSDAS