Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2010

AHELP for CIAO 4.3 Sherpa v1


Context: plotting


Calculate a histogram of a simulated energy flux probability distribution


get_energy_flux_hist( [lo=None], [hi=None, id=1, n=7500, bins=75,
correlated=False, numcores=None] )


The get_energy_flux_hist() function calculates a histogram of simulated energy flux values representing the energy flux probability distribution for a model component, accounting for the errors on the model parameters. The energy flux probability distribution is visualized with the plot_energy_flux() function. The energy range of the flux distribution is 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_energy_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_energy_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_energy_flux_hist(0.5,2,id=2,numcores=2)

Return the data arrays and plotting preferences which define a histogram of simulated energy flux values calculated by the get_energy_flux_hist() command for data set 2, in the 0.5-2 keV energy range. The 'numcores' parameter is used to specify that 2 cores should be utilized for the execution of this command.

sherpa> print get_energy_flux_hist(0.5,2,id=2)
modelvals = [[  3.6131e-02   1.8420e+00   1.4908e-04]
 [  5.9302e-02   1.9822e+00   1.4376e-04]
 [  4.1418e-02   1.9517e+00   1.5046e-04]
 [  3.8999e-02   2.0593e+00   1.3365e-04]
 [  4.1892e-02   1.9324e+00   1.3868e-04]
 [  2.7829e-02   1.9231e+00   1.4013e-04]]
flux = [  2.9771e-13   2.6558e-13   2.9387e-13 ...,   2.6185e-13   2.7075e-13
xlo    = [  2.1817e-13   2.2019e-13   2.2220e-13 ...,   3.6528e-13   3.6730e-13
xhi    = [  2.2019e-13   2.2220e-13   2.2422e-13 ...,   3.6730e-13   3.6931e-13
y      = [ 0.0028  0.      0.     ...,  0.      0.      0.0028]
xlabel = Energy flux (ergs cm^{-2} sec^{-1})
ylabel = Frequency
title  = Energy 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_energy_flux_hist(0.5,7.,n=10000,bins=80)
sherpa> plot_energy_flux()

Visualize a simulated energy flux probability distribution with a histogram created by the get_energy_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.

Changes in CIAO 4.3

The get_energy_flux_hist command has a new argument 'numcores' to specify how many cores on a user's system should be utilized when the command is run.


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

See Also

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
get_arf_plot, get_bkg_plot
get_photon_flux_hist, get_split_plot, plot, plot_arf, plot_bkg, plot_chisqr, plot_data, plot_delchi, plot_energy_flux, plot_fit, plot_model, plot_model_component, plot_order, plot_photon_flux, plot_ratio, plot_resid, plot_source, plot_source_component, set_xlinear, set_xlog, set_ylinear, set_ylog
get_chisqr_plot, get_delchi_plot
sample_energy_flux, sample_photon_flux

Last modified: December 2010
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-2019. All rights reserved.