reg_unc
- sherpa.astro.ui.reg_unc(par0: str | Parameter, par1: str | Parameter, id: IdType | None = None, otherids: IdTypes | None = None, replot: bool = False, min=None, max=None, nloop=(10, 10), delv=None, fac: float = 4, log=(False, False), sigma=(1, 2, 3), levels=None, numcores: int | None = None, overplot: bool = False) None
Plot the statistic value as two parameters are varied.
Create a confidence plot of the fit statistic as a function of parameter value. Dashed lines are added to indicate the current statistic value and the parameter value at this point. The parameter value is varied over a grid of points and the statistic evaluated while holding the other parameters fixed. It is expected that this is run after a successful fit, so that the parameter values are at the best-fit location.
- Parameters:
- par0, par1
The parameters to plot on the X and Y axes, respectively.
- id
int,str,orNone,optional The data set that provides the data. If not given then all data sets with an associated model are used simultaneously.
- otheridssequence
ofintorstr,orNone,optional Other data sets to use in the calculation.
- replotbool,
optional Set to
Trueto use the values calculated by the last call toint_proj. The default isFalse.- min
pairofnumbers,optional The minimum parameter value for the calculation. The default value of
Nonemeans that the limit is calculated from the covariance, using thefacvalue.- max
pairofnumber,optional The maximum parameter value for the calculation. The default value of
Nonemeans that the limit is calculated from the covariance, using thefacvalue.- nloop
pairofint,optional The number of steps to use. This is used when
delvis set toNone.- delv
pairofnumber,optional The step size for the parameter. Setting this overrides the
nloopparameter. The default isNone.- fac
number,optional When
minormaxis not given, multiply the covariance of the parameter by this value to calculate the limit (which is then added or subtracted to the parameter value, as required).- log
pairofbool,optional Should the step size be logarithmically spaced? The default (
False) is to use a linear grid.- sigmasequence
ofnumber,optional The levels at which to draw the contours. The units are the change in significance relative to the starting value, in units of sigma.
- levelssequence
ofnumber,optional The numeric values at which to draw the contours. This overrides the
sigmaparameter, if set (the default isNone).- numcores
optional The number of CPU cores to use. The default is to use all the cores on the machine.
- overplotbool,
optional If
Truethen add the data to an existing plot, otherwise create a new plot. The default isFalse.
See also
confEstimate parameter confidence intervals using the confidence method.
covarEstimate the confidence intervals using the covariance method.
get_reg_uncReturn the interval-uncertainty object.
int_uncCalculate and plot the fit statistic versus fit parameter value.
reg_projPlot the statistic value as two parameters are varied.
Notes
The difference to
reg_projis that at each step only the pair of parameters are varied, while all the other parameters remain at their starting value. This makes the result a less-accurate rendering of the projected shape of the hypersurface formed by the statistic, but the run-time is likely shorter than, the results ofreg_proj, which fits the model to the remaining thawed parameters at each step. If there are no free parameters in the model, other than the parameters being plotted, then the results will be the same.Examples
Vary the
xposandyposparameters of thegsrcmodel component for all data sets with a source expression.>>> reg_unc(gsrc.xpos, gsrc.ypos)
Use only the data in data set 1:
>>> reg_unc(gsrc.xpos, gsrc.ypos, id=1)
Only display the one- and three-sigma contours:
>>> reg_unc(gsrc.xpos, gsrc.ypos, sigma=(1, 3))
Display contours at values of 5, 10, and 20 more than the statistic value of the source model for data set 1:
>>> s0 = calc_stat(id=1) >>> lvls = s0 + np.asarray([5, 10, 20]) >>> reg_unc(gsrc.xpos, gsrc.ypos, levels=lvls, id=1)
Increase the limits of the plot and the number of steps along each axis:
>>> reg_unc(gsrc.xpos, gsrc.ypos, id=1, fac=6, nloop=(41, 41))
Compare the
amplparameters of thegandbmodel components, for data sets ‘core’ and ‘jet’, over the given ranges:>>> reg_unc(g.ampl, b.ampl, min=(0, 1e-4), max=(0.2, 5e-4), ... nloop=(51, 51), id='core', otherids=['jet'])
Overplot the results on the
reg_projplot:>>> reg_proj(s1.c0, s2.xpos) >>> reg_unc(s1.c0, s2.xpos, overplot=True)