diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 19:00:27 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 19:00:27 +0000 |
commit | e706c7d92c4ee41e8e995fb3838bd0931b57efb5 (patch) | |
tree | 015a057d49422774e49ed211a37c14105d03a713 /numpy/core | |
parent | c14d4fe25cb5cd482369734dd487ac8f376851c9 (diff) | |
download | numpy-e706c7d92c4ee41e8e995fb3838bd0931b57efb5.tar.gz |
Changed all references to scipy to numpy
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/__init__.py | 4 | ||||
-rw-r--r-- | numpy/core/arrayprint.py | 2 | ||||
-rw-r--r-- | numpy/core/blasdot/_dotblas.c | 6 | ||||
-rw-r--r-- | numpy/core/code_generators/array_api_order.txt | 2 | ||||
-rw-r--r-- | numpy/core/code_generators/generate_array_api.py | 2 | ||||
-rw-r--r-- | numpy/core/code_generators/generate_ufunc_api.py | 2 | ||||
-rw-r--r-- | numpy/core/ma.py | 10 | ||||
-rw-r--r-- | numpy/core/matrix.py | 2 | ||||
-rw-r--r-- | numpy/core/src/_sortmodule.c.src | 2 | ||||
-rw-r--r-- | numpy/core/src/arraymethods.c | 2 | ||||
-rw-r--r-- | numpy/core/src/arrayobject.c | 26 | ||||
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 18 | ||||
-rw-r--r-- | numpy/core/src/scalarmathmodule.c.src | 4 | ||||
-rw-r--r-- | numpy/core/src/scalartypes.inc.src | 6 | ||||
-rw-r--r-- | numpy/core/src/ufuncobject.c | 2 | ||||
-rw-r--r-- | numpy/core/src/umathmodule.c.src | 4 | ||||
-rw-r--r-- | numpy/core/tests/test_ma.py | 132 | ||||
-rw-r--r-- | numpy/core/tests/test_matrix.py | 10 | ||||
-rw-r--r-- | numpy/core/tests/test_records.py | 8 | ||||
-rw-r--r-- | numpy/core/tests/test_umath.py | 4 |
20 files changed, 124 insertions, 124 deletions
diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py index 0c0c158df..18256f03e 100644 --- a/numpy/core/__init__.py +++ b/numpy/core/__init__.py @@ -1,6 +1,6 @@ from info import __doc__ -from scipy.core_version import version as __version__ +from numpy.core_version import version as __version__ import multiarray import umath @@ -33,5 +33,5 @@ from utils import * __all__ = filter(lambda s:not s.startswith('_'),dir()) -from scipy.testing import ScipyTest +from numpy.testing import ScipyTest test = ScipyTest().test diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 6a5e4b23b..76784473e 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -10,7 +10,7 @@ __all__ = ["set_summary", "summary_off", "set_precision", "set_line_width", # last revision: 1996-3-13 # modified by Jim Hugunin 1997-3-3 for repr's and str's (and other details) # and by Perry Greenfield 2000-4-1 for numarray -# and by Travis Oliphant 2005-8-22 for scipy.base +# and by Travis Oliphant 2005-8-22 for numpy.base import sys import numeric as _gen diff --git a/numpy/core/blasdot/_dotblas.c b/numpy/core/blasdot/_dotblas.c index 648ea397f..51d9fa1a2 100644 --- a/numpy/core/blasdot/_dotblas.c +++ b/numpy/core/blasdot/_dotblas.c @@ -1,8 +1,8 @@ static char module_doc[] = -"This module provides a BLAS optimized\nmatrix multiply, inner product and dot for scipy arrays"; +"This module provides a BLAS optimized\nmatrix multiply, inner product and dot for numpy arrays"; #include "Python.h" -#include "scipy/arrayobject.h" +#include "numpy/arrayobject.h" #ifndef CBLAS_HEADER #define CBLAS_HEADER "cblas.h" #endif @@ -128,7 +128,7 @@ dotblas_restoredot(PyObject *dummy, PyObject *args) } -static char doc_matrixproduct[] = "matrixproduct(a,b)\nReturns the dot product of a and b for arrays of floating point types.\nLike the generic scipy equivalent the product sum is over\nthe last dimension of a and the second-to-last dimension of b.\nNB: The first argument is not conjugated."; +static char doc_matrixproduct[] = "matrixproduct(a,b)\nReturns the dot product of a and b for arrays of floating point types.\nLike the generic numpy equivalent the product sum is over\nthe last dimension of a and the second-to-last dimension of b.\nNB: The first argument is not conjugated."; static PyObject * dotblas_matrixproduct(PyObject *dummy, PyObject *args) diff --git a/numpy/core/code_generators/array_api_order.txt b/numpy/core/code_generators/array_api_order.txt index 154373592..74ab84f6a 100644 --- a/numpy/core/code_generators/array_api_order.txt +++ b/numpy/core/code_generators/array_api_order.txt @@ -1,4 +1,4 @@ -# The functions in the scipy_core C API +# The functions in the numpy_core C API # They are defined here so that the order is set. PyArray_SetNumericOps PyArray_GetNumericOps diff --git a/numpy/core/code_generators/generate_array_api.py b/numpy/core/code_generators/generate_array_api.py index e4ec8b2e1..6d2bce00d 100644 --- a/numpy/core/code_generators/generate_array_api.py +++ b/numpy/core/code_generators/generate_array_api.py @@ -51,7 +51,7 @@ static void **PyArray_API=NULL; static int import_array(void) { - PyObject *numpy = PyImport_ImportModule("scipy.base.multiarray"); + PyObject *numpy = PyImport_ImportModule("numpy.base.multiarray"); PyObject *c_api = NULL; if (numpy == NULL) return -1; c_api = PyObject_GetAttrString(numpy, "_ARRAY_API"); diff --git a/numpy/core/code_generators/generate_ufunc_api.py b/numpy/core/code_generators/generate_ufunc_api.py index 59c808e36..6c9307058 100644 --- a/numpy/core/code_generators/generate_ufunc_api.py +++ b/numpy/core/code_generators/generate_ufunc_api.py @@ -31,7 +31,7 @@ static void **PyUFunc_API=NULL; static int import_ufunc(void) { - PyObject *numpy = PyImport_ImportModule("scipy.base.umath"); + PyObject *numpy = PyImport_ImportModule("numpy.base.umath"); PyObject *c_api = NULL; if (numpy == NULL) return -1; diff --git a/numpy/core/ma.py b/numpy/core/ma.py index 245351349..439c311ab 100644 --- a/numpy/core/ma.py +++ b/numpy/core/ma.py @@ -1,10 +1,10 @@ """MA: a facility for dealing with missing observations -MA is generally used as a scipy.array look-alike. +MA is generally used as a numpy.array look-alike. by Paul F. Dubois. Copyright 1999, 2000, 2001 Regents of the University of California. Released for unlimited redistribution. -Adapted for scipy_core 2005 by Travis Oliphant and +Adapted for numpy_core 2005 by Travis Oliphant and (mainly) Paul Dubois. """ import string, types, sys @@ -2015,7 +2015,7 @@ def argsort (x, axis = -1, fill_value=None): """Treating masked values as if they have the value fill_value, return sort indices for sorting along given axis. if fill_value is None, use get_fill_value(x) - Returns a scipy array. + Returns a numpy array. """ d = filled(x, fill_value) return oldnumeric.argsort(d, axis) @@ -2024,7 +2024,7 @@ def argmin (x, axis = -1, fill_value=None): """Treating masked values as if they have the value fill_value, return indices for minimum values along given axis. if fill_value is None, use get_fill_value(x). - Returns a scipy array if x has more than one dimension. + Returns a numpy array if x has more than one dimension. Otherwise, returns a scalar index. """ d = filled(x, fill_value) @@ -2034,7 +2034,7 @@ def argmax (x, axis = -1, fill_value=None): """Treating masked values as if they have the value fill_value, return sort indices for maximum along given axis. if fill_value is None, use -get_fill_value(x) if it exists. - Returns a scipy array if x has more than one dimension. + Returns a numpy array if x has more than one dimension. Otherwise, returns a scalar index. """ if fill_value is None: diff --git a/numpy/core/matrix.py b/numpy/core/matrix.py index 1c7ca7cca..0b064ddd7 100644 --- a/numpy/core/matrix.py +++ b/numpy/core/matrix.py @@ -200,7 +200,7 @@ class matrix(N.ndarray): return self.transpose() def getI(self): - from scipy.corelinalg import inv + from numpy.corelinalg import inv return matrix(inv(self)) A = property(getA, None, doc="base array") diff --git a/numpy/core/src/_sortmodule.c.src b/numpy/core/src/_sortmodule.c.src index 47c7520c1..8f40e47ee 100644 --- a/numpy/core/src/_sortmodule.c.src +++ b/numpy/core/src/_sortmodule.c.src @@ -24,7 +24,7 @@ #include "Python.h" -#include "scipy/arrayobject.h" +#include "numpy/arrayobject.h" #define PYA_QS_STACK 100 #define SMALL_QUICKSORT 15 diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c index 2b7a53042..2e5ea4ee4 100644 --- a/numpy/core/src/arraymethods.c +++ b/numpy/core/src/arraymethods.c @@ -864,7 +864,7 @@ array_reduce(PyArrayObject *self, PyObject *args) ret = PyTuple_New(3); if (ret == NULL) return NULL; - mod = PyImport_ImportModule("scipy.base._internal"); + mod = PyImport_ImportModule("numpy.base._internal"); if (mod == NULL) {Py_DECREF(ret); return NULL;} obj = PyObject_GetAttrString(mod, "_reconstruct"); Py_DECREF(mod); diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 72db76373..1d9e15976 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -3922,7 +3922,7 @@ array_ndim_get(PyArrayObject *self) static PyObject * array_flags_get(PyArrayObject *self) { - return PyObject_CallMethod(_scipy_internal, "flagsobj", "Oii", + return PyObject_CallMethod(_numpy_internal, "flagsobj", "Oii", self, self->flags, 0); } @@ -4648,9 +4648,9 @@ static char Arraytype__doc__[] = "A array object represents a multidimensional, homogeneous array\n" " of fixed-size items. An associated data-type-descriptor object\n" " details the data-type in an array (including byteorder and any\n" - " fields). An array can be constructed using the scipy.array\n" + " fields). An array can be constructed using the numpy.array\n" " command. Arrays are sequence, mapping and numeric objects.\n" - " More information is available in the scipy module and by looking\n" + " More information is available in the numpy module and by looking\n" " at the methods and attributes of an array.\n\n" " ndarray.__new__(subtype, shape=, dtype=int_, buffer=None, \n" " offset=0, strides=None, fortran=False)\n\n" @@ -4660,14 +4660,14 @@ static char Arraytype__doc__[] = " 2) If buffer is an object exporting the buffer interface, then\n" " all keywords are interpreted.\n" " The dtype parameter can be any object that can be interpreted \n" - " as a scipy.dtypedescr object.\n\n" + " as a numpy.dtypedescr object.\n\n" " No __init__ method is needed because the array is fully \n" " initialized after the __new__ method."; static PyTypeObject PyBigArray_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ - "scipy.bigndarray", /*tp_name*/ + "numpy.bigndarray", /*tp_name*/ sizeof(PyArrayObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ @@ -4733,7 +4733,7 @@ static PyTypeObject PyBigArray_Type = { static PyTypeObject PyArray_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ - "scipy.ndarray", /*tp_name*/ + "numpy.ndarray", /*tp_name*/ sizeof(PyArrayObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ }; @@ -6192,7 +6192,7 @@ PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to) /*********************** Element-wise Array Iterator ***********************/ -/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/ +/* Aided by Peter J. Verveer's nd_image package and numpy's arraymap ****/ /* and Python's array iterator ***/ @@ -6841,7 +6841,7 @@ static PyMemberDef iter_members[] = { static PyTypeObject PyArrayIter_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ - "scipy.flatiter", /* tp_name */ + "numpy.flatiter", /* tp_name */ sizeof(PyArrayIterObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ @@ -7543,7 +7543,7 @@ arraymapiter_dealloc(PyArrayMapIterObject *mit) static PyTypeObject PyArrayMapIter_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ - "scipy.mapiter", /* tp_name */ + "numpy.mapiter", /* tp_name */ sizeof(PyArrayIterObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ @@ -7821,7 +7821,7 @@ static PyMethodDef arraymultiter_methods[] = { static PyTypeObject PyArrayMultiIter_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ - "scipy.broadcast", /* tp_name */ + "numpy.broadcast", /* tp_name */ sizeof(PyArrayMultiIterObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ @@ -7996,7 +7996,7 @@ arraydescr_protocol_descr_get(PyArray_Descr *self) return res; } - return PyObject_CallMethod(_scipy_internal, "_array_descr", + return PyObject_CallMethod(_numpy_internal, "_array_descr", "O", self); } @@ -8134,7 +8134,7 @@ arraydescr_reduce(PyArray_Descr *self, PyObject *args) ret = PyTuple_New(3); if (ret == NULL) return NULL; - mod = PyImport_ImportModule("scipy.base.multiarray"); + mod = PyImport_ImportModule("numpy.base.multiarray"); if (mod == NULL) {Py_DECREF(ret); return NULL;} obj = PyObject_GetAttrString(mod, "dtypedescr"); Py_DECREF(mod); @@ -8424,7 +8424,7 @@ arraydescr_compare(PyArray_Descr *self, PyObject *other) static PyTypeObject PyArrayDescr_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ - "scipy.dtypedescr", /* tp_name */ + "numpy.dtypedescr", /* tp_name */ sizeof(PyArray_Descr), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 2cce9ad03..6c993b069 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -5,7 +5,7 @@ Original file Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu - Modified for scipy_core in 2005 + Modified for numpy_core in 2005 Travis E. Oliphant Assistant Professor at @@ -22,12 +22,12 @@ */ #define _MULTIARRAYMODULE -#include "scipy/arrayobject.h" +#include "numpy/arrayobject.h" #define PyAO PyArrayObject static PyObject *typeDict=NULL; /* Must be explicitly loaded */ -static PyObject *_scipy_internal=NULL; /* A Python module for callbacks */ +static PyObject *_numpy_internal=NULL; /* A Python module for callbacks */ static PyArray_Descr * @@ -3544,7 +3544,7 @@ _convert_from_commastring(PyObject *obj, int align) PyArray_Descr *res; if (!PyString_Check(obj)) return NULL; - listobj = PyObject_CallMethod(_scipy_internal, "_commastring", + listobj = PyObject_CallMethod(_numpy_internal, "_commastring", "O", obj); if (!listobj) return NULL; res = _convert_from_list(listobj, align, 0); @@ -3593,7 +3593,7 @@ then it will be checked for conformity and used directly. static PyArray_Descr * _use_fields_dict(PyObject *obj, int align) { - return (PyArray_Descr *)PyObject_CallMethod(_scipy_internal, + return (PyArray_Descr *)PyObject_CallMethod(_numpy_internal, "_usefields", "Oi", obj, align); } @@ -3734,7 +3734,7 @@ PyArray_DescrConverter2(PyObject *obj, PyArray_Descr **at) quite a flexible concept. This is the central code that converts Python objects to - Type-descriptor objects that are used throughout scipy. + Type-descriptor objects that are used throughout numpy. */ /* new reference in *at */ @@ -5492,9 +5492,9 @@ DL_EXPORT(void) initmultiarray(void) { if (set_typeinfo(d) != 0) goto err; - _scipy_internal = \ - PyImport_ImportModule("scipy.base._internal"); - if (_scipy_internal != NULL) return; + _numpy_internal = \ + PyImport_ImportModule("numpy.base._internal"); + if (_numpy_internal != NULL) return; err: /* Check for errors */ diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src index dc2c3c198..ec210d42e 100644 --- a/numpy/core/src/scalarmathmodule.c.src +++ b/numpy/core/src/scalarmathmodule.c.src @@ -4,8 +4,8 @@ NOT FINISHED */ -#include "scipy/arrayobject.h" -#include "scipy/ufuncobject.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" /**begin repeat diff --git a/numpy/core/src/scalartypes.inc.src b/numpy/core/src/scalartypes.inc.src index 629adbcf0..972b2424f 100644 --- a/numpy/core/src/scalartypes.inc.src +++ b/numpy/core/src/scalartypes.inc.src @@ -641,14 +641,14 @@ gentype_flags_get(PyObject *self) { static int flags=CONTIGUOUS | OWNDATA | FORTRAN | ALIGNED; - return PyObject_CallMethod(_scipy_internal, "flagsobj", "Oii", + return PyObject_CallMethod(_numpy_internal, "flagsobj", "Oii", self, flags, 1); } static PyObject * voidtype_flags_get(PyVoidScalarObject *self) { - return PyObject_CallMethod(_scipy_internal, "flagsobj", "Oii", + return PyObject_CallMethod(_numpy_internal, "flagsobj", "Oii", self, self->flags, 1); } @@ -1194,7 +1194,7 @@ gentype_reduce(PyObject *self, PyObject *args) if (PyObject_AsReadBuffer(self, (const void **)&buffer, &buflen)<0) { Py_DECREF(ret); return NULL; } - mod = PyImport_ImportModule("scipy.base.multiarray"); + mod = PyImport_ImportModule("numpy.base.multiarray"); if (mod == NULL) return NULL; obj = PyObject_GetAttrString(mod, "scalar"); Py_DECREF(mod); diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c index 47aad4828..1b5a5f31f 100644 --- a/numpy/core/src/ufuncobject.c +++ b/numpy/core/src/ufuncobject.c @@ -3119,7 +3119,7 @@ static char Ufunctype__doc__[] = static PyTypeObject PyUFunc_Type = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ - "scipy.ufunc", /*tp_name*/ + "numpy.ufunc", /*tp_name*/ sizeof(PyUFuncObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src index 5096f3361..dd140354b 100644 --- a/numpy/core/src/umathmodule.c.src +++ b/numpy/core/src/umathmodule.c.src @@ -1,9 +1,9 @@ /* -*- c -*- */ #include "Python.h" -#include "scipy/arrayobject.h" +#include "numpy/arrayobject.h" #define _UMATHMODULE -#include "scipy/ufuncobject.h" +#include "numpy/ufuncobject.h" #include "abstract.h" #include <math.h> diff --git a/numpy/core/tests/test_ma.py b/numpy/core/tests/test_ma.py index 884a4a277..5a6c95533 100644 --- a/numpy/core/tests/test_ma.py +++ b/numpy/core/tests/test_ma.py @@ -1,7 +1,7 @@ -import scipy +import numpy import types, time -from scipy.base.ma import * -from scipy.testing import ScipyTestCase, ScipyTest +from numpy.base.ma import * +from numpy.testing import ScipyTestCase, ScipyTest def eq(v,w): result = allclose(v,w) if not result: @@ -17,16 +17,16 @@ class test_ma(ScipyTestCase): self.setUp() def setUp (self): - x=scipy.array([1.,1.,1.,-2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.]) - y=scipy.array([5.,0.,3., 2., -1., -4., 0., -10., 10., 1., 0., 3.]) + x=numpy.array([1.,1.,1.,-2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.]) + y=numpy.array([5.,0.,3., 2., -1., -4., 0., -10., 10., 1., 0., 3.]) a10 = 10. m1 = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] m2 = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0 ,0, 1] xm = array(x, mask=m1) ym = array(y, mask=m2) - z = scipy.array([-.5, 0., .5, .8]) + z = numpy.array([-.5, 0., .5, .8]) zm = array(z, mask=[0,1,0,0]) - xf = scipy.where(m1, 1.e+20, x) + xf = numpy.where(m1, 1.e+20, x) s = x.shape xm.set_fill_value(1.e+20) self.d = (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) @@ -97,41 +97,41 @@ class test_ma(ScipyTestCase): self.failUnless(eq(x**2, xm**2)) self.failUnless(eq(abs(x)**2.5, abs(xm) **2.5)) self.failUnless(eq(x**y, xm**ym)) - self.failUnless(eq(scipy.add(x,y), add(xm, ym))) - self.failUnless(eq(scipy.subtract(x,y), subtract(xm, ym))) - self.failUnless(eq(scipy.multiply(x,y), multiply(xm, ym))) - self.failUnless(eq(scipy.divide(x,y), divide(xm, ym))) + self.failUnless(eq(numpy.add(x,y), add(xm, ym))) + self.failUnless(eq(numpy.subtract(x,y), subtract(xm, ym))) + self.failUnless(eq(numpy.multiply(x,y), multiply(xm, ym))) + self.failUnless(eq(numpy.divide(x,y), divide(xm, ym))) def check_testUfuncs1 (self): "Test various functions such as sin, cos." (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d - self.failUnless (eq(scipy.cos(x), cos(xm))) - self.failUnless (eq(scipy.cosh(x), cosh(xm))) - self.failUnless (eq(scipy.sin(x), sin(xm))) - self.failUnless (eq(scipy.sinh(x), sinh(xm))) - self.failUnless (eq(scipy.tan(x), tan(xm))) - self.failUnless (eq(scipy.tanh(x), tanh(xm))) - self.failUnless (eq(scipy.sqrt(abs(x)), sqrt(xm))) - self.failUnless (eq(scipy.log(abs(x)), log(xm))) - self.failUnless (eq(scipy.log10(abs(x)), log10(xm))) - self.failUnless (eq(scipy.exp(x), exp(xm))) - self.failUnless (eq(scipy.arcsin(z), arcsin(zm))) - self.failUnless (eq(scipy.arccos(z), arccos(zm))) - self.failUnless (eq(scipy.arctan(z), arctan(zm))) - self.failUnless (eq(scipy.arctan2(x, y), arctan2(xm, ym))) - self.failUnless (eq(scipy.absolute(x), absolute(xm))) - self.failUnless (eq(scipy.equal(x,y), equal(xm, ym))) - self.failUnless (eq(scipy.not_equal(x,y), not_equal(xm, ym))) - self.failUnless (eq(scipy.less(x,y), less(xm, ym))) - self.failUnless (eq(scipy.greater(x,y), greater(xm, ym))) - self.failUnless (eq(scipy.less_equal(x,y), less_equal(xm, ym))) - self.failUnless (eq(scipy.greater_equal(x,y), greater_equal(xm, ym))) - self.failUnless (eq(scipy.conjugate(x), conjugate(xm))) - self.failUnless (eq(scipy.concatenate((x,y)), concatenate((xm,ym)))) - self.failUnless (eq(scipy.concatenate((x,y)), concatenate((x,y)))) - self.failUnless (eq(scipy.concatenate((x,y)), concatenate((xm,y)))) - self.failUnless (eq(scipy.concatenate((x,y,x)), concatenate((x,ym,x)))) + self.failUnless (eq(numpy.cos(x), cos(xm))) + self.failUnless (eq(numpy.cosh(x), cosh(xm))) + self.failUnless (eq(numpy.sin(x), sin(xm))) + self.failUnless (eq(numpy.sinh(x), sinh(xm))) + self.failUnless (eq(numpy.tan(x), tan(xm))) + self.failUnless (eq(numpy.tanh(x), tanh(xm))) + self.failUnless (eq(numpy.sqrt(abs(x)), sqrt(xm))) + self.failUnless (eq(numpy.log(abs(x)), log(xm))) + self.failUnless (eq(numpy.log10(abs(x)), log10(xm))) + self.failUnless (eq(numpy.exp(x), exp(xm))) + self.failUnless (eq(numpy.arcsin(z), arcsin(zm))) + self.failUnless (eq(numpy.arccos(z), arccos(zm))) + self.failUnless (eq(numpy.arctan(z), arctan(zm))) + self.failUnless (eq(numpy.arctan2(x, y), arctan2(xm, ym))) + self.failUnless (eq(numpy.absolute(x), absolute(xm))) + self.failUnless (eq(numpy.equal(x,y), equal(xm, ym))) + self.failUnless (eq(numpy.not_equal(x,y), not_equal(xm, ym))) + self.failUnless (eq(numpy.less(x,y), less(xm, ym))) + self.failUnless (eq(numpy.greater(x,y), greater(xm, ym))) + self.failUnless (eq(numpy.less_equal(x,y), less_equal(xm, ym))) + self.failUnless (eq(numpy.greater_equal(x,y), greater_equal(xm, ym))) + self.failUnless (eq(numpy.conjugate(x), conjugate(xm))) + self.failUnless (eq(numpy.concatenate((x,y)), concatenate((xm,ym)))) + self.failUnless (eq(numpy.concatenate((x,y)), concatenate((x,y)))) + self.failUnless (eq(numpy.concatenate((x,y)), concatenate((xm,y)))) + self.failUnless (eq(numpy.concatenate((x,y,x)), concatenate((x,ym,x)))) def check_xtestCount (self): "Test count" @@ -150,7 +150,7 @@ class test_ma(ScipyTestCase): def check_testMinMax (self): "Test minimum and maximum." (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d - xr = scipy.ravel(x) #max doesn't work if shaped + xr = numpy.ravel(x) #max doesn't work if shaped xmr = ravel(xm) self.failUnless (eq(max(xr), maximum(xmr))) #true because of careful selection of data self.failUnless (eq(min(xr), minimum(xmr))) #true because of careful selection of data @@ -158,32 +158,32 @@ class test_ma(ScipyTestCase): def check_testAddSumProd (self): "Test add, sum, product." (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d - self.failUnless (eq(scipy.add.reduce(x), add.reduce(x))) - self.failUnless (eq(scipy.add.accumulate(x), add.accumulate(x))) + self.failUnless (eq(numpy.add.reduce(x), add.reduce(x))) + self.failUnless (eq(numpy.add.accumulate(x), add.accumulate(x))) self.failUnless (eq(4, sum(array(4)))) self.failUnless (eq(4, sum(array(4), axis=0))) - self.failUnless (eq(scipy.sum(x), sum(x))) - self.failUnless (eq(scipy.sum(filled(xm,0)), sum(xm))) - self.failUnless (eq(scipy.sum(x,0), sum(x,0))) - self.failUnless (eq(scipy.product(x), product(x))) - self.failUnless (eq(scipy.product(x,0), product(x,0))) - self.failUnless (eq(scipy.product(filled(xm,1)), product(xm))) + self.failUnless (eq(numpy.sum(x), sum(x))) + self.failUnless (eq(numpy.sum(filled(xm,0)), sum(xm))) + self.failUnless (eq(numpy.sum(x,0), sum(x,0))) + self.failUnless (eq(numpy.product(x), product(x))) + self.failUnless (eq(numpy.product(x,0), product(x,0))) + self.failUnless (eq(numpy.product(filled(xm,1)), product(xm))) if len(s) > 1: - self.failUnless (eq(scipy.concatenate((x,y),1), concatenate((xm,ym),1))) - self.failUnless (eq(scipy.add.reduce(x,1), add.reduce(x,1))) - self.failUnless (eq(scipy.sum(x,1), sum(x,1))) - self.failUnless (eq(scipy.product(x,1), product(x,1))) + self.failUnless (eq(numpy.concatenate((x,y),1), concatenate((xm,ym),1))) + self.failUnless (eq(numpy.add.reduce(x,1), add.reduce(x,1))) + self.failUnless (eq(numpy.sum(x,1), sum(x,1))) + self.failUnless (eq(numpy.product(x,1), product(x,1))) def check_testCI(self): "Test of conversions and indexing" - x1 = scipy.array([1,2,4,3]) + x1 = numpy.array([1,2,4,3]) x2 = array(x1, mask = [1,0,0,0]) x3 = array(x1, mask = [0,1,0,1]) x4 = array(x1) # test conversion to strings junk, garbage = str(x2), repr(x2) - assert eq(scipy.sort(x1),sort(x2, fill_value=0)) + assert eq(numpy.sort(x1),sort(x2, fill_value=0)) # tests of indexing assert type(x2[1]) is type(x1[1]) assert x1[1] == x2[1] @@ -210,13 +210,13 @@ class test_ma(ScipyTestCase): x4[:] = masked_array([1,2,3,4],[0,1,1,0]) assert allequal(getmask(x4), array([0,1,1,0])) assert allequal(x4, array([1,2,3,4])) - x1 = scipy.arange(5)*1.0 + x1 = numpy.arange(5)*1.0 x2 = masked_values(x1, 3.0) assert eq(x1,x2) assert allequal(array([0,0,0,1,0],MaskType), x2.mask) assert eq(3.0, x2.fill_value()) x1 = array([1,'hello',2,3],object) - x2 = scipy.array([1,'hello',2,3],object) + x2 = numpy.array([1,'hello',2,3],object) s1 = x1[1].item() s2 = x2[1].item() self.assertEqual(type(s2), str) @@ -233,7 +233,7 @@ class test_ma(ScipyTestCase): m3 = make_mask(m, copy=1) self.failUnless(m is not m3) - x1 = scipy.arange(5) + x1 = numpy.arange(5) y1 = array(x1, mask=m) self.failUnless( y1.raw_data() is not x1) self.failUnless( allequal(x1,y1.raw_data())) @@ -299,7 +299,7 @@ class test_ma(ScipyTestCase): def check_testMaPut(self): (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1] - i = scipy.nonzero(m) + i = numpy.nonzero(m) putmask(xm, m, z) assert take(xm, i) == z put(ym, i, zm) @@ -411,15 +411,15 @@ class test_ma(ScipyTestCase): def check_testTakeTransposeInnerOuter(self): "Test of take, transpose, inner, outer products" x = arange(24) - y = scipy.arange(24) + y = numpy.arange(24) x[5:6] = masked x=x.reshape(2,3,4) y=y.reshape(2,3,4) - assert eq(scipy.transpose(y,(2,0,1)), transpose(x,(2,0,1))) - assert eq(scipy.take(y, (2,0,1), 1), take(x, (2,0,1), 1)) - assert eq(scipy.innerproduct(filled(x,0),filled(y,0)), + assert eq(numpy.transpose(y,(2,0,1)), transpose(x,(2,0,1))) + assert eq(numpy.take(y, (2,0,1), 1), take(x, (2,0,1), 1)) + assert eq(numpy.innerproduct(filled(x,0),filled(y,0)), innerproduct(x, y)) - assert eq(scipy.outerproduct(filled(x,0),filled(y,0)), + assert eq(numpy.outerproduct(filled(x,0),filled(y,0)), outerproduct(x, y)) y = array(['abc', 1, 'def', 2, 3], object) y[2] = masked @@ -530,8 +530,8 @@ class test_ma(ScipyTestCase): self.failUnless(allclose(average(x), 2.5)) self.failUnless(allclose(average(x, weights=w1), 2.5)) y=array([arange(6), 2.0*arange(6)]) - self.failUnless(allclose(average(y, None), scipy.add.reduce(scipy.arange(6))*3./12.)) - self.failUnless(allclose(average(y, axis=0), scipy.arange(6) * 3./2.)) + self.failUnless(allclose(average(y, None), numpy.add.reduce(numpy.arange(6))*3./12.)) + self.failUnless(allclose(average(y, axis=0), numpy.arange(6) * 3./2.)) self.failUnless(allclose(average(y, axis=1), [average(x), average(x) * 2.0])) self.failUnless(allclose(average(y, None, weights=w2), 20./6.)) self.failUnless(allclose(average(y, axis=0, weights=w2), [0.,1.,2.,3.,4.,10.])) @@ -591,13 +591,13 @@ def timingTest(): print f.test_name print """\ n = %7d -scipy time (ms) %6.1f +numpy time (ms) %6.1f MA maskless ratio %6.1f MA masked ratio %6.1f """ % (n, t*1000.0, t1/t, t2/t) def testta(n, f): - x=scipy.arange(n) + 1.0 + x=numpy.arange(n) + 1.0 tn0 = time.time() z = f(x) return time.time() - tn0 @@ -633,5 +633,5 @@ def testinplace(x): testinplace.test_name = 'Inplace operations' if __name__ == "__main__": - ScipyTest('scipy.base.ma').run() + ScipyTest('numpy.base.ma').run() #timingTest() diff --git a/numpy/core/tests/test_matrix.py b/numpy/core/tests/test_matrix.py index 59b0a131e..4deb9aa5e 100644 --- a/numpy/core/tests/test_matrix.py +++ b/numpy/core/tests/test_matrix.py @@ -1,8 +1,8 @@ -from scipy.testing import * +from numpy.testing import * set_package_path() -import scipy.base;reload(scipy.base) -from scipy.base import * +import numpy.base;reload(numpy.base) +from numpy.base import * restore_path() class test_ctor(ScipyTestCase): @@ -26,7 +26,7 @@ class test_ctor(ScipyTestCase): class test_properties(ScipyTestCase): def test_basic(self): - import scipy.corelinalg as linalg + import numpy.corelinalg as linalg A = array([[1., 2.], [3., 4.]]) @@ -94,7 +94,7 @@ class test_autocasting(ScipyTestCase): class test_algebra(ScipyTestCase): def test_basic(self): - import scipy.corelinalg as linalg + import numpy.corelinalg as linalg A = array([[1., 2.], [3., 4.]]) diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py index 8135a55a8..cfdb2e9e3 100644 --- a/numpy/core/tests/test_records.py +++ b/numpy/core/tests/test_records.py @@ -1,10 +1,10 @@ -from scipy.testing import * +from numpy.testing import * set_package_path() import os as _os -import scipy.base;reload(scipy.base) -from scipy.base import * -from scipy.base import records as rec +import numpy.base;reload(numpy.base) +from numpy.base import * +from numpy.base import records as rec restore_path() class test_fromrecords(ScipyTestCase): diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 9cd99f7e1..6b4aa3221 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -1,7 +1,7 @@ -from scipy.testing import * +from numpy.testing import * set_package_path() -from scipy.base.umath import minimum, maximum +from numpy.base.umath import minimum, maximum restore_path() |