Personal tools
You are here: Home / COSMOS / Sflats


Back to Programs


Sflats constructs a spectroscopic flat field image for use with biasflat. Sflats does the following:

  • Combine one or more flat field frames
  • Remove bias
  • Normalize each flat field spectrum to unity

USAGESflats -m mapfile -f flatfile[s] [-b biasfile] [-o outputfile] [-z badpixfile]
mapfile is the name of the mapfile which describes the data
flatfile[s] is the name[s] of a spectroscopic flatfield set
biasfile is the name of a bias file set
outputfile is the name of the output file if more than two input files
badpixfile is the name of a non-standard bad pixel file
OUTPUT flatfile_flat_cn.fits or outputfile_cn.fits are the processed flats
minlambdaminimum wavelength
maxlambdamaximum wavelength
telscaletelescope scale arcsec/mm
bias_filebias frame to use (or blank or "none")
shuffleddistance, in pixels, to shuffle the spectra
borderwidth of border around spectrum
siglimitsigma clipping limit for CR removal
noiseCCD read noise
gainCCD gain
fit_modecontinuum fitting method (median or poly)
orderorder of fit if polynomial fitting
med_boxwidth of sliding box if median fitting


Sflats first removes the bias level from each input file, using a bias frame if provided, or otherwise using the overscan areas. Multiple frames are summed. The spectral response of the flat field continuum lamp is fit in each spectrum, either by polynomial fitting or by a running median, and the fit is used to normalize each spectrum to unity. If a bad pixel file is specified, it is used to mask out regions before the spectral response is fit. Otherwise, the standard, dewar-specific bad pixel file is used.

The choice of continuum fitting method to use depends on the data. For long camera grating spectra, the polynomial fitting method works well. However, for short camera grism spectra, where the spectra are often contaminated by the zero order images, the median fit is much more reliable, if a bad pixel mask for the zero order image is not specified.

If minlambda and maxlambda are both set to 0, Sflats uses the values from the map file.

The output is a file or files called filename_flat. If there is only one input flat file, its name is used for filename. If there are two input file, filename is constructed from the two input file names. If there are more than two input files, filename must be specified.

If the observations were taken in nod&shuffle; mode and the spectral flats were not themselves shuffled during the exposure, a shuffled flat frame can be produced by setting shuffled to the shuffle distance, in pixels. If however, the spectral flats are already shuffled, the shuffled parameter must be set to zero.

Back to Programs