[SciPy-user] ANN: An alternative to numpy.core.ma

Pierre GM pgmdevlist at gmail.com
Sun Dec 10 14:06:12 CST 2006

I just posted on the DeveloperZone of the wiki the latest version of 
maskedarray, an alternative to numpy.core.ma. You can download it here:


The package has three modules: core (with the basic functions of 
numpy.core.ma), extras (which adds some functions, such as apply_along_axis, 
or the concatenator mr_), and testutils (which adds support for maskedarray 
for the tests functions). It also comes with its test suite (available in the 
tests subdirectory).

For those of you who were not aware of it, the new MaskedArray is a subclass 
of ndarray, and it accepts any subclass of ndarray as data. You can use it as 
you would with numpy.core.ma.MaskedArray.

For those of you who already tested the package, the main modifications are:
- the reorganization of the initial module in core+extras.
- Data are now shared by default (in other terms, the copy flag defaults to 
False in MaskedArray.__new__), for consistency with the rest of numpy.
- An additional boolean flag has been introduced: keep_mask (with a default of 
True). This flag is useful when trying to mask a mask array: it tells __new__ 
whether to keep the initial mask (in that case, the new mask will be combined 
with the old mask) or not (in that case, the new mask replaces the old one).
- Some functions/routines that were missing have been added (any/all...)

As always, this is a work in progress. In particular, I should really check 
for the bottlenecks: would anybody have some pointers ? If you wanna be on 
the safe, optimized side, stick to numpy.core.ma. Otherwise, please try this 
new implementation, and don't forget to give me some feedback!

Technical question: how can I delete some files in the DeveloperZone wiki ? 
The maskedarray.py, test_maskedarray.py, test_subclasses.py are out of date, 
and should be replaced by the package. Thanks a lot in advance !

More information about the SciPy-user mailing list