Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: November 2016

URL: http://cxc.harvard.edu/sherpa/ahelp/subtract.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.9 Sherpa v1

subtract

Context: data

Synopsis

Perform background subtraction

Syntax

subtract(id)

Description

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").

Example 1

sherpa> subtract()

Subtract the background of the default dataset.

Example 2

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.

Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

data
get_bkg, set_bkg, unsubtract
info
list_bkg_ids, show_bkg_model, show_bkg_source
modeling
delete_bkg_model
plotting
plot_bkg

Last modified: November 2016
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.