[SciPy-User] mary, a masked array

Pierre GM pgmdevlist@gmail....
Sat Jun 26 20:07:05 CDT 2010


On Jun 26, 2010, at 1:10 PM, Keith Goodman wrote:

> On Sat, Jun 26, 2010 at 9:42 AM, Pierre GM <pgmdevlist@gmail.com> wrote:
>> 
>> You're re-implementing the original version of MaskedArray :)
>> (in numpy <1.2, a masked array was the combination of a standard ndarray (your data) and either a boolean ndarray or a boolean (your mask)... That's quite OK, as long as you're not bothered by the fact that a larray/mary is not an array.
> 
> Ah, that's good to know. I'll take a look. Thank you.

You're quite welcome. The reason why I want MaskedArray to be a subclass of ndarray was that it's making things easier to subclass MaskedArray while keeping the functionalities of a ndarray. Now, the good thing is that it works, the bad thing is that it slows things down. At least we have an ideal test suite when MaskedArrays will be ported to C...


>>> Comments and suggestions are welcomed. I'm not familiar with np.ma so
>>> I imagine there are many issues I haven't thought through.
>> 
>> What happens if you calculate sqrt(-1) with a mary ?
> 
> Same as np.sqrt(-1) which gives NaN. But, as coded, the mask does not
> get updated even if the marker is NaN. So far only assignment by
> indexing updates the mask.

Hey, whatever fits you needs...


More information about the SciPy-User mailing list