[Numpy-svn] r3504 - in trunk/numpy: . core f2py fft lib linalg oldnumeric

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Jan 8 22:45:55 CST 2007


Author: timl
Date: 2007-01-08 22:45:31 -0600 (Mon, 08 Jan 2007)
New Revision: 3504

Modified:
   trunk/numpy/core/defmatrix.py
   trunk/numpy/core/fromnumeric.py
   trunk/numpy/core/ma.py
   trunk/numpy/core/setup.py
   trunk/numpy/ctypeslib.py
   trunk/numpy/f2py/auxfuncs.py
   trunk/numpy/fft/helper.py
   trunk/numpy/fft/setup.py
   trunk/numpy/lib/convdtype.py
   trunk/numpy/lib/function_base.py
   trunk/numpy/lib/index_tricks.py
   trunk/numpy/lib/polynomial.py
   trunk/numpy/lib/setup.py
   trunk/numpy/lib/shape_base.py
   trunk/numpy/lib/twodim_base.py
   trunk/numpy/lib/utils.py
   trunk/numpy/linalg/linalg.py
   trunk/numpy/linalg/setup.py
   trunk/numpy/oldnumeric/compat.py
   trunk/numpy/oldnumeric/random_array.py
Log:
clean up unused imports and bad whitespace

Modified: trunk/numpy/core/defmatrix.py
===================================================================
--- trunk/numpy/core/defmatrix.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/core/defmatrix.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -2,7 +2,6 @@
 
 import numeric as N
 from numeric import concatenate, isscalar, binary_repr
-import types
 import string as str_
 import sys
 
@@ -238,6 +237,7 @@
         over all dimensions.  This preserves the orientation of the
         result as a row or column.
         """
+        # FIXME: should out=None be used here, or should it just be out?
         return N.ndarray.sum(self, axis, dtype, out=None)._align(axis)
 
     def mean(self, axis=None, out=None):

Modified: trunk/numpy/core/fromnumeric.py
===================================================================
--- trunk/numpy/core/fromnumeric.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/core/fromnumeric.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -14,10 +14,7 @@
 import multiarray as mu
 import umath as um
 import numerictypes as nt
-from numeric import asarray, array, asanyarray, correlate, outer, concatenate
-from umath import sign, absolute, multiply
-import numeric as _nx
-import sys
+from numeric import asarray, array, asanyarray, concatenate
 _dt_ = nt.sctype2char
 
 import types

Modified: trunk/numpy/core/ma.py
===================================================================
--- trunk/numpy/core/ma.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/core/ma.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -1683,7 +1683,6 @@
                     d = add.reduce(w, axis)
                     del w
                 elif wsh == (ash[axis],):
-                    ni = ash[axis]
                     r = [newaxis]*len(ash)
                     r[axis] = slice(None, None, 1)
                     w = eval ("w["+ repr(tuple(r)) + "] * ones(ash, float)")
@@ -1708,7 +1707,6 @@
                     n = add.reduce(a*w, axis)
                     d = add.reduce(w, axis)
                 elif wsh == (ash[axis],):
-                    ni = ash[axis]
                     r = [newaxis]*len(ash)
                     r[axis] = slice(None, None, 1)
                     w = eval ("w["+ repr(tuple(r)) + "] * masked_array(ones(ash, float), mask)")

Modified: trunk/numpy/core/setup.py
===================================================================
--- trunk/numpy/core/setup.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/core/setup.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -2,8 +2,7 @@
 import os
 import sys
 from os.path import join
-from glob import glob
-from distutils.dep_util import newer,newer_group
+from distutils.dep_util import newer
 
 FUNCTIONS_TO_CHECK = [
     ('expl', 'HAVE_LONGDOUBLE_FUNCS'),

Modified: trunk/numpy/ctypeslib.py
===================================================================
--- trunk/numpy/ctypeslib.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/ctypeslib.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -2,7 +2,7 @@
            'c_intp']
 
 import sys, os
-from numpy import integer, product, ndarray, dtype as _dtype, deprecate
+from numpy import integer, ndarray, dtype as _dtype, deprecate
 from numpy.core.multiarray import _flagdict, flagsobj
 
 try:

Modified: trunk/numpy/f2py/auxfuncs.py
===================================================================
--- trunk/numpy/f2py/auxfuncs.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/f2py/auxfuncs.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -228,7 +228,6 @@
 def containsmodule(block):
     if ismodule(block): return 1
     if not hasbody(block): return 0
-    ret = []
     for b in block['body']:
         if containsmodule(b): return 1
     return 0

Modified: trunk/numpy/fft/helper.py
===================================================================
--- trunk/numpy/fft/helper.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/fft/helper.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -6,7 +6,7 @@
 __all__ = ['fftshift','ifftshift','fftfreq']
 
 from numpy.core import asarray, concatenate, arange, take, \
-    array, integer
+    integer
 from numpy import hstack
 import types
 

Modified: trunk/numpy/fft/setup.py
===================================================================
--- trunk/numpy/fft/setup.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/fft/setup.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -1,5 +1,4 @@
 
-from os.path import join
 
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration

Modified: trunk/numpy/lib/convdtype.py
===================================================================
--- trunk/numpy/lib/convdtype.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/convdtype.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -1,6 +1,5 @@
 from tokenize import  generate_tokens
 import token
-from StringIO import StringIO
 import sys
 def insert(s1, s2, posn):
     """insert s1 into s2 at positions posn
