Last modified: December 2013

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.12 Sherpa v1


Context: utilities


Sample the energy flux distribution


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


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

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

Function arguments

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_energy_flux() command.


Example 1

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

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

Example 2

sherpa> a = sample_energy_flux(0.5, 7.0)

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

Example 3

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

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


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

See Also

get_energy_flux_hist, get_photon_flux_hist, plot_energy_flux, plot_photon_flux
sample_flux, sample_photon_flux