- sherpa.astro.ui.calc_data_sum(lo=None, hi=None, id=None, bkg_id=None)¶
Sum up the data values over a pass band.
This function is for one-dimensional data sets: use
calc_data_sum2dfor two-dimensional data sets.
lo (number, optional) – If both are None or both are set then sum up the data over the given band. If only one is set then return the data count in the given bin.
hi (number, optional) – If both are None or both are set then sum up the data over the given band. If only one is set then return the data count in the given bin.
dsum – If a background estimate has been subtracted from the data set then the calculation will use the background-subtracted values.
- Return type
Sum up the data values of a 2D data set.
Sum up the fitted model over a pass band.
Integrate the unconvolved source model over a pass band.
Integrate the unconcolved source model over a pass band.
Sum up the source model over a pass band.
Set the source model expression for a data set.
The units of
hiare determined by the analysis setting for the data set (e.g.
get_analysis). The summation occurs over those points in the data set that lie within this range, not the range itself.
If a grouping scheme has been applied to the data set that it will be used. This can change the results, since the first and last bins of the selected range may extend outside the requested range.
Sum up the data values (the dependent axis) for all points or bins in the default data set:
>>> dsum = calc_data_sum()
Calculate the number of counts over the ranges 0.5 to 2 and 0.5 to 7 keV for the default data set, first using the observed signal and then, for the 0.5 to 2 keV band - the background-subtraced estimate:
>>> set_analysis('energy') >>> calc_data_sum(0.5, 2) 745.0 >>> calc_data_sum(0.5, 7) 60.0 >>> subtract() >>> calc_data_sum(0.5, 2) 730.9179738207356
Calculate the data value in the bin containing 0.5 keV for the source “core”:
>>> calc_data_sum(0.5, id="core") 0.0
Calculate the sum of the second background component for data set 3 over the independent axis range 12 to 45:
>>> calc_data_sum(12, 45, id=3, bkg_id=2)