[Numpy-svn] r2962 - in trunk/numpy: fft oldnumeric

numpy-svn at scipy.org numpy-svn at scipy.org
Sat Aug 5 01:44:26 CDT 2006


Author: oliphant
Date: 2006-08-05 01:44:20 -0500 (Sat, 05 Aug 2006)
New Revision: 2962

Added:
   trunk/numpy/oldnumeric/fft.py
Removed:
   trunk/numpy/fft/old.py
Modified:
   trunk/numpy/oldnumeric/__init__.py
   trunk/numpy/oldnumeric/functions.py
   trunk/numpy/oldnumeric/ma.py
   trunk/numpy/oldnumeric/matrix.py
   trunk/numpy/oldnumeric/misc.py
   trunk/numpy/oldnumeric/mlab.py
   trunk/numpy/oldnumeric/precision.py
   trunk/numpy/oldnumeric/typeconv.py
   trunk/numpy/oldnumeric/ufuncs.py
Log:
Fixes for the recent change to oldnumeric

Deleted: trunk/numpy/fft/old.py
===================================================================
--- trunk/numpy/fft/old.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/fft/old.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -1,19 +0,0 @@
-
-__all__ = ['fft', 'fft2d', 'fftnd', 'hermite_fft', 'inverse_fft', 'inverse_fft2d',
-           'inverse_fftnd', 'inverse_hermite_fft', 'inverse_real_fft', 'inverse_real_fft2d',
-           'inverse_real_fftnd', 'real_fft', 'real_fft2d', 'real_fftnd']
-
-from fftpack import fft
-from fftpack import fft2 as fft2d
-from fftpack import fftn as fftnd
-from fftpack import hfft as hermite_fft
-from fftpack import ifft as inverse_fft
-from fftpack import ifft2 as inverse_fft2d
-from fftpack import ifftn as inverse_fftnd
-from fftpack import ihfft as inverse_hermite_fft
-from fftpack import irfft as inverse_real_fft
-from fftpack import irfft2 as inverse_real_fft2d
-from fftpack import irfftn as inverse_real_fftnd
-from fftpack import rfft as real_fft
-from fftpack import rfft2 as real_fft2d
-from fftpack import rfftn as real_fftnd

Modified: trunk/numpy/oldnumeric/__init__.py
===================================================================
--- trunk/numpy/oldnumeric/__init__.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/__init__.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -1,5 +1,5 @@
 
-# Don't add these to the __all__ variable
+# Don't add these to the __all__ variable though
 from numpy import *
 
 def _move_axis_to_0(a, axis):
@@ -16,6 +16,7 @@
 from functions import *
 from precision import *
 from ufuncs import *
+from misc import *
 
 import compat
 import precision

Added: trunk/numpy/oldnumeric/fft.py
===================================================================
--- trunk/numpy/oldnumeric/fft.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/fft.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -0,0 +1,21 @@
+
+__all__ = ['fft', 'fft2d', 'fftnd', 'hermite_fft', 'inverse_fft',
+           'inverse_fft2d', 'inverse_fftnd',
+           'inverse_hermite_fft', 'inverse_real_fft',
+           'inverse_real_fft2d', 'inverse_real_fftnd',
+           'real_fft', 'real_fft2d', 'real_fftnd']
+
+from numpy.fft import fft
+from numpy.fft import fft2 as fft2d
+from numpy.fft import fftn as fftnd
+from numpy.fft import hfft as hermite_fft
+from numpy.fft import ifft as inverse_fft
+from numpy.fft import ifft2 as inverse_fft2d
+from numpy.fft import ifftn as inverse_fftnd
+from numpy.fft import ihfft as inverse_hermite_fft
+from numpy.fft import irfft as inverse_real_fft
+from numpy.fft import irfft2 as inverse_real_fft2d
+from numpy.fft import irfftn as inverse_real_fftnd
+from numpy.fft import rfft as real_fft
+from numpy.fft import rfft2 as real_fft2d
+from numpy.fft import rfftn as real_fftnd

Modified: trunk/numpy/oldnumeric/functions.py
===================================================================
--- trunk/numpy/oldnumeric/functions.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/functions.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -3,19 +3,19 @@
 import numpy as N
 import numpy.core.multiarray as mu
 import numpy.core.numeric as nn
