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

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


AHELP for CIAO 4.9 Sherpa v1

calc_data_sum

Context: utilities

Synopsis

Calculate the sum of observed data counts

Syntax

calc_data_sum( [lo,hi,id,bkg_id] )

Description

The calc_data_sum function calculates the sum of observed data counts in all or a portion of a source or background data set by data ID or background ID. A subset of the data can be specified by entering the low and high ends of the desired data interval in units of keV for energy data or angstroms for wavelength data. Calc_data_sum accepts binned, unbinned, background-subtracted and unsubtracted data.

  • lo - low limit; default=None
  • hi - high limit; default=None
  • id - data ID; if not given, uses the default sherpa id (id=1 by default, see "ahelp get_default_id")
  • bkg_id - background data ID

The command ignores any range filters that have been applied to the dataset. If calc_data_sum is called with no arguments, the observed counts will be summed over the entire data range of the default data set.

The counts in any background data set can be summed by supplying the background ID as the argument. It is possible to supply background-subtracted source data to calc_data_sum; the raw counts sum can be found by calling "unsubtract()" before "calc_data_sum()".

For 1-D data, if

o) a single energy, wavelength, or bin number is given (as opposed to a [lo, hi] interval), then the sum of data counts in the bin associated with that value is returned.

o) an energy or wavelength range is given with the 'lo' and 'hi' arguments, then the total summed data counts for the given range is returned.

o) no value or range is specified, then the total summed data counts for the full range of the data set is returned.

For 2-D data, the summation is carried out over the entire input image.

Example 1

sherpa> calc_data_sum()

When supplied with no arguments, calc_data_sum will sum the observed data counts over the entire data range of the default data set.

Example 2

sherpa> calc_data_sum(id=3)

Here, data set "3" is specified, so the total summed counts of the entire data range of data set 3 will be returned.

Example 3

sherpa> calc_data_sum(10.0, id=4)

The total observed counts in the bin(s) corresponding to 10.0 keV in data set 4 are summed.

Example 4

sherpa> calc_data_sum(bkg_id=1)

When supplied with a background ID, the total observed background counts in the entire data range of the specified background data set will be summed. In this example, the first background data set automatically located by Sherpa is used.

Example 5

sherpa> calc_data_sum(lo=0.1, hi=7.0, "bkg")

The total observed background counts between 0.1 and 7.0 keV are summed for the background data set with user-assigned ID "bkg". (Note that a user-defined string ID cannot be supplied to the "bkg_id" argument)

Example 6

sherpa> calc_data_sum(id=2,bkg_id=1)

The total number of counts in background component number 1 of data id 2.

Example 7

sherpa> calc_data_sum(1.0, 15.0,id=1, bkg_id=2)

The total observed background counts between 1 and 15 angstroms are summed in the second background data set automatically loaded by Sherpa with source data set 1.

Bugs

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

See Also

data
copy_data, dataspace1d, dataspace2d, datastack, delete_data, fake, get_axes, get_bkg_plot, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_quality, get_specresp, get_staterror, get_syserror, group, load_ascii, load_data, load_grouping, load_quality, set_data, set_quality, ungroup, unpack_ascii, unpack_data
filtering
get_filter, load_filter, set_filter
info
get_default_id, list_data_ids, list_response_ids
modeling
clean
plotting
plot_data, set_xlinear, set_xlog, set_ylinear, set_ylog
saving
save_error, save_filter, save_grouping, save_quality, save_staterror, save_syserror
utilities
calc_data_sum2d, calc_ftest, calc_kcorr, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_rate
visualization
contour, contour_data, contour_ratio, get_ratio, get_resid, histogram1d, histogram2d, image_data, rebin

Last modified: December 2013
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.