Improved fit result
@@ -218,7 +218,8 @@ class Fit:
parameters.set_parameter_factors(factors)
parameters.check_limits()
return OptimizeResult(
- parameters=parameters,
+ parameters=parameters.copy(),
+ models=datasets.models.copy(),
total_stat=datasets.stat_sum(),
backend=backend,
method=kwargs.get("method", backend),
@@ -531,8 +532,9 @@ class CovarianceResult(FitStepResult):
class OptimizeResult(FitStepResult):
"""Optimize result object."""
- def __init__(self, parameters, nfev, total_stat, trace, **kwargs):
+ def __init__(self, parameters, models, nfev, total_stat, trace, **kwargs):
self._parameters = parameters
+ self._models = models
self._nfev = nfev
self._total_stat = total_stat
self._trace = trace
@@ -543,6 +545,11 @@ class OptimizeResult(FitStepResult):
"""Best fit parameters"""
return self._parameters
+ @property
+ def models(self):
+ """Best fit models"""
+ return self._models
+
@property
def trace(self):
"""Parameter trace from the optimisation"""
@@ -586,6 +593,12 @@ class FitResult:
"""Best fit parameters of the optimization step"""
return self.optimize_result.parameters
+ # TODO: is the convenience access needed?
+ @property
+ def models(self):
+ """Best fit parameters of the optimization step"""
+ return self.optimize_result.models
+
# TODO: is the convenience access needed?
@property
def total_stat(self):