-from typeconv import convtypecode
+from typeconv import convtypecode, convtypecode2
 
 __all__ = ['take', 'repeat', 'sum', 'product', 'sometrue', 'alltrue',
-           'cumsum', 'cumproduct']
-__all__ += ['ones', 'empty', 'identity', 'zeros', 'array', 'asarray', 'nonzero',
-            'reshape', 'arange', 'fromstring', 'ravel', 'trace', 'indices',
-            'where']
+           'cumsum', 'cumproduct',
+           'ones', 'empty', 'identity', 'zeros', 'array', 'asarray',
+           'nonzero', 'reshape', 'arange', 'fromstring', 'ravel', 'trace',
+           'indices', 'where']
 
 def take(a, indicies, axis=0):
     return N.take(a, indicies, axis)
 
 def repeat(a, repeats, axis=0):
-    return N.repeats(a, repeats, axis)
+    return N.repeat(a, repeats, axis)
 
 def sum(x, axis=0):
     return N.sum(x, axis)
@@ -62,11 +62,11 @@
     return mu.empty(shape, dtype, order)
 
 def array(sequence, typecode=None, copy=1, savespace=0, dtype=None):
-    dtype = convtypecode(typecode, dtype)
+    dtype = convtypecode2(typecode, dtype)
     return mu.array(sequence, dtype, copy=copy)
 
 def asarray(a, typecode=None, dtype=None):
-    dtype = convtypecode(typecode, dtype)
+    dtype = convtypecode2(typecode, dtype)
     return mu.array(a, dtype, copy=0)
 
 def nonzero(a):
@@ -80,7 +80,7 @@
     return N.reshape(a, shape)
 
 def arange(start, stop=None, step=1, typecode=None, dtype=None):
-    dtype = convtypecode(typecode, dtype)
+    dtype = convtypecode2(typecode, dtype)
     return mu.arange(start, stop, step, dtype)
 
 def fromstring(string, typecode='l', count=-1, dtype=None):

Modified: trunk/numpy/oldnumeric/ma.py
===================================================================
--- trunk/numpy/oldnumeric/ma.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/ma.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -1,11 +1,5 @@
+# Incompatibility in that getmask and a.mask returns nomask
+#  instead of None
 
-from numpy.core.ma import getmask as _getmask, nomask as _nomask
 from numpy.core.ma import *
 
-del getmask, nomask
-
-def getmask(a):
-    res = _getmask(a)
-    if res is _nomask:
-        return None
-    return res

Modified: trunk/numpy/oldnumeric/matrix.py
===================================================================
--- trunk/numpy/oldnumeric/matrix.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/matrix.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -4,14 +4,12 @@
 
 import string
 import types
-import numpy.oldnumeric as Numeric
 from user_array import UserArray, asarray
+import numpy.oldnumeric as Numeric
 from numpy.oldnumeric import dot, identity, multiply
-from mlab import squeeze
 import linear_algebra as LinearAlgebra
+from numpy import matrix as Matrix, squeeze
 
-from numpy import matrix as Matrix
-
 # Hidden names that will be the same. 
 
 _table = [None]*256

