[Numpy-discussion] Maskedarray implementations

Pierre GM pgmdevlist at gmail.com
Sat Aug 25 15:06:06 EDT 2007


On Saturday 25 August 2007 12:50:38 Eric Firing wrote:
> Alexander Michael wrote:
> > Is there any documentation available for your maskedarray?
>
> Pierre wrote some notes about maskedarray here:
> http://projects.scipy.org/scipy/numpy/wiki/MaskedArray
> starting half-way down the page.

Please note that I should probably edit the page, as it starts to be a bit 
old. We could also start another wiki page for masked arrays...
In addition, there are a lot of unittest available, which can give you a first 
taste.
The 'dot' function in maskedarray takes an additional parameter, strict.
If strict is True, the masked values are propagated: if a masked value appears  
in a row or column, the whole row or column is considered masked. That's 
basically what you would have if masked values were nan (on a float array).
If strict is False, masked values are considered as 0.

> For normal use, do whatever you would do with numpy.ma; the maskedarray
> implementation is highly compatible, so the same functions and methods
> are available with the same signatures.

Please don't hesitate to let me know where the doc is lacking, I'll fix that.

As noted by Eric and John, mpl is fully compatible w/ maskedarray. Until 
recently, one had to edit the matplotlib.numerix.ma manually. Thanks to Eric, 
rcParams now accept a parameter that sets whether numpy.ma or maskedarray 
should be used.

John, masked records are still experimental. I wrote the basis for the code 
(the mrecords module), tweaked it here and there according to the feedback I 
received (not so much so far, I want to thank Matt Knox (with whom we wrote 
TimeSeries) for starting to use mrecords on a regular basis), I'd be of 
course more than happy to fix any problem we may/will run into. An 
interesting feature of masked records is that individual fields can be masked 
(instead of masking full records).



More information about the NumPy-Discussion mailing list