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.
- 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_energy_flux() command.
sherpa> a = sample_energy_flux() sherpa> print (a)
Obtain and print one sample of the energy flux distribution from the default model, over the whole energy interval.
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.
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.