diff options
Diffstat (limited to 'numpy/oldnumeric')
-rw-r--r-- | numpy/oldnumeric/__init__.py | 21 | ||||
-rw-r--r-- | numpy/oldnumeric/compat.py | 166 | ||||
-rw-r--r-- | numpy/oldnumeric/olddefaults.py | 45 | ||||
-rw-r--r-- | numpy/oldnumeric/setup.py | 8 | ||||
-rw-r--r-- | numpy/oldnumeric/tests/test_oldnumeric.py | 86 |
5 files changed, 0 insertions, 326 deletions
diff --git a/numpy/oldnumeric/__init__.py b/numpy/oldnumeric/__init__.py deleted file mode 100644 index 439cfe907..000000000 --- a/numpy/oldnumeric/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ - -from numpy import * -from compat import * -from olddefaults import * - -import numpy -import compat -import olddefaults - -__version__ = numpy.__version__ - -__all__ = ['__version__'] -__all__ += numpy.__all__ -__all__ += compat.__all__ -for name in olddefaults.__all__: - if name not in __all__: - __all__.append(name) - -del numpy -del compat -del olddefaults diff --git a/numpy/oldnumeric/compat.py b/numpy/oldnumeric/compat.py deleted file mode 100644 index b5d31334e..000000000 --- a/numpy/oldnumeric/compat.py +++ /dev/null @@ -1,166 +0,0 @@ -# Compatibility module containing deprecated names - -__all__ = ['NewAxis', - 'UFuncType', 'UfuncType', 'ArrayType', 'arraytype', - 'LittleEndian', 'Bool', - 'Character', 'UnsignedInt8', 'UnsignedInt16', 'UnsignedInt', 'UInt', - 'UInt8','UInt16','UInt32', 'UnsignedInt32', 'UnsignedInteger', - # UnsignedInt64 and Unsigned128 added below if possible - # same for Int64 and Int128, Float128, and Complex128 - 'Int8', 'Int16', 'Int32', - 'Int0', 'Int', 'Float0', 'Float', 'Complex0', 'Complex', - 'PyObject', 'Float32', 'Float64', 'Float16', 'Float8', - 'Complex32', 'Complex64', 'Complex8', 'Complex16', - 'sarray', 'arrayrange', 'cross_correlate', - 'matrixmultiply', 'outerproduct', 'innerproduct', - 'cross_product', 'array_constructor', - 'DumpArray', 'LoadArray', 'multiarray', 'divide_safe', - # from cPickle - 'dump', 'dumps' - ] - -import numpy.core.multiarray as mu -import numpy.core.umath as um -import numpy.core.numerictypes as nt -from numpy.core.numeric import asarray, array, asanyarray, \ - correlate, outer, concatenate, cross -from numpy.core.umath import sign, absolute, multiply -import numpy.core.numeric as _nx -import sys -_dt_ = nt.sctype2char - -import types - -from cPickle import dump, dumps - -multiarray = mu - -def sarray(a, dtype=None, copy=False): - return array(a, dtype, copy) - -#Use this to add a new axis to an array -#compatibility only -NewAxis = None - -#deprecated -UFuncType = type(um.sin) -UfuncType = type(um.sin) -ArrayType = mu.ndarray -arraytype = mu.ndarray - -LittleEndian = (sys.byteorder == 'little') - -# backward compatible names from old Precision.py - -Character = 'S1' -UnsignedInt8 = _dt_(nt.uint8) -UInt8 = UnsignedInt8 -UnsignedInt16 = _dt_(nt.uint16) -UInt16 = UnsignedInt16 -UnsignedInt32 = _dt_(nt.uint32) -UInt32 = UnsignedInt32 -UnsignedInt = _dt_(nt.uint) -UInt = UnsignedInt - -try: - UnsignedInt64 = _dt_(nt.uint64) -except AttributeError: - pass -else: - UInt64 = UnsignedInt64 - __all__ += ['UnsignedInt64', 'UInt64'] -try: - UnsignedInt128 = _dt_(nt.uint128) -except AttributeError: - pass -else: - UInt128 = UnsignedInt128 - __all__ += ['UnsignedInt128','UInt128'] - -Int8 = _dt_(nt.int8) -Int16 = _dt_(nt.int16) -Int32 = _dt_(nt.int32) - -try: - Int64 = _dt_(nt.int64) -except AttributeError: - pass -else: - __all__ += ['Int64'] - -try: - Int128 = _dt_(nt.int128) -except AttributeError: - pass -else: - __all__ += ['Int128'] - -Bool = _dt_(bool) -Int0 = _dt_(int) -Int = _dt_(int) -Float0 = _dt_(float) -Float = _dt_(float) -Complex0 = _dt_(complex) -Complex = _dt_(complex) -PyObject = _dt_(nt.object_) -Float32 = _dt_(nt.float32) -Float64 = _dt_(nt.float64) - -Float16='f' -Float8='f' -UnsignedInteger='L' -Complex8='F' -Complex16='F' - -try: - Float128 = _dt_(nt.float128) -except AttributeError: - pass -else: - __all__ += ['Float128'] - -Complex32 = _dt_(nt.complex64) -Complex64 = _dt_(nt.complex128) - -try: - Complex128 = _dt_(nt.complex256) -except AttributeError: - pass -else: - __all__ += ['Complex128'] - - -from numpy import deprecate - -# backward compatibility -arrayrange = deprecate(mu.arange, 'arrayrange', 'arange') -cross_correlate = deprecate(correlate, 'cross_correlate', 'correlate') -cross_product = deprecate(cross, 'cross_product', 'cross') -divide_safe = deprecate(um.divide, 'divide_safe', 'divide') - -# deprecated names -matrixmultiply = deprecate(mu.dot, 'matrixmultiply', 'dot') -outerproduct = deprecate(outer, 'outerproduct', 'outer') -innerproduct = deprecate(mu.inner, 'innerproduct', 'inner') - - - -def DumpArray(m, fp): - m.dump(fp) - -def LoadArray(fp): - import cPickle - return cPickle.load(fp) - -def array_constructor(shape, typecode, thestr, Endian=LittleEndian): - if typecode == "O": - x = array(thestr, "O") - else: - x = mu.fromstring(thestr, typecode) - x.shape = shape - if LittleEndian != Endian: - return x.byteswap(TRUE) - else: - return x - - diff --git a/numpy/oldnumeric/olddefaults.py b/numpy/oldnumeric/olddefaults.py deleted file mode 100644 index 356f5f00c..000000000 --- a/numpy/oldnumeric/olddefaults.py +++ /dev/null @@ -1,45 +0,0 @@ -__all__ = ['ones', 'empty', 'identity', 'zeros', 'eye', 'tri'] - -import numpy.core.multiarray as mu -import numpy.core.numeric as nn - -def ones(shape, dtype=int, order='C'): - """ones(shape, dtype=int) returns an array of the given - dimensions which is initialized to all ones. - """ - a = mu.empty(shape, dtype, order) - a.fill(1) - return a - -def zeros(shape, dtype=int, order='C'): - """zeros(shape, dtype=int) returns an array of the given - dimensions which is initialized to all zeros - """ - return mu.zeros(shape, dtype, order) - -def identity(n,dtype=int): - """identity(n) returns the identity 2-d array of shape n x n. - """ - return nn.identity(n, dtype) - -def eye(N, M=None, k=0, dtype=int): - """ eye returns a N-by-M 2-d array where the k-th diagonal is all ones, - and everything else is zeros. - """ - if M is None: M = N - m = nn.equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k) - if m.dtype != dtype: - return m.astype(dtype) - -def tri(N, M=None, k=0, dtype=int): - """ returns a N-by-M array where all the diagonals starting from - lower left corner up to the k-th are all ones. - """ - if M is None: M = N - m = nn.greater_equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k) - if m.dtype != dtype: - return m.astype(dtype) - -def empty(shape, dtype=int, order='C'): - return mu.empty(shape, dtype, order) - diff --git a/numpy/oldnumeric/setup.py b/numpy/oldnumeric/setup.py deleted file mode 100644 index 9526e51b4..000000000 --- a/numpy/oldnumeric/setup.py +++ /dev/null @@ -1,8 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - return Configuration('oldnumeric',parent_package,top_path) - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(**configuration(top_path='').todict()) diff --git a/numpy/oldnumeric/tests/test_oldnumeric.py b/numpy/oldnumeric/tests/test_oldnumeric.py deleted file mode 100644 index 14d5dfd84..000000000 --- a/numpy/oldnumeric/tests/test_oldnumeric.py +++ /dev/null @@ -1,86 +0,0 @@ -from numpy.testing import * - -from numpy import array -from numpy.oldnumeric import * -from numpy.core.numeric import float32, float64, complex64, complex128, int8, \ - int16, int32, int64, uint, uint8, uint16, uint32, uint64 - -class test_oldtypes(NumPyTestCase): - def check_oldtypes(self, level=1): - a1 = array([0,1,0], Float) - a2 = array([0,1,0], float) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Float8) - a2 = array([0,1,0], float) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Float16) - a2 = array([0,1,0], float) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Float32) - a2 = array([0,1,0], float32) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Float64) - a2 = array([0,1,0], float64) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Complex) - a2 = array([0,1,0], complex) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Complex8) - a2 = array([0,1,0], complex) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Complex16) - a2 = array([0,1,0], complex) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Complex32) - a2 = array([0,1,0], complex64) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Complex64) - a2 = array([0,1,0], complex128) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Int) - a2 = array([0,1,0], int) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Int8) - a2 = array([0,1,0], int8) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Int16) - a2 = array([0,1,0], int16) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Int32) - a2 = array([0,1,0], int32) - assert_array_equal(a1, a2) - a1 = array([0,1,0], Int64) - a2 = array([0,1,0], int64) - assert_array_equal(a1, a2) - a1 = array([0,1,0], UnsignedInt) - a2 = array([0,1,0], UnsignedInteger) - a3 = array([0,1,0], uint) - assert_array_equal(a1, a3) - assert_array_equal(a2, a3) - a1 = array([0,1,0], UInt8) - a2 = array([0,1,0], UnsignedInt8) - a3 = array([0,1,0], uint8) - assert_array_equal(a1, a3) - assert_array_equal(a2, a3) - a1 = array([0,1,0], UInt16) - a2 = array([0,1,0], UnsignedInt16) - a3 = array([0,1,0], uint16) - assert_array_equal(a1, a3) - assert_array_equal(a2, a3) - a1 = array([0,1,0], UInt32) - a2 = array([0,1,0], UnsignedInt32) - a3 = array([0,1,0], uint32) - assert_array_equal(a1, a3) - assert_array_equal(a2, a3) - a1 = array([0,1,0], UInt64) - a2 = array([0,1,0], UnsignedInt64) - a3 = array([0,1,0], uint64) - assert_array_equal(a1, a3) - assert_array_equal(a2, a3) - a1 = array([0,1,0], Bool) - a2 = array([0,1,0], bool) - assert_array_equal(a1, a2) - - -if __name__ == "__main__": - NumPyTest().run() |