Modified: trunk/numpy/oldnumeric/misc.py
===================================================================
--- trunk/numpy/oldnumeric/misc.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/misc.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -2,9 +2,9 @@
 
 
 __all__ = ['load', 'sort', 'copy_reg', 'clip', 'putmask', 'Unpickler', 'rank',
-           'sign', 'shape', 'types', 
+           'sign', 'shape', 'types', 'allclose', 'size',
            'argmax', 'choose', 'swapaxes', 'array_str',
-           'pi', 'math', 'compress', 'concatenate'
+           'pi', 'math', 'compress', 'concatenate',
            'around', 'vdot', 'transpose', 'array2string', 'diagonal',
            'searchsorted', 'put', 'fromfunction', 'copy', 'resize',
            'array_repr', 'e', 'argmin', 'StringIO', 'pickle', 'average',

Modified: trunk/numpy/oldnumeric/mlab.py
===================================================================
--- trunk/numpy/oldnumeric/mlab.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/mlab.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -1,11 +1,7 @@
 # This module is for compatibility only.  All functions are defined elsewhere.
 
-from numpy.oldnumeric import *
+__all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle', 'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort', 'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud', 'max', 'blackman', 'corrcoef', 'bartlett', 'eye', 'squeeze', 'sinc', 'tri', 'cov', 'svd', 'min', 'median', 'fliplr', 'eig', 'mean']
 
-__all__ = numpy.oldnumeric.__all__
-
-__all__ += ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle', 'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort', 'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud', 'max', 'blackman', 'corrcoef', 'bartlett', 'eye', 'squeeze', 'sinc', 'tri', 'cov', 'svd', 'min', 'median', 'fliplr', 'eig', 'mean']
-
 import linear_algebra as LinearAlgebra
 import random_array as RandomArray
 from numpy import tril, trapz as _Ntrapz, hanning, rot90, triu, diff, \
@@ -69,4 +65,32 @@
 def corrcoef(x, y=None):
     return _Ncorrcoef(x,y,0,0)
 
+from compat import *
+from functions import *
+from precision import *
+from ufuncs import *
+from misc import *
 
+import compat
+import precision
+import functions
+import misc
+import ufuncs
+
+import numpy
+__version__ = numpy.__version__
+del numpy
+
+__all__ += ['__version__']
+__all__ += compat.__all__
+__all__ += precision.__all__
+__all__ += functions.__all__
+__all__ += ufuncs.__all__
+__all__ += misc.__all__
+        
+del compat
+del functions
+del precision
+del ufuncs
+del misc
+

Modified: trunk/numpy/oldnumeric/precision.py
===================================================================
--- trunk/numpy/oldnumeric/precision.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/precision.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -1,14 +1,16 @@
-# Lifted from Precision.py.  This is for compatibility only.  Notice that the
-#  capitalized names have their old character strings
+# Lifted from Precision.py.  This is for compatibility only.
+#
+#  The character strings are still for "new" NumPy
+#   which is the only Incompatibility with Numeric
 
 __all__ = ['Character', 'Complex', 'Float', 
            'PrecisionError', 'PyObject', 'Int', 'UInt',
            'UnsignedInteger', 'string', 'typecodes', 'zeros']
 
 import string
-from olddefaults import zeros
+from functions import zeros
 
-typecodes = {'Character':'c', 'Integer':'1sil', 'UnsignedInteger':'bwu', 'Float':'fd', 'Complex':'FD'}
+typecodes = {'Character':'c', 'Integer':'bhil', 'UnsignedInteger':'BHI', 'Float':'fd', 'Complex':'FD'}
 
 def _get_precisions(typecodes):
     lst = []

Modified: trunk/numpy/oldnumeric/typeconv.py
===================================================================
--- trunk/numpy/oldnumeric/typeconv.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/typeconv.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -1,5 +1,5 @@
 
-__all__ = ['oldtype2dtype', 'convtypecode']
+__all__ = ['oldtype2dtype', 'convtypecode', 'convtypecode2']
 
 import numpy as N
 
@@ -22,7 +22,15 @@
 def convtypecode(typecode, dtype=None):
     if dtype is None:
         try:
-            dtype = oldtype2dtype[typecode]
+            return oldtype2dtype[typecode]
         except:
-            dtype = N.dtype(typecode)
-    return dtype
+            return N.dtype(typecode)
+
+def convtypecode2(typecode, dtype=None):
+    if typecode is None and dtype is None:
+        return None
+    elif dtype is None:
+        try:
+            return oldtype2dtype[typecode]
+        except:
+            return N.dtype(typecode)

Modified: trunk/numpy/oldnumeric/ufuncs.py
===================================================================
--- trunk/numpy/oldnumeric/ufuncs.py	2006-08-05 02:04:29 UTC (rev 2961)
+++ trunk/numpy/oldnumeric/ufuncs.py	2006-08-05 06:44:20 UTC (rev 2962)
@@ -1,11 +1,12 @@
 __all__ = ['less', 'cosh', 'arcsinh', 'add', 'ceil', 'arctan2', 'floor_divide',
            'fmod', 'hypot', 'logical_and', 'power', 'sinh', 'remainder', 'cos',
-           'equal', 'arccos', 'less_equal', 'divide', 'bitwise_or', 'bitwise_and',
-           'logical_xor', 'log', 'subtract', 'invert', 'negative', 'log10', 'arcsin',
-           'arctanh', 'logical_not', 'not_equal', 'tanh', 'true_divide', 'maximum',
-           'arccosh', 'logical_or', 'minimum', 'conjugate', 'tan', 'greater', 'bitwise_xor',
-           'fabs', 'floor', 'sqrt', 'arctan', 'right_shift', 'absolute', 'sin',
-           'multiply', 'greater_equal', 'left_shift', 'exp']
+           'equal', 'arccos', 'less_equal', 'divide', 'bitwise_or',
+           'bitwise_and', 'logical_xor', 'log', 'subtract', 'invert',
+           'negative', 'log10', 'arcsin', 'arctanh', 'logical_not',
+           'not_equal', 'tanh', 'true_divide', 'maximum', 'arccosh',
+           'logical_or', 'minimum', 'conjugate', 'tan', 'greater',
+           'bitwise_xor', 'fabs', 'floor', 'sqrt', 'arctan', 'right_shift',
+           'absolute', 'sin', 'multiply', 'greater_equal', 'left_shift', 'exp']
 
 from numpy import less, cosh, arcsinh, add, ceil, arctan2, floor_divide, \
      fmod, hypot, logical_and, power, sinh, remainder, cos, \



More information about the Numpy-svn mailing list