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/mcounts.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 mcounts Context: sherpa

Synopsis

Calculates the sum of convolved model amplitudes for source or background datasets.

Syntax

sherpa> [B]MCOUNTS [# [ID]] [{(<value>) | (<min>:<max>) | (<region
descriptor>)} ] \
[ {(<model component>) | (<model stack>)} ]

MCOUNTS is used for summing source model counts, while BMCOUNTS is used
for summing background model counts.

# specifies the dataset over which the source model is evaluated. The
ID modifier is used only for summing background counts, and then if and
only if the Sherpa state object variable multiback is set to 1, i.e.,
if more than one background dataset is to be associated with a single
source dataset. The ID modifier may be any unreserved string (e.g., A,
foo, etc.), i.e., a string that is not a parsable command.

The default is to do summations for all appropriate datasets (i.e.,
those for which source/background expressions have been defined). The
summation may be computed at one energy/wavelength, over a range of
energies/wavelengths, or within a 2-D region, with the default being to
compute the flux the total available range.

The summation may also be computed for individual model components, or
for previously defined model stacks, with the default being to compute
the summation using all model components in the SOURCE or BACKGROUND
expression.

Description

A source or background model stack must be defined before a respective flux can be computed; see the SOURCE and BACKGROUND commands. This is true even if one computes the flux of an individual model component or of models defined in a model stack. (This limitation will be removed in a future version of Sherpa.)

For 1-D data, if

  • one energy (or wavelength or bin number) <value> is given, then the model counts is returned for the bin associated with that value.
  • an energy or wavelength range is given with the <min> and <max> arguments, then the total summed model counts for the given range is returned.
  • no value or range is specified, then the total summed model counts for the full range of the dataset is returned.

For 2-D data, if a region descriptor is given, then the summation of model counts within that region is returned; otherwise, the summation is carried out over the entire input image.

Tip: To perform background subtraction in Sherpa, the command SUBTRACT must be issued; this is in contrast to XSPEC, which performs background subtraction automatically.

The summation of model counts may be done using the Sherpa/S-Lang module functions get_mcounts_sum and get_bmcounts_sum.

Example 1

Calculate the summation of model counts over the full energy range:

sherpa> MCOUNTS
Model counts for source dataset 1: 1014.89 counts

Example 2

Calculate the summation of background model counts over the range 2 to 10 keV. If the areas of the source and background extraction regions are different (as manifested by differences in, e.g., the BACKSCAL keywords in the headers of the source and background data files), then the number of expected background counts in the source region will also be shown.

sherpa> BMCOUNTS (2.0:10.0)
Model counts for background dataset 1: 456.003 counts
      ...scaled to source region: 140.496 counts

Example 3

Calculate the summation of model counts at a single energy (2.0 keV) for the power-law component of a source expression:

sherpa> SOURCE 1 = XSWABS[A] * POW[P]
sherpa> MCOUNTS 1 (2.0) P
Model counts for source dataset 1: 1.07005 counts

Example 4

Calculate the summation of model counts over the energy range 2.0 to 4.0 keV for a model stack:

sherpa> FOO = POW[P] + GAUSS[G]
sherpa> SOURCE 1 = XSWABS[A] * FOO
sherpa> MCOUNTS 1 (2:4) FOO
Model counts for source dataset 1: 83.346 counts

Example 5

Calculate the summation of model counts within circles of radius 5 and 10 in a 2-D image (note, the quotes are necessary):

sherpa> SOURCE = GAUSS2D[G]
sherpa> MCOUNTS 1 "CIRCLE(247,257,5)"
Flux for source dataset 1: 1614.79 counts
sherpa> MCOUNTS 1 "CIRCLE(247,257,10)"
Flux for source dataset 1: 3142.15 counts

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.