Skip to content

Commit

Permalink
Merge pull request #418 from reneeotten/add_attributes_MinimizerResul…
Browse files Browse the repository at this point in the history
…t_brute

add missing attributes to MinimizerResult when using brute method
  • Loading branch information
newville authored May 28, 2017
2 parents 3371974 + c1b6cf0 commit b02523a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lmfit/minimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,15 @@ def brute(self, params=None, Ns=20, keep=50):

result.params = result.candidates[0].params
result.chisqr = ret[1]
result.nvarys = len(result.var_names)
result.residual = self.__residual(result.brute_x0, apply_bounds_transformation=False)
result.ndata = len(result.residual)
result.nfree = result.ndata - result.nvarys
result.redchi = result.chisqr / result.nfree
# this is -2*loglikelihood
_neg2_log_likel = result.ndata * np.log(result.chisqr / result.ndata)
result.aic = _neg2_log_likel + 2 * result.nvarys
result.bic = _neg2_log_likel + np.log(result.ndata) * result.nvarys

return result

Expand Down

0 comments on commit b02523a

Please sign in to comment.