flat1d -- Make flat fields by fitting a 1D function to the image
flat1d input output
Flat fields are created containing only the small scale variations in the calibration images. The large scale variations in the images are modeled by fitting a function to each image line or column with deviant pixel rejection. The flat field values are obtained by taking the ratio of the image values to the function fit. However, if the fitted value is less than the parameter minflat the flat field value is set to unity.
The function fitting parameters may be set interactively when the interactive flag is set using the interactive curve fitting package icfit . The cursor mode commands for this package are described in a separate help entry under "icfit". For two dimensional images the user is prompted for the sample line or column or a blank-separated range to be averaged and graphed. Note that the lines or columns are relative the input image section; for example line 1 is the first line of the image section and not the first line of the image. Any number of lines or columns may be examined. When satisified with the fit parameters the user responds with a carriage return to the line or column prompt. The function is then fit to all the lines or columns and the flat field ratios are determined.
If the output image does not exist initially it is created with the same size as the input image without an image section and initialized to unit response. Subsequently the flat field data modifies the pixel values in the output image. Input image sections may be used to restrict the region in which the flat field response is determined leaving the rest of the output image unmodified. This ability is particularly useful when dealing with multi-aperture data.
This task is very similar to fit1d with the addition of the parameter minflat and the deletion of the the parameter type which is always "ratio".
1. Create a flat field from the calibration image "quartz" with the spectrum running along the lines. Exclude the first and last columns, use a spline fit of 25 pieces (a width of 32 pixels over 800 columns), and set grow to 4 pixels.
cl> flat1d quartz flat order=25 sample="2:799" grow=4 \ >>> interactive=no or cl> flat1d quartz[2:799,*] flat order=25 grow=4 inter-
The fitting parameters may be set interactively in which case the fitting parameters need not be specified. The command would be
cl> flat1d quartz flat quartz: Fit column = 1 10 quartz: Fit column =
The user selects sample columns to be fit interactively with the interactive curve fitting package. When satisified with the fit parameters respond with a carriage return to the prompt. The function is then fit to all the columns and the flat field ratios are determined.
2. As an example for multi-slit spectra the locations of the slits are determined and a file containing the image sections is created. Since there must be the same number of output images another file containing the output images is also created. For example the files might contain
File quartzs File flats _______________ __________ quartz[23:40,*] flat quartz[55:61,*] flat quartz[73:84,*] flat
A flat field for the slits is then obtained with the command
cl> flat1d @quartzs flats axis=2
The creation of multi-slit files and the need for an equal number of repeated output files is annoying. It will be worked on in the future.