Last modified: December 2022

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/get_fit_results.html
Jump to: Description · Examples · PARAMETERS · Notes · Bugs · See Also


AHELP for CIAO 4.15 Sherpa

get_fit_results

Context: fitting

Synopsis

Return the results of the last fit.

Syntax

get_fit_results()

Description

This function returns the results from the most-recent fit. The returned value includes information on the parameter values and fit statistic.


Examples

Example 1

Display the fit results:

>>> print(get_fit_results())

Example 2

Inspect the fit results:

>>> 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)

PARAMETERS

This function has no parameters

Return value

The return value from this function is:

stats -- The results of the last fit. It does not reflect any changes made to the model parameter, or settings, since the last fit.

Notes

The fields of the object include:

Item Definition
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.

Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

fitting
fit, get_stat_info