summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2007-12-15 01:15:26 +0000
committerStefan van der Walt <stefan@sun.ac.za>2007-12-15 01:15:26 +0000
commit703e8d6323b19cbfeb96772c1e35f1cd68629336 (patch)
tree34bd23200d97ff43369d7d23d37c9c08c3d3a3b4 /numpy
parent61f9f6d0fb169cadefe35ea2bdd783848aa771f5 (diff)
downloadnumpy-703e8d6323b19cbfeb96772c1e35f1cd68629336.tar.gz
Move ma to numpy root. Fix unit tests. Remove references to numpy.core.ma.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/__init__.py1
-rw-r--r--numpy/core/__init__.py3
-rw-r--r--numpy/core/tests/test_regression.py4
-rw-r--r--numpy/ma/LICENSE (renamed from numpy/core/ma/LICENSE)0
-rw-r--r--numpy/ma/__init__.py (renamed from numpy/core/ma/__init__.py)0
-rw-r--r--numpy/ma/bench.py (renamed from numpy/core/ma/bench.py)0
-rw-r--r--numpy/ma/core.py (renamed from numpy/core/ma/core.py)2
-rw-r--r--numpy/ma/extras.py (renamed from numpy/core/ma/extras.py)0
-rw-r--r--numpy/ma/morestats.py (renamed from numpy/core/ma/morestats.py)0
-rw-r--r--numpy/ma/mrecords.py (renamed from numpy/core/ma/mrecords.py)0
-rw-r--r--numpy/ma/mstats.py (renamed from numpy/core/ma/mstats.py)0
-rw-r--r--numpy/ma/setup.py (renamed from numpy/core/ma/setup.py)2
-rw-r--r--numpy/ma/tests/test_core.py (renamed from numpy/core/ma/tests/test_core.py)21
-rw-r--r--numpy/ma/tests/test_extras.py (renamed from numpy/core/ma/tests/test_extras.py)12
-rw-r--r--numpy/ma/tests/test_morestats.py (renamed from numpy/core/ma/tests/test_morestats.py)16
-rw-r--r--numpy/ma/tests/test_mrecords.py (renamed from numpy/core/ma/tests/test_mrecords.py)19
-rw-r--r--numpy/ma/tests/test_mstats.py (renamed from numpy/core/ma/tests/test_mstats.py)30
-rw-r--r--numpy/ma/tests/test_subclassing.py (renamed from numpy/core/ma/tests/test_subclassing.py)8
-rw-r--r--numpy/ma/testutils.py (renamed from numpy/core/ma/testutils.py)0
-rw-r--r--numpy/ma/timer_comparison.py (renamed from numpy/core/ma/timer_comparison.py)0
-rw-r--r--numpy/ma/version.py (renamed from numpy/core/ma/version.py)0
-rw-r--r--numpy/setup.py1
22 files changed, 54 insertions, 65 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index 1a9271bce..b7ee2a417 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -44,6 +44,7 @@ else:
import fft
import random
import ctypeslib
+ import ma
# Make these accessible from numpy name-space
# but not imported in from numpy import *
diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py
index 4d22394d5..37ed7213e 100644
--- a/numpy/core/__init__.py
+++ b/numpy/core/__init__.py
@@ -11,7 +11,6 @@ import _sort
from numeric import *
from fromnumeric import *
from defmatrix import *
-import ma
import defchararray as char
import records as rec
from records import *
@@ -24,7 +23,7 @@ from fromnumeric import amax as max, amin as min, \
round_ as round
from numeric import absolute as abs
-__all__ = ['char','rec','memmap','ma']
+__all__ = ['char','rec','memmap']
__all__ += numeric.__all__
__all__ += fromnumeric.__all__
__all__ += defmatrix.__all__
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 42191cfce..be2966957 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -110,11 +110,11 @@ class TestRegression(NumpyTestCase):
def check_masked_array(self,level=rlevel):
"""Ticket #61"""
- x = N.core.ma.array(1,mask=[1])
+ x = N.ma.array(1,mask=[1])
def check_mem_masked_where(self,level=rlevel):
"""Ticket #62"""
- from numpy.core.ma import masked_where, MaskType
+ from numpy.ma import masked_where, MaskType
a = N.zeros((1,1))
b = N.zeros(a.shape, MaskType)
c = masked_where(b,a)
diff --git a/numpy/core/ma/LICENSE b/numpy/ma/LICENSE
index b41aae0c8..b41aae0c8 100644
--- a/numpy/core/ma/LICENSE
+++ b/numpy/ma/LICENSE
diff --git a/numpy/core/ma/__init__.py b/numpy/ma/__init__.py
index ccbb6d3c6..ccbb6d3c6 100644
--- a/numpy/core/ma/__init__.py
+++ b/numpy/ma/__init__.py
diff --git a/numpy/core/ma/bench.py b/numpy/ma/bench.py
index cdb010df1..cdb010df1 100644
--- a/numpy/core/ma/bench.py
+++ b/numpy/ma/bench.py
diff --git a/numpy/core/ma/core.py b/numpy/ma/core.py
index 1b359b330..0f2ab64ff 100644
--- a/numpy/core/ma/core.py
+++ b/numpy/ma/core.py
@@ -65,7 +65,7 @@ import cPickle
import operator
#
import numpy
-from numpy import bool_, complex_, float_, int_, object_, str_
+from numpy.core import bool_, complex_, float_, int_, object_, str_
import numpy.core.umath as umath
import numpy.core.fromnumeric as fromnumeric
diff --git a/numpy/core/ma/extras.py b/numpy/ma/extras.py
index f122d6d47..f122d6d47 100644
--- a/numpy/core/ma/extras.py
+++ b/numpy/ma/extras.py
diff --git a/numpy/core/ma/morestats.py b/numpy/ma/morestats.py
index ae263a835..ae263a835 100644
--- a/numpy/core/ma/morestats.py
+++ b/numpy/ma/morestats.py
diff --git a/numpy/core/ma/mrecords.py b/numpy/ma/mrecords.py
index 80b9f3434..80b9f3434 100644
--- a/numpy/core/ma/mrecords.py
+++ b/numpy/ma/mrecords.py
diff --git a/numpy/core/ma/mstats.py b/numpy/ma/mstats.py
index f965b291d..f965b291d 100644
--- a/numpy/core/ma/mstats.py
+++ b/numpy/ma/mstats.py
diff --git a/numpy/core/ma/setup.py b/numpy/ma/setup.py
index e8b76427c..9d8d400f4 100644
--- a/numpy/core/ma/setup.py
+++ b/numpy/ma/setup.py
@@ -8,7 +8,7 @@ import os
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
- config = Configuration('maskedarray',parent_package,top_path)
+ config = Configuration('ma',parent_package,top_path)
config.add_data_dir('tests')
return config
diff --git a/numpy/core/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index 003cd0112..0849be135 100644
--- a/numpy/core/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -18,11 +18,11 @@ from numpy.testing import NumpyTest, NumpyTestCase
from numpy.testing.utils import build_err_msg
from numpy import array as narray
-import maskedarray.testutils
-from maskedarray.testutils import *
+import numpy.ma.testutils
+from numpy.ma.testutils import *
-import maskedarray.core as coremodule
-from maskedarray.core import *
+import numpy.ma.core as coremodule
+from numpy.ma.core import *
pi = numpy.pi
@@ -735,19 +735,6 @@ class TestMA(NumpyTestCase):
dma_3 = MaskedArray(dma_1, mask=[1,0,0,0]*6)
fail_if_equal(dma_3.mask, dma_1.mask)
- def check_backwards(self):
- "Tests backward compatibility with numpy.core.ma"
- import numpy.core.ma as nma
- x = nma.arange(5)
- x[2] = nma.masked
- X = masked_array(x, mask=x._mask)
- assert_equal(X._mask, x.mask)
- assert_equal(X._data, x._data)
- X = masked_array(x)
- assert_equal(X._data, x._data)
- assert_equal(X._mask, x.mask)
- assert_equal(getmask(x), [0,0,1,0,0])
-
def check_pickling(self):
"Tests pickling"
import cPickle
diff --git a/numpy/core/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py
index 1cac9d3b9..5a52aeeee 100644
--- a/numpy/core/ma/tests/test_extras.py
+++ b/numpy/ma/tests/test_extras.py
@@ -15,13 +15,13 @@ import numpy as N
from numpy.testing import NumpyTest, NumpyTestCase
from numpy.testing.utils import build_err_msg
-import maskedarray.testutils
-from maskedarray.testutils import *
+import numpy.ma.testutils
+from numpy.ma.testutils import *
-import maskedarray.core
-from maskedarray.core import *
-import maskedarray.extras
-from maskedarray.extras import *
+import numpy.ma.core
+from numpy.ma.core import *
+import numpy.ma.extras
+from numpy.ma.extras import *
class TestAverage(NumpyTestCase):
"Several tests of average. Why so many ? Good point..."
diff --git a/numpy/core/ma/tests/test_morestats.py b/numpy/ma/tests/test_morestats.py
index ca70c111a..933e974da 100644
--- a/numpy/core/ma/tests/test_morestats.py
+++ b/numpy/ma/tests/test_morestats.py
@@ -12,16 +12,16 @@ __date__ = '$Date: 2007-10-04 15:31:14 -0400 (Thu, 04 Oct 2007) $'
import numpy
-import maskedarray
-from maskedarray import masked, masked_array
+import numpy.ma
+from numpy.ma import masked, masked_array
-import maskedarray.mstats
-from maskedarray.mstats import *
-import maskedarray.morestats
-from maskedarray.morestats import *
+import numpy.ma.mstats
+from numpy.ma.mstats import *
+import numpy.ma.morestats
+from numpy.ma.morestats import *
-import maskedarray.testutils
-from maskedarray.testutils import *
+import numpy.ma.testutils
+from numpy.ma.testutils import *
class TestMisc(NumpyTestCase):
diff --git a/numpy/core/ma/tests/test_mrecords.py b/numpy/ma/tests/test_mrecords.py
index 6d91d506f..1d7d5a966 100644
--- a/numpy/core/ma/tests/test_mrecords.py
+++ b/numpy/ma/tests/test_mrecords.py
@@ -17,16 +17,17 @@ import numpy.core.fromnumeric as fromnumeric
from numpy.testing import NumpyTest, NumpyTestCase
from numpy.testing.utils import build_err_msg
-import maskedarray.testutils
-from maskedarray.testutils import *
+import numpy.ma.testutils
+from numpy.ma.testutils import *
-import maskedarray
-from maskedarray import masked_array, masked, nomask
+import numpy.ma
+from numpy.ma import masked_array, masked, nomask
-#import maskedarray.mrecords
-#from maskedarray.mrecords import mrecarray, fromarrays, fromtextfile, fromrecords
-import maskedarray.mrecords
-from maskedarray.mrecords import MaskedRecords, \
+#import numpy.ma.mrecords
+#from numpy.ma.mrecords import mrecarray, fromarrays, fromtextfile, fromrecords
+
+import numpy.ma.mrecords
+from numpy.ma.mrecords import MaskedRecords, \
fromarrays, fromtextfile, fromrecords, addfield
#..............................................................................
@@ -39,7 +40,7 @@ class TestMRecords(NumpyTestCase):
def setup(self):
"Generic setup"
d = N.arange(5)
- m = maskedarray.make_mask([1,0,0,1,1])
+ m = numpy.ma.make_mask([1,0,0,1,1])
base_d = N.r_[d,d[::-1]].reshape(2,-1).T
base_m = N.r_[[m, m[::-1]]].T
base = masked_array(base_d, mask=base_m)
diff --git a/numpy/core/ma/tests/test_mstats.py b/numpy/ma/tests/test_mstats.py
index b571f1a01..e4657a58f 100644
--- a/numpy/core/ma/tests/test_mstats.py
+++ b/numpy/ma/tests/test_mstats.py
@@ -12,20 +12,20 @@ __date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $'
import numpy
-import maskedarray
-from maskedarray import masked, masked_array
+import numpy.ma
+from numpy.ma import masked, masked_array
-import maskedarray.testutils
-from maskedarray.testutils import *
+import numpy.ma.testutils
+from numpy.ma.testutils import *
-from maskedarray.mstats import *
+from numpy.ma.mstats import *
#..............................................................................
class TestQuantiles(NumpyTestCase):
"Base test class for MaskedArrays."
def __init__(self, *args, **kwds):
NumpyTestCase.__init__(self, *args, **kwds)
- self.a = maskedarray.arange(1,101)
+ self.a = numpy.ma.arange(1,101)
#
def test_1d_nomask(self):
"Test quantiles 1D - w/o mask."
@@ -65,21 +65,21 @@ class TestQuantiles(NumpyTestCase):
def test_2d_nomask(self):
"Test quantiles 2D - w/o mask."
a = self.a
- b = maskedarray.resize(a, (100,100))
+ b = numpy.ma.resize(a, (100,100))
assert_almost_equal(mquantiles(b), [25.45, 50.5, 75.55])
- assert_almost_equal(mquantiles(b, axis=0), maskedarray.resize(a,(3,100)))
+ assert_almost_equal(mquantiles(b, axis=0), numpy.ma.resize(a,(3,100)))
assert_almost_equal(mquantiles(b, axis=1),
- maskedarray.resize([25.45, 50.5, 75.55], (100,3)))
+ numpy.ma.resize([25.45, 50.5, 75.55], (100,3)))
#
def test_2d_mask(self):
"Test quantiles 2D - w/ mask."
a = self.a
a[1::2] = masked
- b = maskedarray.resize(a, (100,100))
+ b = numpy.ma.resize(a, (100,100))
assert_almost_equal(mquantiles(b), [25., 50., 75.])
- assert_almost_equal(mquantiles(b, axis=0), maskedarray.resize(a,(3,100)))
+ assert_almost_equal(mquantiles(b, axis=0), numpy.ma.resize(a,(3,100)))
assert_almost_equal(mquantiles(b, axis=1),
- maskedarray.resize([24.9, 50., 75.1], (100,3)))
+ numpy.ma.resize([24.9, 50., 75.1], (100,3)))
class TestMedian(NumpyTestCase):
def __init__(self, *args, **kwds):
@@ -101,12 +101,12 @@ class TestMedian(NumpyTestCase):
def test_3d(self):
"Tests median w/ 3D"
- x = maskedarray.arange(24).reshape(3,4,2)
+ x = numpy.ma.arange(24).reshape(3,4,2)
x[x%3==0] = masked
assert_equal(mmedian(x,0), [[12,9],[6,15],[12,9],[18,15]])
x.shape = (4,3,2)
assert_equal(mmedian(x,0),[[99,10],[11,99],[13,14]])
- x = maskedarray.arange(24).reshape(4,3,2)
+ x = numpy.ma.arange(24).reshape(4,3,2)
x[x%5==0] = masked
assert_equal(mmedian(x,0), [[12,10],[8,9],[16,17]])
@@ -118,7 +118,7 @@ class TestTrimming(NumpyTestCase):
#
def test_trim(self):
"Tests trimming."
- x = maskedarray.arange(100)
+ x = numpy.ma.arange(100)
assert_equal(trim_both(x).count(), 60)
assert_equal(trim_tail(x,tail='r').count(), 80)
x[50:70] = masked
diff --git a/numpy/core/ma/tests/test_subclassing.py b/numpy/ma/tests/test_subclassing.py
index a68692648..331ef887d 100644
--- a/numpy/core/ma/tests/test_subclassing.py
+++ b/numpy/ma/tests/test_subclassing.py
@@ -15,11 +15,11 @@ import numpy.core.numeric as numeric
from numpy.testing import NumpyTest, NumpyTestCase
-import maskedarray.testutils
-from maskedarray.testutils import *
+import numpy.ma.testutils
+from numpy.ma.testutils import *
-import maskedarray.core as coremodule
-from maskedarray.core import *
+import numpy.ma.core as coremodule
+from numpy.ma.core import *
class SubArray(N.ndarray):
diff --git a/numpy/core/ma/testutils.py b/numpy/ma/testutils.py
index d51e8dab1..d51e8dab1 100644
--- a/numpy/core/ma/testutils.py
+++ b/numpy/ma/testutils.py
diff --git a/numpy/core/ma/timer_comparison.py b/numpy/ma/timer_comparison.py
index 4f789ec53..4f789ec53 100644
--- a/numpy/core/ma/timer_comparison.py
+++ b/numpy/ma/timer_comparison.py
diff --git a/numpy/core/ma/version.py b/numpy/ma/version.py
index 7a925f1a8..7a925f1a8 100644
--- a/numpy/core/ma/version.py
+++ b/numpy/ma/version.py
diff --git a/numpy/setup.py b/numpy/setup.py
index 9ecf1087b..40375651f 100644
--- a/numpy/setup.py
+++ b/numpy/setup.py
@@ -13,6 +13,7 @@ def configuration(parent_package='',top_path=None):
config.add_subpackage('fft')
config.add_subpackage('linalg')
config.add_subpackage('random')
+ config.add_subpackage('ma')
config.add_data_dir('doc')
config.add_data_dir('tests')
config.make_config_py() # installs __config__.py