FitResults
- class sherpa.fit.FitResults(fit: Fit, results: tuple[bool, ndarray, float, str, dict[str, Any]], init_stat: float, param_warnings: str)[source] [edit on github]
Bases:
NoNewAttributesAfterInit
The results of a fit.
This object contains the parameter values, information on the statistic and optimisation-method used, and other relevant information.
Changed in version 4.10.1: The
covarerr
attribute has been renamed tocovar
and now contains the covariance matrix estimated at the best-fit location, if provided by the optimiser.Changed in version 4.17.1: The
record_steps
attribute has been added to the class. If the fit recorded the parameter values of each step in the optimization, this attribute will contain an array with the data.Attributes Summary
Was the fit successful (did it converge)?
The parameter names that were varied in the fit,
The parameter values, in the same order as
parnames
.The statistic value at the start of the fit.
The statistic value after the fit.
The change in the statistic value (
istatval - statval
).The number of bins used in the fits.
The number of degrees of freedom in the fit (the number of bins minus the number of free parameters).
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.
The reduced statistic value (the
statval
field divided bydof
).A message about the results of the fit (e.g. if the fit was unable to converge).
The covariance matrix from the best-fit location, if provided by the optimiser.
The number of model evaluations made during the fit.
The
extra_output
field from the fit.A record of all steps taken during the fit, if requested with
record_steps=True
.The values of the best-fit model evaluated for the data.
The name of the optimisation method used (in lower case).
What iterated-fit scheme was used, if any.
The name of the statistic function.
A sequence of the data set ids included in the results.
Methods Summary
format
()Return a string representation of the fit results.
Attributes Documentation
- parnames: tuple[str, ...]
The parameter names that were varied in the fit,
This is the thawed parameters in the model expression.
- dof: int
The number of degrees of freedom in the fit (the number of bins minus the number of free parameters).
- qval: float | None
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: float | None
The reduced statistic value (the
statval
field divided bydof
).This is not calculated for all statistics.
- message: str
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.
- covar
The covariance matrix from the best-fit location, if provided by the optimiser.
- extra_output
The
extra_output
field from the fit.
- record_steps: None | dict
A record of all steps taken during the fit, if requested with
record_steps=True
.
Methods Documentation
- format() str [source] [edit on github]
Return a string representation of the fit results.
- Returns:
txt – A multi-line representation of the fit results.
- Return type: