get_confidence_results
- sherpa.ui.get_confidence_results()
Return the results of the last
confrun.- Returns:
results
- Return type:
sherpa.fit.ErrorEstResults object
- Raises:
sherpa.utils.err.SessionErr – If no
confcall has been made.
See also
get_conf_optReturn one or all of the options for the confidence interval method.
set_conf_optSet an option of the conf estimation object.
Notes
The fields of the object include:
datasetsA tuple of the data sets used in the analysis.
methodnameThis will be ‘confidence’.
iterfitnameThe name of the iterated-fit method used, if any.
fitnameThe name of the optimization method used.
statnameThe name of the fit statistic used.
sigmaThe sigma value used to calculate the confidence intervals.
percentThe percentage of the signal contained within the confidence intervals (calculated from the
sigmavalue assuming a normal distribution).parnamesA tuple of the parameter names included in the analysis.
parvalsA tuple of the best-fit parameter values, in the same order as
parnames.parminsA tuple of the lower error bounds, in the same order as
parnames.parmaxesA tuple of the upper error bounds, in the same order as
parnames.nfitsThe number of model evaluations.
Examples
>>> res = get_conf_results() >>> print(res) datasets = (1,) methodname = confidence iterfitname = none fitname = levmar statname = chi2gehrels sigma = 1 percent = 68.2689492137 parnames = ('p1.gamma', 'p1.ampl') parvals = (2.1585155113403327, 0.00022484014787994827) parmins = (-0.082785567348122591, -1.4825550342799376e-05) parmaxes = (0.083410634144100104, 1.4825550342799376e-05) nfits = 13
The following converts the above into a dictionary where the keys are the parameter names and the values are the tuple (best-fit value, lower-limit, upper-limit):
>>> pvals1 = zip(res.parvals, res.parmins, res.parmaxes) >>> pvals2 = [(v, v+l, v+h) for (v, l, h) in pvals1] >>> dres = dict(zip(res.parnames, pvals2)) >>> dres['p1.gamma'] (2.1585155113403327, 2.07572994399221, 2.241926145484433)