[Numpy-discussion] missing function in numpy.ma?
Wed Mar 26 16:33:19 CDT 2008
numpy.ma is supposed to replace numpy.core.ma only. I don't know what happened
to numpy.oldnumeric.ma, more exactly when it was dropped. A quick search on
the trac indicates it happens a while ago (before version 1.0.1)...
In short, the major difference between the old (numpy.core.ma) and new
(numpy.ma) implementation is that MaskedArray is nowadays a subclass of
ndarray, when it was a complete different object in the old version. The new
approach does simplify a lot of aspects (subclassing in particular). It
introduces a lot of functions that were not available in the previous
version, and it's supposed to be more transparent.
> But the whole idea was to keep a backward compatible layer with Numeric
> and MA. It worked great for a while and now things are getting more and
> more broken.
As numpy is moving further and further away from Numeric ?
> It is absolutely necessary to have the oldnumeric.ma working as much as
> possible as MA, what's in now is incompatible with code that have been
> successfully upgraded to numpy using your recommended method (official
> numpy doc)
I must admit I'm partially responsible: there are indeed a couple of
incompatibilities between numpy.core.ma and numpy.ma, there are listed here:
All in all, they look minor to me, but may have some naughty side effects: the
_data as property is the trickiest as it will make tests on id fail.
> Can you put back ALL the function from numpy.oldnumeric.ma ? It
> shouldn't be too much work.
I'm not sure I can assess properly the time it would need. I could try, but I
never used numpy.oldnumeric.ma myself, and I have difficulties finding an old
> Now I'm actually worried about using ma at all? What version is in? Is
> it a completely new package or is it still the old one just a bit
> broken? If it's a new one, we'd have to be sure it is fully tested
> before we can redistribute it to other people via our package, or before
> we use it ourselves
Well, as stated before, numpy.ma is a better numpy.core.ma, and therefore not
totally compatible with Numeric.MA. Lots of functions are equivalent, but
some functionalities have been added, some dropped. Once again, my objective
was to ensure compatibility with numpy.core.ma (with which I started learning
Python), not with Numeric.MA that I never used. Yes, numpy.ma has been
regularly tested (I've been using it on a quasi daily basis for at least a
year now); however, some issues/bugs still pop up from times to times.
In any case, I'd be happy to help you figuring out how to modify/upgrade your
code from Numeric.MA to numpy.ma, or to answer any specific questions you
More information about the Numpy-discussion