STScI Logo

subsky stsdas.analysis.timeseries



subsky -- Subtract background from time series observations.


subsky infile skyfile outfile inmask skymask outmask obsmode fittype order nptsfit


This task will subtract background (i.e., sky) observations from object-plus-sky observations. The background data may have been taken simultaneously with the object(+sky) data, the two sets may be interleaved, or there may be two background files---one taken before and one taken after the object(+sky) data.

Background subtraction may be done in one of the following ways:

(1) Point-by-point
(2) A linear fit to pairs of adjacent background observations
(3) A low-order curve fit to a user-specified number of background data values near the time of each object(+sky) observation (e.g., a quadratic fit to four background points)
(4) A low-order curve fit to all of the background data

The last option is the only one that may be used if there are two (or more) files of background data.

Data in the input files must be count rate or count rate per unit area. They can not be counts because this task does not compensate for possible different integration times between object and background files.


infile = "" [string]
Name of the input object(+sky) data file (templates are allowed for all file name parameters in this task).
skyfile = "" [string]
Name of the input sky data file.
outfile = "" [string]
Name of the output object data file.
inmask = "" [string]
Name of the input object(+sky) mask file (optional).
skymask = "" [string]
Input sky mask file name (optional).
outmask = "" [string]
Output object mask file name (required).
obsmode = "" [string, allowed values = simul | inter | forenaft]

Observation mode, "simul" specifies simultaneous target and sky observation, inter is interleaved target and sky observation, and fornaft specifies sky observations were performed before and after the target observation.

fittype = "" [string, allowed values = nearest | overall |
linear | leastsq]

Fitting method, "nearest" uses the sky data point nearest to the object(+sky) point as the background to be subtracted, "overall" fits a low order polynomial to all sky data points and then interpolates the background value from this fitting, "linear" does a linear fitting to pairs of adjacent sky data points and then interpolates the background to be subtracted, and "leastsq" fits a low order polynomial to a specified number (nptsfit) of sky data points and then interpolates the background value from this fitting.

order = [integer, min = 0]
Order of the fitting polynomial used by the overall and least squares fitting methods described in fittype.
nptsfit = [integer, min =1]
Number of points used to do the least square fitting---this parameter is used only if a least squares fitting method is used.


1. Do a sky subtraction to the image star.d0h with the file sky.d0h. The sky was simultaneously taken as staa. Use the "nearest" fitting method.

ti> subsky star.d0h sky.d0h out.d0h "" "" out.q0h "simul" "nearest" 0 1




Source Code · Package Help · Search Form · STSDAS