| AHELP for CIAO 4.5 Sherpa v1 | get_photon_flux_hist |
Context: plotting |
Synopsis
Calculate a histogram of a simulated photon flux probability distribution
Syntax
get_photon_flux_hist( [lo=None], [hi=None, id=1, n=7500, bins=75, correlated=False, numcores=None] )
Description
The get_photon_flux_hist() function calculates a histogram of simulated photon flux values representing the photon flux probability distribution for a model component, accounting for the errors on the model parameters. The photon flux probability distribution is visualized with the plot_photon_flux() function. The energy bounds of the flux distribution are set with the 'lo' and 'hi' parameters (in keV), and the number of times to sample the flux distribution in the simulation is controlled by the 'n' parameter. The get_photon_flux_hist() function produces a data object that contains all the information about the simulated sample of parameters, and a histogram, normalized to unity, representing the flux probability distribution. By default, get_photon_flux_hist() creates a histogram with 75 bins; however, the optional parameter, 'bins', may be included to change the binning.
The sample_energy_flux() command can be used to return an array of flux values drawn from this distribution.
Function arguments
- lo - lower energy bound; the default value of None means that the lower limit if the instrument model (ARF and RMF) should be used.
- hi - upper energy 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")
- n - number of samples used in the distribution (the default value is 7500)
- bins - number of bins used to bin the distribution into a histogram (bins=75 by default)
- 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.
- numcores - number of cores to use in parallelization; default is to use all cores available ('None')
Example 1
sherpa> print get_photon_flux_hist(0.3,7)
Return the data arrays and plotting preferences which define a histogram of simulated photon flux values calculated by the get_photon_flux_hist() command for default data set 1, in the 0.3-7 keV energy range. All available system cores are utilized during the execution of this command.
sherpa> print get_photon_flux_hist(0.3,7)
modelvals = [[ 5.1947e-02 1.9621e+00 1.5995e-04]
[ 5.6462e-02 1.8876e+00 1.5461e-04]
[ 2.4948e-02 2.0284e+00 1.4116e-04]
...,
[ 2.8512e-02 1.8597e+00 1.4721e-04]
[ 3.6222e-02 1.8335e+00 1.4680e-04]
[ 3.8682e-02 2.0031e+00 1.3540e-04]]
flux = [ 0.0003 0.0003 0.0004 ..., 0.0004 0.0003 0.0003]
xlo = [ 0.0002 0.0002 0.0002 ..., 0.0005 0.0005 0.0005]
xhi = [ 0.0002 0.0002 0.0002 ..., 0.0005 0.0005 0.0005]
y = [ 0.0061 0.0061 0.0061 ..., 0.003 0. 0.0061]
xlabel = Photon flux (Photons cm^{-2} sec^{-1})
ylabel = Frequency
title = Photon flux distribution
histo_prefs = {'linethickness': 2, 'symbolcolor': None, 'symbolfill': None, 'xlog': False, 'ylog': False, 'symbolangle': None, 'errthickness': None, 'fillcolor': None, 'linecolor': 'red', 'errstyle': None, 'linestyle': 1, 'symbolstyle': 0, 'errcolor': None, 'fillstyle': None, 'fillopacity': None, 'yerrorbars': False, 'symbolsize': None}
Example 2
sherpa> get_photon_flux_hist(0.5,7.,n=10000,bins=80) sherpa> plot_energy_flux()
Visualize a simulated photon flux probability distribution with a histogram created by the get_photon_flux_hist() function, where the energy range used is 0.5-7.0 keV, the parameteres are sampled ten thousand times in the simulation, and the histogram contains 80 bins.
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- contrib
- get_data_prof, get_data_prof_prefs, get_delchi_prof, get_delchi_prof_prefs, get_fit_prof, get_model_prof, get_model_prof_prefs, get_resid_prof, get_resid_prof_prefs, get_source_prof, get_source_prof_prefs, plot_chart_spectrum, prof_data, prof_delchi, prof_fit, prof_fit_delchi, prof_fit_resid, prof_model, prof_resid, prof_source
- data
- get_arf_plot, get_bkg_plot
- modeling
- normal_sample, t_sample, uniform_sample
- plotting
- get_energy_flux_hist, get_lrt_plot, get_lrt_results, get_pvalue_plot, get_pvalue_results, get_split_plot, plot, plot_arf, plot_bkg, plot_cdf, plot_chisqr, plot_data, plot_delchi, plot_energy_flux, plot_fit, plot_lrt, plot_model, plot_model_component, plot_order, plot_pdf, plot_photon_flux, plot_pvalue, plot_ratio, plot_resid, plot_scatter, plot_source, plot_source_component, plot_trace, set_xlinear, set_xlog, set_ylinear, set_ylog
- psfs
- plot_kernel
- statistics
- get_chisqr_plot, get_delchi_plot
- utilities
- sample_energy_flux, sample_flux, sample_photon_flux
- visualization
- contour_resid

![[Sherpa Logo]](../imgs/sherpa_logo_navbar.gif)