Chandra X-Ray Observatory
Skip to the navigation links
Last modified: June 2014

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.10 Sherpa v1


Context: utilities


Calculate the unconvolved model photon flux


calc_photon_flux( [lo,hi,id,bkg_id] )


The calc_photon_flux function calculates the unconvolved source or background model photon flux for all or a portion of a source or background data set by data ID or background ID. A subset of the model can be specified by entering the low and high ends of the desired data interval in units of keV for energy data or Angstroms for wavelength data. To calculate the energy flux for an unconvolved source or background model, the function calc_energy_flux can be used by data ID or background ID.

  • lo - low limit; default=None
  • hi - high limit; default=None
  • id - data ID; if not given, uses the default sherpa id (id=1 by default, see "ahelp get_default_id")
  • bkg_id - background data ID

The command ignores any range filters that have been applied to the dataset. If calc_photon_flux is called with no arguments, the unconvolved model photon flux will be calculated over the entire data range of the default data set.

The photon flux of an unconvolved background model can be integrated by supplying the corresponding Sherpa-assigned background ID as the argument (e.g. "1" or "2" for the first or second background data set automatically located by Sherpa in the corresponding source data set).

For 1-D data, if:

o) one energy (or wavelength) is given (as opposed to a [lo, hi] interval), then the photon flux of the unconvolved model at that energy (or wavelength) is returned in units of photons/cm^2/sec/keV (or photons/cm^2/sec/A).

o) an energy or wavelength range is given with the 'lo' and 'hi' arguments, then the total integrated photon flux over the given range is returned in units of photons/cm^2/sec.

o) no value or range is specified, then the total integrated photon flux over the full range of the dataset is returned in units of photons/cm^2/sec.

For 1-D data, if an instrument model is not used, the units are assumed to be counts, or counts per bin-width. See the Note on Units below.

For 2-D data the total integrated photon flux is carried out over the entire input image.

Note on Units: In its current incarnation, Sherpa has no explicit knowledge of data or model units. The units displayed with computed fluxes are defaults, generally correct for standard analyses of 1-D PHA energy/wavelength spectra (XSPEC-like analyses). They may be incorrect for non-standard analyses, or for analyses of 2-D spatial images with exposure maps, etc. The correct units can be determined by working backwards from the data, taking into account the exposure time, the units of the instrument model, the bin units, etc.


Example 1

sherpa> calc_photon_flux()

When supplied with no arguments, calc_photon_flux will integrate the unconvolved model photon flux over the entire data range of the default data set.

Example 2

sherpa> calc_photon_flux(bkg_id=1)

When supplied with a background ID, the photon flux of the unconvolved background model associated with the specified background data set will be integrated over the entire data range. In this example, the first background data set automatically located by Sherpa is used.

Example 3

sherpa> calc_photon_flux(lo=0.1, hi=7.0, id="bkg")

The unconvolved background model photon flux between 0.1 and 7.0 keV is integrated for the background data set with user-assigned ID "bkg". (Note that a user-defined string ID cannot be supplied to the "bkg_id" argument.)

Example 4

sherpa> calc_photon_flux(1., 15., 1, 2)

The unconvolved background model photon flux between 1 and 15 Angstroms is integrated for the second background data set automatically loaded by Sherpa with source data set 1.


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

See Also

list_model_ids, show_bkg_model, show_bkg_source
add_model, add_user_pars, clean, create_model_component, delete_bkg_model, delete_model, delete_model_component, get_model, get_model_autoassign_func, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_order_plot, get_par, get_pileup_model, get_source, get_source_component_image, get_source_component_plot, image_model, image_model_component, image_source, image_source_component, integrate, integrate1d, link, load_table_model, load_template_model, load_user_model, normal_sample, reset, save_model, save_source, set_bkg_model, set_full_model, set_model_autoassign_func, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset, t_sample, uniform_sample
get_lrt_plot, get_lrt_results, get_pvalue_plot, get_pvalue_results, plot_cdf, plot_model, plot_model_component, plot_pdf, plot_pvalue, plot_scatter, plot_source, plot_source_component, plot_trace
delete_psf, load_conv
save_delchi, save_resid
aprates, modelflux
calc_chisqr, calc_energy_flux, calc_model_sum, calc_source_sum, calc_stat, eqwidth, gamma, igam, igamc, incbet, lgam
contour_model, contour_ratio, contour_resid, get_ratio, get_resid

Last modified: June 2014
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.