subsky

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
framename  is a set of image files on which sky subtraction is done
mapfil
e
.map  is the map file which applies
badpixfile.badpix is a non-standard bad pixel map
-d set the diagnostic flag
OUTPUT
framename_s_cn.fits
PARAMETERS
minlambda
minimum wavelength for sky substraction
maxlambda
maximum wavelength for sky subtraction
siglimit
CR rejection threshold, in units of sigma(sky)
noise
typical ccd read noise
gain
typical ccd gain, in e-/adu
medbox
size of running median box for CR rejection (in pixels)
deltaknot
knot spacing, in pixels
splineorder
order of spline fit
2d_spline do 2 dimensional spline fit?
exclude
half-width of excluded strip near object spectrum
edge excluded region at ends of slit, in pixels
diag_0 lower limit of diagnostic interval
diag_1 upper limit of diagnostic interval


Details:

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 knotspacing = 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.

Back to programs