    Integrate the unconvolved source model over a pass band.

calc_photon_flux(lo=None, hi=None, id=None, bkg_id=None, model=None)
lo - number, optional
hi - number, optional
id - int or str, optional
bkg_id - int or str, optional
model - model, optional

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

Calculate the integral of the unconvolved model over the full range of the default data set:

>>> calc_photon_flux()

Return the flux for the data set labelled "core":

>>> calc_photon_flux(id='core')

Calculate the photon flux over the ranges 0.5 to 2 and 0.5 to 7 keV, and compared to the energy fluxes for the same bands:

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

Calculate the photon flux density at 0.5 keV for the source "core":

>>> calc_photon_flux(0.5, id="core") 0.64978176

Calculate the flux for the model applied to the second background component of the 'jet' data set, for the wavelength range 20 to 22 Angstroms:

>>> set_analysis('jet', 'wave') >>> calc_photon_flux(20, 22, id='jet', bkg_id=2)

For the following example, the source model is an absorbed powerlaw - `xsphabs.gal * powerlaw.pl` - so that the `fabs`

value represents the absorbed flux, and `funabs` the unabsorbed flux (i.e. just the power-law component):

>>> fabs = calc_photon_flux(0.5, 7) >>> funabs = calc_photon_flux(0.5, 7, model=pl)

PARAMETERS

The parameters for this function are:

Parameter
Definition
lo
If both are None or both are set then calculate the flux over the given band. If only one is set then calculate the flux density at that point. The units for `lo` and `hi`

are given by the current analysis setting.
hi
If both are None or both are set then calculate the flux over the given band. If only one is set then calculate the flux density at that point. The units for `lo` and `hi`

are given by the current analysis setting.
id
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
If set, use the model associated with the given background component rather than the source model.
model
The model to integrate. If left as `None` then the source model for the dataset will be used. This can be used to calculate the unabsorbed flux, as shown in the examples.

The return value from this function is:

flux -- The flux or flux density. For X-Spec style models the flux units will be photon/cm^2/s and the flux density units will be either photon/cm^2/s/keV or photon/cm^2/s/Angstrom, depending on the analysis setting.

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 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.

Changes in CIAO

The model parameter was added.

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

December 2023