Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing attributes to other fit methods #81

Merged
merged 3 commits into from
Jan 5, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions lmfit/minimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ def lbfgsb(self, **kws):
xout, fout, info = scipy_lbfgsb(self.penalty, self.vars, **lb_kws)
self.nfev = info['funcalls']
self.message = info['task']
self.chisqr = (self.penalty(xout)**2).sum()
self.residual = self.__residual(xout)
self.chisqr = (self.residual**2).sum()
self.ndata = len(self.residual)
self.nfree = (self.ndata - self.nvarys)
self.redchi = self.chisqr/self.nfree
self.unprepare_fit()
return

Expand All @@ -339,7 +343,11 @@ def fmin(self, **kws):
ret = scipy_fmin(self.penalty, self.vars, **fmin_kws)
xout, fout, iter, funccalls, warnflag, allvecs = ret
self.nfev = funccalls
self.chisqr = (self.penalty(xout)**2).sum()
self.residual = self.__residual(xout)
self.chisqr = (self.residual**2).sum()
self.ndata = len(self.residual)
self.nfree = (self.ndata - self.nvarys)
self.redchi = self.chisqr/self.nfree
self.unprepare_fit()
return

Expand Down Expand Up @@ -382,9 +390,13 @@ def scalar_minimize(self, method='Nelder-Mead', hess=None, tol=None, **kws):

ret = scipy_minimize(self.penalty, self.vars, **fmin_kws)
xout = ret.x
self.message = ret.message
self.message = ret.message
self.nfev = ret.nfev
self.chisqr = (self.penalty(xout)**2).sum()
self.residual = self.__residual(xout)
self.chisqr = (self.residual**2).sum()
self.ndata = len(self.residual)
self.nfree = (self.ndata - self.nvarys)
self.redchi = self.chisqr/self.nfree
self.unprepare_fit()
return

Expand Down