@@ -17,6 +16,7 @@
 
 def insert_dtype(readline, output=None):
     """
+    >>> from StringIO import StringIO
     >>> src = "zeros((2,3), dtype=float); zeros((2,3));"
     >>> insert_dtype(StringIO(src).readline)
     zeros((2,3), dtype=float); zeros((2,3), dtype=int);

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/function_base.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -639,7 +639,7 @@
 
 import sys
 if sys.hexversion < 0x2040000:
-   from sets import Set as set
+    from sets import Set as set
 
 def unique(x):
     """Return sorted unique items from an array or sequence.

Modified: trunk/numpy/lib/index_tricks.py
===================================================================
--- trunk/numpy/lib/index_tricks.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/index_tricks.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -8,7 +8,6 @@
            'ndenumerate','ndindex']
 
 import sys
-import types
 import numpy.core.numeric as _nx
 from numpy.core.numeric import asarray, ScalarType, array
 
@@ -319,8 +318,6 @@
 
 r_ = r_class()
 
-import warnings
-
 class c_class(concatenator):
     """Translates slice objects to concatenation along the second axis.
 

Modified: trunk/numpy/lib/polynomial.py
===================================================================
--- trunk/numpy/lib/polynomial.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/polynomial.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -650,3 +650,5 @@
 # Stuff to do on module import
 
 warnings.simplefilter('always',RankWarning)
+
+    

Modified: trunk/numpy/lib/setup.py
===================================================================
--- trunk/numpy/lib/setup.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/setup.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -1,15 +1,9 @@
-import imp
-import os
 from os.path import join
-from glob import glob
-from distutils.dep_util import newer,newer_group
 
 def configuration(parent_package='',top_path=None):
-    from numpy.distutils.misc_util import Configuration,dot_join
-    from numpy.distutils.system_info import get_info
+    from numpy.distutils.misc_util import Configuration
 
     config = Configuration('lib',parent_package,top_path)
-    local_dir = config.local_path
 
     config.add_include_dirs(join('..','core','include'))
 

Modified: trunk/numpy/lib/shape_base.py
===================================================================
--- trunk/numpy/lib/shape_base.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/shape_base.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -568,7 +568,7 @@
             nd = nda
     result = outer(a,b).reshape(as_+bs)
     axis = nd-1
-    for k in xrange(nd):
+    for _ in xrange(nd):
         result = concatenate(result, axis=axis)
     if wrapper is not None:
         result = wrapper(result)

Modified: trunk/numpy/lib/twodim_base.py
===================================================================
--- trunk/numpy/lib/twodim_base.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/twodim_base.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -5,7 +5,7 @@
 __all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu',
            'tril','vander','histogram2d']
 
-from numpy.core.numeric import asanyarray, int_, equal, subtract, arange, \
+from numpy.core.numeric import asanyarray, equal, subtract, arange, \
      zeros, arange, greater_equal, multiply, ones, asarray
 
 def fliplr(m):

Modified: trunk/numpy/lib/utils.py
===================================================================
--- trunk/numpy/lib/utils.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/lib/utils.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -1,8 +1,8 @@
-import sys, os
+import sys
 import inspect
 import types
-from numpy.core.numerictypes import obj2sctype, integer, generic
-from numpy.core.multiarray import dtype as _dtype, _flagdict, flagsobj
+from numpy.core.numerictypes import obj2sctype, generic
+from numpy.core.multiarray import dtype as _dtype
 from numpy.core import product, ndarray
 
 __all__ = ['issubclass_', 'get_numpy_include', 'issubsctype',

Modified: trunk/numpy/linalg/linalg.py
===================================================================
--- trunk/numpy/linalg/linalg.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/linalg/linalg.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -20,8 +20,8 @@
         intc, single, double, csingle, cdouble, inexact, complexfloating, \
         newaxis, ravel, all, Inf, dot, add, multiply, identity, sqrt, \
         maximum, flatnonzero, diagonal, arange, fastCopyAndTranspose, sum, \
-        argsort, isfinite
-from numpy.lib import triu, iterable
+        isfinite
+from numpy.lib import triu
 from numpy.linalg import lapack_lite
 
 fortran_int = intc
@@ -113,7 +113,7 @@
 def _assertRank2(*arrays):
     for a in arrays:
         if len(a.shape) != 2:
-            raise LinAlgError, 'Array must be two-dimensional'
+            raise LinAlgError, '%d-dimensional array given. Array must be two-dimensional' % len(a.shape)
 
 def _assertSquareness(*arrays):
     for a in arrays:

Modified: trunk/numpy/linalg/setup.py
===================================================================
--- trunk/numpy/linalg/setup.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/linalg/setup.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -1,6 +1,4 @@
 
-from os.path import join
-
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
     from numpy.distutils.system_info import get_info

Modified: trunk/numpy/oldnumeric/compat.py
===================================================================
--- trunk/numpy/oldnumeric/compat.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/oldnumeric/compat.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -11,13 +11,10 @@
 
 import numpy.core.multiarray as multiarray
 import numpy.core.umath as um
-from numpy.core.numeric import array, correlate, outer, cross
-from numpy.core.umath import sign, absolute, multiply
+from numpy.core.numeric import array, correlate
 import functions
 import sys
 
-import types
-
 from cPickle import dump, dumps
 
 mu = multiarray

Modified: trunk/numpy/oldnumeric/random_array.py
===================================================================
--- trunk/numpy/oldnumeric/random_array.py	2007-01-09 03:10:09 UTC (rev 3503)
+++ trunk/numpy/oldnumeric/random_array.py	2007-01-09 04:45:31 UTC (rev 3504)
@@ -72,31 +72,31 @@
     return mt.standard_normal(shape)
 
 def normal(mean, std, shape=[]):
-        """normal(mean, std, n) or normal(mean, std, [n, m, ...]) returns
-           array of random numbers randomly distributed with specified mean and
-           standard deviation"""
-        if shape == []:
-            shape = None
-        return mt.normal(mean, std, shape)
+    """normal(mean, std, n) or normal(mean, std, [n, m, ...]) returns
+    array of random numbers randomly distributed with specified mean and
+    standard deviation"""
+    if shape == []:
+        shape = None
+    return mt.normal(mean, std, shape)
 
 def multivariate_normal(mean, cov, shape=[]):
-       """multivariate_normal(mean, cov) or multivariate_normal(mean, cov, [m, n, ...])
-          returns an array containing multivariate normally distributed random numbers
-          with specified mean and covariance.
+    """multivariate_normal(mean, cov) or multivariate_normal(mean, cov, [m, n, ...])
+    returns an array containing multivariate normally distributed random numbers
+    with specified mean and covariance.
+    
+    mean must be a 1 dimensional array. cov must be a square two dimensional
+    array with the same number of rows and columns as mean has elements.
+    
+    The first form returns a single 1-D array containing a multivariate
+    normal.
+    
+    The second form returns an array of shape (m, n, ..., cov.shape[0]).
+    In this case, output[i,j,...,:] is a 1-D array containing a multivariate
+    normal."""
+    if shape == []:
+        shape = None
+    return mt.multivariate_normal(mean, cov, shape)
 
