|AHELP for CIAO 4.9 Sherpa v1||
Perform background subtraction
The subtract command performs a channel-by-channel background subtraction on the data. In Sherpa, the subtract command must be issued to perfom background subtraction; it is not done automatically as it is in XSPEC.
- id - the id of the dataset to subtract; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
Background subtraction can only be performed when data and background are of the same length. If the data and background are ungrouped, both must have same number of channels. If they are grouped, data and background can start with different numbers of channels, but must have the same number of groups after grouping.
The equation for the subtraction is:
src_counts - bg_counts * (src_exposure * src_backscal) ----------------------------- (bg_exposure * bg_backscal)
where src_exposure and bg_exposure are the source and background exposure times, and src_backscal and bg_backscal are the source and background backscales. The backscale, read from the BACKSCAL header keyword, is the ratio of data extraction area to total detector area.
The "subtracted" field of the source dataset is updated to indicate that the data are background-subtracted, as shown in the examples.
To undo background subtraction, use the unsubtract command ("ahelp unsubtract").
Subtract the background of the default dataset.
sherpa> subtract("src") sherpa> get_data("src").subtracted True
Subtract background counts for dataset "src". The "subtracted" field of the source data object is updated to show that the dataset has been background-subtracted.
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.