[Scipy-svn] r5549 - trunk/scipy/optimize

scipy-svn@scip... scipy-svn@scip...
Thu Feb 12 22:52:05 CST 2009


Author: oliphant
Date: 2009-02-12 22:52:02 -0600 (Thu, 12 Feb 2009)
New Revision: 5549

Modified:
   trunk/scipy/optimize/minpack.py
Log:
Add better factor when using weighted non-linear least-squares.

Modified: trunk/scipy/optimize/minpack.py
===================================================================
--- trunk/scipy/optimize/minpack.py	2009-02-13 04:46:29 UTC (rev 5548)
+++ trunk/scipy/optimize/minpack.py	2009-02-13 04:52:02 UTC (rev 5549)
@@ -402,7 +402,7 @@
     if (len(xdata) > len(p0)):
         s_sq = (func(popt, *args)**2).sum()/(len(xdata)-len(p0))
         if sigma is not None:
-            s_sq /= args[-1].sum()
+            s_sq /= (args[-1]**2).sum()
         pcov = pcov * s_sq
     else:
         pcov = None



More information about the Scipy-svn mailing list