get_pvalue_plot

sherpa.astro.ui.get_pvalue_plot(null_model=None, alt_model=None, conv_model=None, id: IdType = 1, otherids: IdTypes = (), num: int = 500, bins: int = 25, numcores: int | None = None, recalc: bool = False, copy: bool = True)

Return the data used by plot_pvalue.

Access the data arrays and preferences defining the histogram plot produced by the plot_pvalue function, a histogram of the likelihood ratios comparing fits of the null model to fits of the alternative model using faked data with Poisson noise. Data returned includes the likelihood ratio computed using the observed data, and the p-value, used to reject or accept the null model.

Changed in version 4.19.0: The plot object is now copied by default. To get the previous behaviour set the copy attribute to False.

Changed in version 4.17.0: The “wstat” statistic can now be used with this routine.

Parameters:
null_model

The model expression for the null hypothesis.

alt_model

The model expression for the alternative hypothesis.

conv_modeloptional

An expression used to modify the model so that it can be compared to the data (e.g. a PSF or PHA response).

idint or str, optional

The data set that provides the data. The default is 1.

otheridssequence of int or str, optional

Other data sets to use in the calculation.

numint, optional

The number of simulations to run. The default is 500.

binsint, optional

The number of bins to use to create the histogram. The default is 25.

numcoresoptional

The number of CPU cores to use. The default is to use all the cores on the machine.

recalcbool, optional

The default value (False) means that the results from the last call to plot_pvalue or get_pvalue_plot are returned. If True, the values are re-calculated.

copybool, optional

Is the plot object copied before being returned? If so then the plot attributes will not be changed by multiple calls to this routine.

Returns:
plota sherpa.plot.LRHistogram instance

Notes

The set_rng routine is used to control how the random numbers are generated.

Examples

Return the values from the last call to plot_pvalue:

>>> pvals = get_pvalue_plot()
>>> pvals.ppp
0.472

Run 500 simulations for the two models and print the results:

>>> pvals = get_pvalue_plot(mdl1, mdl2, recalc=True, num=500)
>>> print(pvals)