-          mean must be a 1 dimensional array. cov must be a square two dimensional
-          array with the same number of rows and columns as mean has elements.
-
-          The first form returns a single 1-D array containing a multivariate
-          normal.
-
-          The second form returns an array of shape (m, n, ..., cov.shape[0]).
-          In this case, output[i,j,...,:] is a 1-D array containing a multivariate
-          normal."""
-       if shape == []:
-           shape = None
-       return mt.multivariate_normal(mean, cov, shape)
-
 def exponential(mean, shape=[]):
     """exponential(mean, n) or exponential(mean, [n, m, ...]) returns array
       of random numbers exponentially distributed with specified mean"""
@@ -195,8 +195,8 @@
     print "(should be about ", mean, "):", x_mean
     print "Variance of those random numbers (should be about ", var, "):", x_var
     if skew != []:
-       x_skew = (Numeric.sum(x_minus_mean*x_minus_mean*x_minus_mean,axis=0)/9998.)/x_var**(3./2.)
-       print "Skewness of those random numbers (should be about ", skew, "):", x_skew
+        x_skew = (Numeric.sum(x_minus_mean*x_minus_mean*x_minus_mean,axis=0)/9998.)/x_var**(3./2.)
+        print "Skewness of those random numbers (should be about ", skew, "):", x_skew
 
 def test():
     obj = mt.get_state()



More information about the Numpy-svn mailing list