[Numpy-discussion] A reimplementation of MaskedArray

Michael Sorich michael.sorich at gmail.com
Mon Nov 20 18:37:06 EST 2006


While playing with the new implementation I noticed that the nonzero
method did not seem to work properly. I was not able to trace down why
this is the case - I could not find where the nonzero method of the
new maskedarray is actually implemented :)

import maskedarray as ma
test_ma1 = ma.array([True, False, False], mask=[0,0,1])
print test_ma1
print test_ma1.nonzero()[0]
print ma.nonzero(test_ma1)[0]

--output--
[True False --]
[True False --]
[0]


On 10/16/06, Pierre GM <pgmdevlist at mailcan.com> wrote:
> Folks,
> I just posted on the scipy/developers zone wiki
> (http://projects.scipy.org/scipy/numpy/wiki/MaskedArray) a reimplementation
> of the masked_array mopdule, motivated by some problems I ran into while
> subclassing MaskedArray.
>
> The main differences with the initial numpy.core.ma package are that
> MaskedArray is now a subclass of ndarray and that the _data section can now
> be any subclass of ndarray (well, it should work in most cases, some tweaking
> might required here and there). Apart from a couple of issues listed below,
> the behavior of the new MaskedArray class reproduces the old one. It is quite
> likely to be significantly slower, though: I was more interested in a clear
> organization than in performance, so I tended to use wrappers liberally. I'm
> sure we can improve that rather easily.
>
> The new module, along with a test suite and some utilities, are available
> here:
> http://projects.scipy.org/scipy/numpy/attachment/wiki/MaskedArray/maskedarray.py
> http://projects.scipy.org/scipy/numpy/attachment/wiki/MaskedArray/masked_testutils.py
> http://projects.scipy.org/scipy/numpy/attachment/wiki/MaskedArray/test_maskedarray.py
>
> Please note that it's still a work in progress (even if it seems to work quite
> OK when I use it). Suggestions, comments, improvements and general feedback
> are more than welcome !
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list