sherpa.ui.get_pvalue_plot(null_model=None, alt_model=None, conv_model=None, id=1, otherids=(), num=500, bins=25, numcores=None, recalc=False)

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.

  • null_model – The model expression for the null hypothesis.

  • alt_model – The model expression for the alternative hypothesis.

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

  • id (int or str, optional) – The data set that provides the data. The default is 1.

  • otherids (sequence of int or str, optional) – Other data sets to use in the calculation.

  • num (int, optional) – The number of simulations to run. The default is 500.

  • bins (int, optional) – The number of bins to use to create the histogram. The default is 25.

  • numcores (optional) – The number of CPU cores to use. The default is to use all the cores on the machine.

  • recalc (bool, 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.



Return type:

a sherpa.plot.LRHistogram instance


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


Return the values from the last call to plot_pvalue:

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

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

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