Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: December 2013

URL: http://cxc.harvard.edu/sherpa/ahelp/sample_photon_flux.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.6 Sherpa v1

sample_photon_flux

Context: utilities

Synopsis

Sample the photon flux distribution

Syntax

sample_photon_flux( [lo, hi], [id=1, num=1, correlated=False] )

Description

The sample_photon_flux command returns one or more samples of the photon flux distribution, which is the flux distribution for the model component accounting for the errors on the model parameters.

The plot_photon_flux() command can be used to plot up this distribution.

Function arguments

  • lo - lower photon bound; the default value of None means that the lower limit if the instrument model (ARF and RMF) should be used.
  • hi - upper photon bound; the default value of None means that the upper limit if the instrument model (ARF and RMF) should be used.
  • id - the id of the dataset to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
  • num - number of samples used in the distribution (the default value is 1)
  • correlated - whether to use a multi- or uni-variate distribution to sample the parameter values. The default value of False means use a uni-variate distribution, whilst True means use a multi-variate distribution.

The return value

The return value is a two-dimensional array. The number of rows in the array matches the number of samples used (so the value of the num argument). The first column is the flux value; the remaining columns give the parameter values used to calculate the flux value (the order is that of the parnames field of the get_fit_results() output).

The units for the flux values are the same as that returned by the calc_photon_flux() command.

Example 1

sherpa> a = sample_photon_flux()
sherpa> print (a[0][0])

Obtain and print one sample of the photon flux distribution from the default model, over the whole energy interval.

Example 2

sherpa> a = sample_photon_flux(0.5, 7.0)

Obtain one sample of the photon flux distribution from the default model, between 0.5 and 7.0 keV.

Example 3

sherpa> a = sample_photon_flux(id="src", num=100)
sherpa> f = a[:,0]

Obtain 100 samples of the photon flux distribution from the "src" model. The flux values are extracted as the one-dimensional array f.

Bugs

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

See Also

plotting
get_energy_flux_hist, get_photon_flux_hist, plot_energy_flux, plot_photon_flux
utilities
sample_energy_flux, sample_flux

Last modified: December 2013
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:   cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2014. All rights reserved.