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_pvaluefunction, 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
copyattribute toFalse.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_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
intorstr,optional The data set that provides the data. The default is 1.
- otheridssequence
ofintorstr,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.
- recalcbool,
optional The default value (
False) means that the results from the last call toplot_pvalueorget_pvalue_plotare returned. IfTrue, 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:
- plot
asherpa.plot.LRHistograminstance
- plot
See also
Notes
The
set_rngroutine 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)