About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2008

URL: http://cxc.harvard.edu/sherpa4.1/subtract.sl.html
AHELP for Sherpa 4.1

subtract

Context: sl.sherpa

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;
1

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.

Last modified: December 2008



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