plot_energy_flux¶
-
sherpa.astro.ui.
plot_energy_flux
(lo=None, hi=None, id=None, num=7500, bins=75, correlated=False, numcores=None, bkg_id=None, **kwargs)¶ Display the energy flux distribution.
For each iteration, draw the parameter values of the model from a normal distribution, evaluate the model, and sum the model over the given range (the flux). Plot up the distribution of this flux. The units for the flux are as returned by calc_energy_flux. The sample_energy_flux and get_energy_flux_hist functions return the data used to create this plot.
Parameters: - lo (number, optional) – The lower limit to use when summing up the signal. If not given then the lower value of the data grid is used.
- hi (optional) – The upper limit to use when summing up the signal. If not guven then the upper value of the data grid is used.
- id (int or string, optional) – The identifier of the data set to use. The default value
(
None
) means that the default identifier, as returned by get_default_id, is used. - num (int, optional) – The number of samples to create. The default is 7500.
- bins (int, optional) – The number of bins to use for the histogram.
- correlated (bool, optional) – If
True
(the default isFalse
) thenscales
is the full covariance matrix, otherwise it is just a 1D array containing the variances of the parameters (the diagonal elements of the covariance matrix). - numcores (optional) – The number of CPU cores to use. The default is to use all the cores on the machine.
- bkg_id (int or string, optional) – The identifier of the background component to use. This should only be set when the line to be measured is in the background model.
- scales (array, optional) – The scales used to define the normal distributions for the
parameters. The form depends on the
correlated
parameter: whenTrue
, the array should be a symmetric positive semi-definite (N,N) array, otherwise a 1D array of length N, where N is the number of free parameters. - recalc (bool, optional) – If
True
, the default, then re-calculate the values rather than use the values from the last time the function was run. - overplot (bool, optional) – If
True
then add the data to an exsiting plot, otherwise create a new plot. The default isFalse
.
See also
calc_photon_flux()
- Integrate the source model over a pass band.
calc_energy_flux()
- Integrate the source model over a pass band.
covar()
- Estimate the confidence intervals using the confidence method.
get_energy_flux_hist()
- Return the data displayed by plot_energy_flux.
get_photon_flux_hist()
- Return the data displayed by plot_photon_flux.
plot_cdf()
- Plot the cumulative density function of an array.
plot_pdf()
- Plot the probability density function of an array.
plot_photon_flux()
- Display the photon flux distribution.
plot_trace()
- Create a trace plot of row number versus value.
sample_energy_flux()
- Return the energy flux distribution of a model.
sample_flux()
- Return the flux distribution of a model.
sample_photon_flux()
- Return the photon flux distribution of a model.
Examples
Plot the energy energy distribution for the range 0.5 to 7 for the default data set:
>>> plot_energy_flux(0.5, 7, num=1000)
Overplot the 0.5 to 2 energy flux distribution from the “core” data set on top of the values from the “jet” data set:
>>> plot_energy_flux(0.5, 2, id="jet", num=1000) >>> plot_energy_flux(0.5, 2, id="core", num=1000, overplot=True)