subsky uses the Kelson (PASP 115,688) procedure to do an optimally sampled sky subtraction. The program relies on a good CCD-science coordinate system mapping to construct a cosmic ray-cleaned median sky spectrum for each slit, which is then subtracted from the slit image. Output is a new set of CCD images with sky subtracted (unless the data is nod&shuffle), and with errors attached.
USAGE | subsky -f framename -m mapfile [-z badpixfile] [-d]
| ||||||||||||||||||||||||||||
INPUT |
| ||||||||||||||||||||||||||||
OUTPUT | framename_s_cn.fits
| ||||||||||||||||||||||||||||
PARAMETERS |
|
subsky uses 1-d or 2-d B-Splines to fit the sky spectrum of flux vs wavelength.
If 2-d spline fits are selected, the fit along the slit is first order, with a
knot at each end of the fitted region. When the object spectra are strong, sky
fits can be improved by excluding a strip around the object spectrum in the
analysis. Excluding a small region near the ends of the slit, via the parameter
edge
, can also improve the fit. If a bad pixel file is specified, it is used to
determine regions to be masked before the spline fit is calculated. If none is
specified, the standard dewar-specific file is used.
Depending on the characteristics of the data, the spline parameters may need
some tuning to optimally fit sky. An non-optimal knot spacing or fit order can
produce ringing in the fit, or a poor fit to strong night sky lines. Values
near deltaknot
= 1.0 pixel, and splineorder
= 3 often work best (spline order
must be 3 or 5). If the diagnostic flag is set, no output files are written,
but subsky plots the region between wavelengths diag_0
and diag_1
, showing data
points and spline fit, to allow tuning of the parameters. Some more details on
adjusting parameters can be found in the COSMOS Cookbook.
If minlambda
and maxlambda
are both set to 0, subsky uses the values from the
map file.
The output data is a 3-d fits file. The first plane of the file is the sky subtracted image, the second plane contains the 1-sigma pixel-by-pixel error estimates. Bad pixels have errors set to a negative number.
Nod&shuffle data: In the case of nod&shuffle data, no sky subtraction is done. However, subsky must still be used as part of the normal reduction pipeline in order to obtain error values for the data, which are used in the cosmic ray rejection step in sumspec.