On Sep 21, 2009, at 4:23 PM, Ernest Adrogué wrote:
>
> This explains why x[x == 3] = 4 works "as expected", whereas
> x[x == 0] = 4 ruins everything. Basically, any condition that matches
> 0 will match every masked item as well.

There's room for improvement here indeed. I need to check first  
whether fixing the comparison methods doesn't break anything.

> I don't know, but maybe it would be better to raise an exception when
> the index is a masked array then. The current behaviour seems a bit
> confusing to me.

That'd be modifying ndarray.__getitem__ and I don't see that  
happening. In the meantime, please just fill your masked array with  
the `filled` method or the corresponding function.
Remmber that masked arrays are for convenience. As soon as you try to  
do some heavy computations, you're better processing data and mask  
yourself.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to