calc_energy_flux

sherpa.astro.ui.calc_energy_flux(lo=None, hi=None, id=None, bkg_id=None)

Integrate the source model over a pass band.

Calculate the integral of E * S(E) over a pass band, where E is the energy of the bin and S(E) the spectral model evaluated for that bin (that is, the model without any instrumental responses applied to it).

Parameters:
  • lo (number, optional) – The minimum limit of the band. Use None, the default, to use the low value of the data set.
  • hi (number, optional) – The maximum limit of the band, which must be larger than lo. Use None, the default, to use the upper value of the data set.
  • id (int or str, optional) – Use the source expression associated with this data set. If not given then the default identifier is used, as returned by get_default_id.
  • bkg_id (int or str, optional) – If set, use the model associated with the given background component rather than the source model.
Returns:

The flux from the source model integrated over the given band. This represents the flux from the model without any instrument response (i.e. the intrinsic flux of the source). For X-Spec style models the units will be erg/cm^2/s. If hi is None but lo is set then the flux density is returned at that point: erg/cm^2/s/keV or erg/cm^2/s/Angstrom depending on the analysis setting.

Return type:

number

See also

calc_data_sum()
Sum up the data values over a pass band.
calc_model_sum()
Sum up the fitted model over a pass band.
calc_source_sum()
Sum up the source model over a pass band.
calc_photon_flux()
Integrate the source model over a pass band.
set_analysis()
Set the units used when fitting and displaying spectral data
set_model()
Set the source model expression for a data set.

Notes

The units of lo and hi are determined by the analysis setting for the data set (e.g. get_analysis).

Any existing filter on the data set - e.g. as created by ignore or notice - is ignored by this function.

The flux is calculated from the given source model, so if it includes an absorbing component then the result will represent the absorbed flux. The absorbing component can be removed, or set to absorb no photons, to get the un-absorbed flux.

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

Calculate the energy flux over the ranges 0.5 to 2 and 0.5 to 7 keV:

>>> set_analysis('energy')
>>> calc_energy_flux(0.5, 2)
5.7224906878061796e-10
>>> calc_energy_flux(0.5, 7)
1.3758131915063825e-09

Calculate the energy flux density at 0.5 keV for the source “core”:

>>> calc_energy_flux(0.5, id="core")
5.2573786652855304e-10