[Numpy-svn] r4577 - in branches/maskedarray: . numpy numpy/core numpy/core/tests numpy/ma numpy/ma/tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Fri Dec 14 20:16:45 EST 2007
Author: stefan
Date: 2007-12-14 19:15:26 -0600 (Fri, 14 Dec 2007)
New Revision: 4577
Added:
branches/maskedarray/numpy/ma/
Removed:
branches/maskedarray/numpy/core/ma/
Modified:
branches/maskedarray/THANKS.txt
branches/maskedarray/numpy/__init__.py
branches/maskedarray/numpy/core/__init__.py
branches/maskedarray/numpy/core/tests/test_regression.py
branches/maskedarray/numpy/ma/core.py
branches/maskedarray/numpy/ma/setup.py
branches/maskedarray/numpy/ma/tests/test_core.py
branches/maskedarray/numpy/ma/tests/test_extras.py
branches/maskedarray/numpy/ma/tests/test_morestats.py
branches/maskedarray/numpy/ma/tests/test_mrecords.py
branches/maskedarray/numpy/ma/tests/test_mstats.py
branches/maskedarray/numpy/ma/tests/test_subclassing.py
branches/maskedarray/numpy/setup.py
Log:
Move ma to numpy root. Fix unit tests. Remove references to numpy.core.ma.
Modified: branches/maskedarray/THANKS.txt
===================================================================
--- branches/maskedarray/THANKS.txt 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/THANKS.txt 2007-12-15 01:15:26 UTC (rev 4577)
@@ -35,3 +35,4 @@
Stefan van der Walt for documentation, bug-fixes and regression-tests.
Andrew Straw for help with http://www.scipy.org, documentation, and testing.
David Cournapeau for documentation, bug-fixes, and code contributions including fast_clipping.
+Pierre Gerard-Marchant for his rewrite of the masked array functionality.
Modified: branches/maskedarray/numpy/__init__.py
===================================================================
--- branches/maskedarray/numpy/__init__.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/__init__.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -44,6 +44,7 @@
import fft
import random
import ctypeslib
+ import ma
# Make these accessible from numpy name-space
# but not imported in from numpy import *
Modified: branches/maskedarray/numpy/core/__init__.py
===================================================================
--- branches/maskedarray/numpy/core/__init__.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/core/__init__.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -11,7 +11,6 @@
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 @@
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__
Modified: branches/maskedarray/numpy/core/tests/test_regression.py
===================================================================
--- branches/maskedarray/numpy/core/tests/test_regression.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/core/tests/test_regression.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -110,11 +110,11 @@
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)
Copied: branches/maskedarray/numpy/ma (from rev 4576, branches/maskedarray/numpy/core/ma)
Modified: branches/maskedarray/numpy/ma/core.py
===================================================================
--- branches/maskedarray/numpy/core/ma/core.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/core.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -65,7 +65,7 @@
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
Modified: branches/maskedarray/numpy/ma/setup.py
===================================================================
--- branches/maskedarray/numpy/core/ma/setup.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/setup.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -8,7 +8,7 @@
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
Modified: branches/maskedarray/numpy/ma/tests/test_core.py
===================================================================
--- branches/maskedarray/numpy/core/ma/tests/test_core.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/tests/test_core.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -18,11 +18,11 @@
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 @@
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
Modified: branches/maskedarray/numpy/ma/tests/test_extras.py
===================================================================
--- branches/maskedarray/numpy/core/ma/tests/test_extras.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/tests/test_extras.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -15,13 +15,13 @@
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..."
Modified: branches/maskedarray/numpy/ma/tests/test_morestats.py
===================================================================
--- branches/maskedarray/numpy/core/ma/tests/test_morestats.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/tests/test_morestats.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -12,16 +12,16 @@
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):
Modified: branches/maskedarray/numpy/ma/tests/test_mrecords.py
===================================================================
--- branches/maskedarray/numpy/core/ma/tests/test_mrecords.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/tests/test_mrecords.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -17,16 +17,17 @@
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 @@
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)
Modified: branches/maskedarray/numpy/ma/tests/test_mstats.py
===================================================================
--- branches/maskedarray/numpy/core/ma/tests/test_mstats.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/tests/test_mstats.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -12,20 +12,20 @@
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 @@
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 @@
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 @@
#
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
Modified: branches/maskedarray/numpy/ma/tests/test_subclassing.py
===================================================================
--- branches/maskedarray/numpy/core/ma/tests/test_subclassing.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/ma/tests/test_subclassing.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -15,11 +15,11 @@
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):
Modified: branches/maskedarray/numpy/setup.py
===================================================================
--- branches/maskedarray/numpy/setup.py 2007-12-15 00:38:47 UTC (rev 4576)
+++ branches/maskedarray/numpy/setup.py 2007-12-15 01:15:26 UTC (rev 4577)
@@ -13,6 +13,7 @@
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
More information about the Numpy-svn
mailing list