get_fit_results

sherpa.astro.ui.get_fit_results()

Return the results of the last fit.

Returns:stats – The results of the last fit. It does not reflect any changes made to the model parameter, or settings, since the last fit.
Return type:a sherpa.fit.FitResults instance

See also

calc_stat()
Calculate the fit statistic for a data set.
calc_stat_info()
Display the statistic values for the current models.
fit()
Fit a model to one or more data sets.
get_stat_info()
Return the statistic values for the current models.
set_iter_method()
Set the iterative-fitting scheme used in the fit.

Notes

The fields of the object include:

datasets
A sequence of the data set ids included in the results.
itermethodname
What iterated-fit scheme was used, if any (as set by set_iter_method).
statname
The name of the statistic function (as used in set_stat).
succeeded
Was the fit successful (did it converge)?
parnames
A tuple of the parameter names that were varied in the fit (the thawed parameters in the model expression).
parvals
A tuple of the parameter values, in the same order as parnames.
statval
The statistic value after the fit.
istatval
The statistic value at the start of the fit.
dstatval
The change in the statistic value (istatval - statval).
numpoints
The number of bins used in the fits.
dof
The number of degrees of freedom in the fit (the number of bins minus the number of free parameters).
qval
The Q-value (probability) that one would observe the reduced statistic value, or a larger value, if the assumed model is true and the current model parameters are the true parameter values. This will be None if the value can not be calculated with the current statistic (e.g. the Cash statistic).
rstat
The reduced statistic value (the statval field divided by dof). This is not calculated for all statistics.
message
A message about the results of the fit (e.g. if the fit was unable to converge). The format and contents depend on the optimisation method.
nfev
The number of model evaluations made during the fit.

Examples

>>> res = get_fit_results()
>>> res.statval
498.21750663761935
>>> res.dof
439
>>> res.parnames
('pl.gamma', 'pl.ampl', 'gline.fwhm', 'gline.pos', 'gline.ampl')
>>> res.parvals
(-0.20659543380329071, 0.00030398852609788524, 100.0, 4900.0, 0.001)