diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 22:37:16 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 22:37:16 +0000 |
commit | 5cfcf93bf09c3a78654099ddcb3b7b184e8d4615 (patch) | |
tree | 2ba7ac321aa765f08bc2413f178fd74d4eb8c1ff /numpy/lib | |
parent | 490712cd35dcecfc9423de4bde0b29cb012dda25 (diff) | |
download | numpy-5cfcf93bf09c3a78654099ddcb3b7b184e8d4615.tar.gz |
More fixes...
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/__init__.py | 2 | ||||
-rw-r--r-- | numpy/lib/function_base.py | 1 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 5 | ||||
-rw-r--r-- | numpy/lib/tests/test_getlimits.py | 4 | ||||
-rw-r--r-- | numpy/lib/tests/test_index_tricks.py | 4 | ||||
-rw-r--r-- | numpy/lib/tests/test_polynomial.py | 4 | ||||
-rw-r--r-- | numpy/lib/tests/test_shape_base.py | 5 | ||||
-rw-r--r-- | numpy/lib/tests/test_twodim_base.py | 4 | ||||
-rw-r--r-- | numpy/lib/tests/test_type_check.py | 5 | ||||
-rw-r--r-- | numpy/lib/tests/test_ufunclike.py | 10 | ||||
-rw-r--r-- | numpy/lib/type_check.py | 7 | ||||
-rw-r--r-- | numpy/lib/ufunclike.py | 22 |
12 files changed, 24 insertions, 49 deletions
diff --git a/numpy/lib/__init__.py b/numpy/lib/__init__.py index b77d85a96..13c5ec10b 100644 --- a/numpy/lib/__init__.py +++ b/numpy/lib/__init__.py @@ -14,8 +14,6 @@ from polynomial import * from machar import * from getlimits import * import convertcode -del nt - from utils import * __all__ = filter(lambda s:not s.startswith('_'),dir()) diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index bfaa90a94..71d46e843 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -24,7 +24,6 @@ from type_check import ScalarType from shape_base import atleast_1d from twodim_base import diag from _compiled_base import digitize, bincount, _insert -from ufunclike import sign #end Fernando's utilities diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 37d3db1bf..41cdf45b4 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -3,8 +3,9 @@ import sys from numpy.testing import * set_package_path() -import numpy.base;reload(numpy.base) -from numpy.base import * +import numpy.lib;reload(numpy.lib) +from numpy.lib import * +from numpy.core import * del sys.path[0] class test_any(ScipyTestCase): diff --git a/numpy/lib/tests/test_getlimits.py b/numpy/lib/tests/test_getlimits.py index 5e8706895..f70081518 100644 --- a/numpy/lib/tests/test_getlimits.py +++ b/numpy/lib/tests/test_getlimits.py @@ -3,8 +3,8 @@ from numpy.testing import * set_package_path() -import numpy.base;reload(numpy.base) -from numpy.base.getlimits import finfo +import numpy.lib;reload(numpy.lib) +from numpy.lib.getlimits import finfo from numpy import single,double,longdouble restore_path() diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index c5091909e..13d565b4c 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -1,8 +1,8 @@ from numpy.testing import * set_package_path() -import numpy.base;reload(numpy.base) -from numpy.base import * +import numpy.lib;reload(numpy.lib) +from numpy.lib import * restore_path() class test_grid(ScipyTestCase): diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index d37e8b6b9..dac4d866f 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -1,6 +1,6 @@ """ ->>> import numpy.base as nx ->>> from numpy.base.polynomial import poly1d, polydiv +>>> import numpy.core as nx +>>> from numpy.lib.polynomial import poly1d, polydiv >>> p = poly1d([1.,2,3]) >>> p diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index 175bc8584..11cf8fc91 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -1,8 +1,9 @@ from numpy.testing import * set_package_path() -import numpy.base; -from numpy.base import * +import numpy.lib; +from numpy.lib import * +from numpy.core import * restore_path() class test_apply_along_axis(ScipyTestCase): diff --git a/numpy/lib/tests/test_twodim_base.py b/numpy/lib/tests/test_twodim_base.py index 329a23f5b..1ed309f7c 100644 --- a/numpy/lib/tests/test_twodim_base.py +++ b/numpy/lib/tests/test_twodim_base.py @@ -4,8 +4,8 @@ from numpy.testing import * set_package_path() -import numpy.base;reload(numpy.base) -from numpy.base import * +import numpy.lib;reload(numpy.lib) +from numpy.lib import * restore_path() ################################################## diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py index e84d86e0c..5d026a9f9 100644 --- a/numpy/lib/tests/test_type_check.py +++ b/numpy/lib/tests/test_type_check.py @@ -3,8 +3,9 @@ import sys from numpy.testing import * set_package_path() -import numpy.base;reload(numpy.base);reload(numpy.base.type_check) -from numpy.base import * +import numpy.lib;reload(numpy.lib);reload(numpy.lib.type_check) +from numpy.lib import * +from numpy.core import * restore_path() def assert_all(x): diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py index f7313526d..5934aa23d 100644 --- a/numpy/lib/tests/test_ufunclike.py +++ b/numpy/lib/tests/test_ufunclike.py @@ -1,6 +1,6 @@ """ ->>> import numpy.base as nx ->>> import numpy.base.ufunclike as U +>>> import numpy.core as nx +>>> import numpy.lib.ufunclike as U Test fix: >>> a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]]) @@ -21,8 +21,8 @@ Test isposinf, isneginf, sign array([True, False, False, False, False, False], dtype=bool) >>> U.isneginf(a) array([False, True, False, False, False, False], dtype=bool) ->>> U.sign(a) -array([ 1, -1, 0, 0, 1, -1]) +>>> nx.sign(a) +array([ 1., -1., 0., 0., 1., -1.]) Same thing with an output array: >>> y = nx.zeros(a.shape, bool) @@ -34,7 +34,7 @@ array([True, False, False, False, False, False], dtype=bool) array([False, True, False, False, False, False], dtype=bool) >>> y array([False, True, False, False, False, False], dtype=bool) ->>> U.sign(a, y) +>>> nx.sign(a, y) array([True, True, False, False, True, True], dtype=bool) >>> y array([True, True, False, False, True, True], dtype=bool) diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 214e3504a..28f01cbc7 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -1,7 +1,6 @@ ## Automatically adapted for numpy Sep 19, 2005 by convertcode.py __all__ = ['iscomplexobj','isrealobj','imag','iscomplex', - 'isscalar', 'isreal','nan_to_num','real','real_if_close', 'typename','asfarray','mintypecode','asscalar', 'common_type'] @@ -51,12 +50,6 @@ def asfarray(a, dtype=_nx.float_): a = asarray(a,dtype=dtype) return a -def isscalar(num): - if isinstance(num, _nx.generic): - return True - else: - return type(num) in ScalarType - def real(val): return asarray(val).real diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py index ee5d918d6..c291c7e9c 100644 --- a/numpy/lib/ufunclike.py +++ b/numpy/lib/ufunclike.py @@ -2,11 +2,11 @@ Module of functions that are like ufuncs in acting on arrays and optionally storing results in an output array. """ -__all__ = ['fix', 'isneginf', 'isposinf', 'sign', 'log2'] +__all__ = ['fix', 'isneginf', 'isposinf', 'log2'] import numpy.core.numeric as nx from numpy.core.numeric import asarray, empty, empty_like, isinf, signbit, zeros -import umath +import numpy.core.umath as umath def fix(x, y=None): """ Round x to nearest integer towards zero. @@ -43,24 +43,6 @@ def isneginf(x, y=None): umath.logical_and(isinf(x), signbit(x), y) return y -def sign(x, y=None): - """sign(x) gives an array with shape of x with elexents defined by sign - function: where x is less than 0 return -1, where x greater than 0, a=1, - elsewhere a=0. - """ - x = asarray(x) - if y is None: - y = zeros(x.shape, dtype=nx.int_) - if x.ndim == 0: - if x < 0: - y -= 1 - elif x > 0: - y += 1 - else: - y[x<0] = -1 - y[x>0] = 1 - return y - _log2 = umath.log(2) def log2(x, y=None): """Returns the base 2 logarithm of x |