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 2006

URL: http://cxc.harvard.edu/ciao3.4/subtract.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 subtract Context: sherpa

Synopsis

Performs background subtraction.

Syntax

sherpa> SUBTRACT [<dataset range> | ALLSETS]

where <dataset range> = #, or more generally #:#,#:#,..., such that #
specifies a dataset number, and #:# represents an inclusive range of
datasets; one may specify multiple inclusive ranges by separating them
with commas. The default dataset is dataset 1.

Description

The SUBTRACT performs background subtraction on a channel-by-channel basis:

S'(i) = S(i) - ((beta_S * t_S) / (beta_B * t_B )) * B(i) ,

where S(i) is the source datum in bin i, B(i) is the background datum in bin i, t_S and t_B are the source and background exposure times respectively, and beta_S and beta_B are the source and background ``backscales" (i.e., the value of the BACKSCAL header keyword value in a PHA file) respectively. BACKSCAL is typically defined as the ratio of data extraction area to total detector area. This equation is easily generalized if there are multiple background datasets per source dataset.

The SUBTRACT command may only be used when:

  • the input source and background datasets are of the same size; or
  • the source dataset is grouped and the background dataset is ungrouped; Sherpa will automatically group the background dataset to match the source dataset before doing the subtraction.

Unless the user specifies errors for the background-subtracted data, the errors are computed automatically by propagating the errors for source and background data.

To undo background subtraction, use the command UNSUBTRACT.

Alternative means of subtracting and unsubtracting involve using the Sherpa/S-Lang module functions set_subtract and set_unsubtract.

Note that while XSPEC automatically performs background subtraction, in Sherpa one must directly issue the command SUBTRACT.

Example

Read in source and background data, then subtract.

sherpa> DATA example2.pha
...
Background data are being input from:
  <directory_path>/example2_bkg.pha
sherpa> PLOTY COUNTS
sherpa> WRITE DATA
Write X-Axis: Energy (keV)  Y-Axis: Flux (Counts)
...
     0.4286         13
     0.4573         15
     0.5002         25
     0.5575         21
...
sherpa> SUBTRACT
Write X-Axis: Energy (keV)  Y-Axis: Flux (Counts)
...
     0.4286     5.2974
     0.4573     6.9893
     0.5002    10.8273
     0.5575     6.2111
...
sherpa> UNSUBTRACT
Write X-Axis: Energy (keV)  Y-Axis: Flux (Counts)
...
     0.4286         13
     0.4573         15
     0.5002         25
     0.5575         21
...

Bugs

See the Sherpa bug pages online for an up-to-date listing of known bugs.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



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.