summaryrefslogtreecommitdiff
path: root/numpy/oldnumeric
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/oldnumeric')
-rw-r--r--numpy/oldnumeric/__init__.py3
-rw-r--r--numpy/oldnumeric/fft.py21
-rw-r--r--numpy/oldnumeric/functions.py18
-rw-r--r--numpy/oldnumeric/ma.py10
-rw-r--r--numpy/oldnumeric/matrix.py6
-rw-r--r--numpy/oldnumeric/misc.py4
-rw-r--r--numpy/oldnumeric/mlab.py34
-rw-r--r--numpy/oldnumeric/precision.py10
-rw-r--r--numpy/oldnumeric/typeconv.py16
-rw-r--r--numpy/oldnumeric/ufuncs.py13
10 files changed, 92 insertions, 43 deletions
diff --git a/numpy/oldnumeric/__init__.py b/numpy/oldnumeric/__init__.py
index ced329913..dbf4298c5 100644
--- a/numpy/oldnumeric/__init__.py
+++ b/numpy/oldnumeric/__init__.py
@@ -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 compat import *
from functions import *
from precision import *
from ufuncs import *
+from misc import *
import compat
import precision
diff --git a/numpy/oldnumeric/fft.py b/numpy/oldnumeric/fft.py
new file mode 100644
index 000000000..67f30c750
--- /dev/null
+++ b/numpy/oldnumeric/fft.py
@@ -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
diff --git a/numpy/oldnumeric/functions.py b/numpy/oldnumeric/functions.py
index 60cce30c3..4c09dfa16 100644
--- a/numpy/oldnumeric/functions.py
+++ b/numpy/oldnumeric/functions.py
@@ -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 @@ def empty(shape, typecode='l', dtype=None):
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 @@ def reshape(a, shape):
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):
diff --git a/numpy/oldnumeric/ma.py b/numpy/oldnumeric/ma.py
index 15f23ff34..c78fcc200 100644
--- a/numpy/oldnumeric/ma.py
+++ b/numpy/oldnumeric/ma.py
@@ -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
diff --git a/numpy/oldnumeric/matrix.py b/numpy/oldnumeric/matrix.py
index d0a3b888b..2b3842c8d 100644
--- a/numpy/oldnumeric/matrix.py
+++ b/numpy/oldnumeric/matrix.py
@@ -4,13 +4,11 @@ __all__ = ['UserArray', 'squeeze', 'Matrix', 'asarray', 'dot', 'k', 'Numeric', '
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
+from numpy import matrix as Matrix, squeeze
# Hidden names that will be the same.
diff --git a/numpy/oldnumeric/misc.py b/numpy/oldnumeric/misc.py
index ee0c0e168..c0ccbc7ae 100644
--- a/numpy/oldnumeric/misc.py
+++ b/numpy/oldnumeric/misc.py
@@ -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',
diff --git a/numpy/oldnumeric/mlab.py b/numpy/oldnumeric/mlab.py
index 409238e57..5ef48d61a 100644
--- a/numpy/oldnumeric/mlab.py
+++ b/numpy/oldnumeric/mlab.py
@@ -1,10 +1,6 @@
# This module is for compatibility only. All functions are defined elsewhere.
-from numpy.oldnumeric import *
-
-__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']
+__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
@@ -69,4 +65,32 @@ def cov(m, y=None, rowvar=0, bias=0):
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
diff --git a/numpy/oldnumeric/precision.py b/numpy/oldnumeric/precision.py
index 82bcfe2e1..8a242f023 100644
--- a/numpy/oldnumeric/precision.py
+++ b/numpy/oldnumeric/precision.py
@@ -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 = []
diff --git a/numpy/oldnumeric/typeconv.py b/numpy/oldnumeric/typeconv.py
index 850ea621e..ba036a35d 100644
--- a/numpy/oldnumeric/typeconv.py
+++ b/numpy/oldnumeric/typeconv.py
@@ -1,5 +1,5 @@
-__all__ = ['oldtype2dtype', 'convtypecode']
+__all__ = ['oldtype2dtype', 'convtypecode', 'convtypecode2']
import numpy as N
@@ -22,7 +22,15 @@ oldtype2dtype = {'1': N.dtype(N.byte),
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)
diff --git a/numpy/oldnumeric/ufuncs.py b/numpy/oldnumeric/ufuncs.py
index 163be5260..083a5ed66 100644
--- a/numpy/oldnumeric/ufuncs.py
+++ b/numpy/oldnumeric/ufuncs.py
@@ -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, \