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

scipy-svn@scip... scipy-svn@scip...
Wed Jun 16 10:21:40 CDT 2010


Author: charris
Date: 2010-06-16 10:21:40 -0500 (Wed, 16 Jun 2010)
New Revision: 6508

Modified:
   trunk/scipy/optimize/minpack.py
Log:
DEP, STY: Remove deprecated warning keyword from leastsq and make a few style
cleanups.

Modified: trunk/scipy/optimize/minpack.py
===================================================================
--- trunk/scipy/optimize/minpack.py	2010-06-16 15:21:34 UTC (rev 6507)
+++ trunk/scipy/optimize/minpack.py	2010-06-16 15:21:40 UTC (rev 6508)
@@ -171,7 +171,7 @@
 
 def leastsq(func, x0, args=(), Dfun=None, full_output=0,
             col_deriv=0, ftol=1.49012e-8, xtol=1.49012e-8,
-            gtol=0.0, maxfev=0, epsfcn=0.0, factor=100, diag=None,warning=True):
+            gtol=0.0, maxfev=0, epsfcn=0.0, factor=100, diag=None):
     """Minimize the sum of squares of a set of equations.
 
     ::
@@ -216,9 +216,6 @@
         (``factor * || diag * x||``). Should be in interval ``(0.1, 100)``.
     diag : sequence
         N positive entries that serve as a scale factors for the variables.
-    warning : bool
-        Whether to print a warning message when the call is unsuccessful.
-        Deprecated, use the warnings module instead.
 
     Returns
     -------
@@ -261,29 +258,27 @@
     "leastsq" is a wrapper around MINPACK's lmdif and lmder algorithms.
 
     """
-    if not warning :
-        msg = "The warning keyword is deprecated. Use the warnings module."
-        warnings.warn(msg, DeprecationWarning)
-    x0 = array(x0,ndmin=1)
+    x0 = array(x0, ndmin=1)
     n = len(x0)
-    if type(args) != type(()): args = (args,)
-    m = check_func(func,x0,args,n)[0]
-    if n>m:
+    if type(args) != type(()):
+        args = (args,)
+    m = check_func(func, x0, args, n)[0]
+    if n > m:
         raise TypeError('Improper input: N=%s must not exceed M=%s' % (n,m))
     if Dfun is None:
         if (maxfev == 0):
-            maxfev = 200*(n+1)
-        retval = _minpack._lmdif(func, x0, args, full_output,
-                                 ftol, xtol, gtol,
-                                 maxfev, epsfcn, factor, diag)
+            maxfev = 200*(n + 1)
+        retval = _minpack._lmdif(func, x0, args, full_output, ftol, xtol,
+                gtol, maxfev, epsfcn, factor, diag)
     else:
         if col_deriv:
-            check_func(Dfun,x0,args,n,(n,m))
+            check_func(Dfun, x0, args, n, (n,m))
         else:
-            check_func(Dfun,x0,args,n,(m,n))
+            check_func(Dfun, x0, args, n, (m,n))
         if (maxfev == 0):
-            maxfev = 100*(n+1)
-        retval = _minpack._lmder(func,Dfun,x0,args,full_output,col_deriv,ftol,xtol,gtol,maxfev,factor,diag)
+            maxfev = 100*(n + 1)
+        retval = _minpack._lmder(func, Dfun, x0, args, full_output, col_deriv,
+                ftol, xtol, gtol, maxfev, factor, diag)
 
     errors = {0:["Improper input parameters.", TypeError],
               1:["Both actual and predicted relative reductions "
@@ -335,7 +330,7 @@
                 cov_x = inv(dot(transpose(R),R))
             except LinAlgError:
                 pass
-        return (retval[0], cov_x) + retval[1:-1] + (mesg,info)
+        return (retval[0], cov_x) + retval[1:-1] + (mesg, info)
     else:
         return (retval[0], info)
 



More information about the Scipy-svn mailing list