calc_source_sum
- sherpa.astro.utils.calc_source_sum(data, src, lo=None, hi=None)[source] [edit on github]
Sum up the source model over a pass band.
Sum up S(E) over a pass band, where S(E) is the spectral model evaluated for each bin.
- Parameters:
data – The data object to use.
src – The source expression. This must not include the instrumental responses.
lo (number, optional) – If both are None or both are set then sum up over the given band. If only one is set then use the model value in the selected bin. The units for
loandhiare given by the current analysis setting of thedataobject.hi (number, optional) – If both are None or both are set then sum up over the given band. If only one is set then use the model value in the selected bin. The units for
loandhiare given by the current analysis setting of thedataobject.
- Returns:
signal – The source model summed up over the given band or for a single bin.
- Return type:
number
See also
calc_data_sumSum up the observed counts over a pass band.
calc_model_sumSum up the fitted model over a pass band.
calc_energy_fluxIntegrate the source model over a pass band.
calc_photon_fluxIntegrate the source model over a pass band.
Notes
The units of
loandhiare determined by the analysis setting for the data set (e.g.data.get_analysis).Any existing filter on the data set - e.g. as created by
ignoreornotice- is ignored by this function.The units of the answer depend on the model components used in the source expression and the axis or axes of the data set. It is unlikely to give sensible results for 2D data sets.
Examples
Sum up the model over the data range 0.5 to 2:
>>> calc_source_sum(data, smodel, 0.5, 2) 139.12819041922018