STScI Logo

mkskyflat noao.imred.ccdred



mkskyflat -- Make sky corrected flat field images


mkskyflat input output


List of blank sky images to be used to create sky corrected flat field calibration images.
List of output sky corrected flat field calibration images (called sky flats). If none is specified or if the name is the same as the input image then the output image replaces the input image.
ccdtype = ""
CCD image type to select from the input images.
xboxmin = 5, xboxmax = 0.25, yboxmin = 5, yboxmax = 0.25
Minimum and maximum smoothing box size along the x and y axes. The minimum box size is used at the edges and grows to the maximum size in the middle of the image. This allows the smoothed image to better represent gradients at the edge of the image. If a size is less then 1 then it is interpreted as a fraction of the image size. If a size is greater than or equal to 1 then it is the box size in pixels. A size greater than the size of image selects a box equal to the size of the image.
clip = yes
Clean the input images of objects? If yes then a clipping algorithm is used to detect and exclude objects from the smoothing.
lowsigma = 2.5, highsigma = 2.5
Sigma clipping thresholds above and below the smoothed illumination.
ccdproc (pset)
CCD processing parameter set.


A sky corrected flat field calibration image, called a sky flat, is a flat field that when applied to observations of the sky have no large scale gradients. Flat field images are generally obtained by exposures to lamps either illuminating the telescope field or a surface in the dome at which the telescope is pointed. Because the detector is not illuminated in the same way as an observation of the sky there may be large scale illumination patterns introduced into the observations with such a flat field. To correct this type of flat field a blank sky observation (which has been divided by the original flat field) is heavily smoothed to remove the noise leaving only the residual large scale illumination pattern. This illumination pattern is divided into the original flat field to remove this residual.

The advantage of creating a sky flat field is that when processing the observations no additional operations are required. However, if the observations have already been processed with the original flat field then the residual illumination pattern of blank sky calibration images may be created as an illumination correction to be applied by ccdproc . Such a correction is created by the task mkskycor . If a good blank sky image is not available then it may be desirable to remove the illumination pattern of the flat field image using mkillumflat or mkillumcor provided the sky observations are truly uniformly illuminated. For more on flat fields and illumination corrections see flatfields .

The input, blank sky images are first processed, based on the ccdproc parameters, if needed. These parameters also determine the flat field image to be used in making the sky flat. The residual illumination pattern is determined by heavily smoothing the image using a moving "boxcar" average. The effects of objects in the input image may be minimized by using a sigma clipping algorithm to detect and exclude the objects from the average. The output image is ratio of the flat field image, for the same subset as the input image, to the residual illumination pattern determined from the processed blank sky input image. The illumination pattern is normalized by its mean to preserve the mean level of the flat field image.

The smoothing algorithm is a moving average over a two dimensional box. The algorithm is unconvential in that the box size is not fixed. The box size is increased from the specified minimum at the edges to the maximum in the middle of the image. This permits a better estimate of the background at the edges, while retaining the very large scale smoothing in the center of the image. Note that the sophisticated tools of the images package may be used for smoothing but this requires more of the user and, for the more sophisticated smoothing algorithms such as surface fitting, more processing time.

Blank sky images may not be completely blank so a sigma clipping algorithm may be used to detect and exclude objects from the illumination pattern. This is done by computing the rms of the image lines relative to the smoothed background and excluding points exceeding the specified threshold factors times the rms. This is done before each image line is added to the moving average, except for the first few lines where an iterative process is used.


1. Two examples in which a new image is created and in which the input sky images are converted to sky flats are:

    cl> mkskyflat sky004 Skyflat
    cl> mkskyflat sky* ""


ccdproc, flatfields, mkfringecor, mkillumcor, mkillumflat, mkskycor

Search Form · STSDAS