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 lo and hi are given by the current analysis setting of the data object.

  • 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 lo and hi are given by the current analysis setting of the data object.

Returns:

signal – The source model summed up over the given band or for a single bin.

Return type:

number

See also

calc_data_sum

Sum up the observed counts over a pass band.

calc_model_sum

Sum up the fitted model over a pass band.

calc_energy_flux

Integrate the source model over a pass band.

calc_photon_flux

Integrate the source model over a pass band.

Notes

The units of lo and hi are 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 ignore or notice - 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