[Numpy-discussion] take not respecting masked arrays?

Peter Shinners pete@shinners....
Sun Feb 28 19:59:14 CST 2010


I have a 2D masked array that has indices into a 1D array. I want to use 
some form of "take" to fetch the values into the 2D array. I've tried 
both numpy.take and numpy.ma.take, but they both return a new unmasked 
array.

I can get it working by converting the take results into a masked array 
and applying the original mask. But the values that are masked are 
actually illegal indices. This means I need to switch the take mode away 
from "raise", but I actually want raise.

I'm still new to numpy, so it's likely I've overlooked something. Is 
there a masked take?



More information about the NumPy-Discussion mailing list