get_conf_results

sherpa.astro.ui.get_conf_results()

Return the results of the last conf run.

Returns:results
Return type:sherpa.fit.ErrorEstResults object
Raises:sherpa.utils.err.SessionErr – If no conf call has been made.

See also

get_conf_opt()
Return one or all of the options for the confidence interval method.
set_conf_opt()
Set an option of the conf estimation object.

Notes

The fields of the object include:

datasets
A tuple of the data sets used in the analysis.
methodname
This will be ‘confidence’.
iterfitname
The name of the iterated-fit method used, if any.
fitname
The name of the optimization method used.
statname
The name of the fit statistic used.
sigma
The sigma value used to calculate the confidence intervals.
percent
The percentage of the signal contained within the confidence intervals (calculated from the sigma value assuming a normal distribution).
parnames
A tuple of the parameter names included in the analysis.
parvals
A tuple of the best-fit parameter values, in the same order as parnames.
parmins
A tuple of the lower error bounds, in the same order as parnames.
parmaxes
A tuple of the upper error bounds, in the same order as parnames.

nfits

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)