[Numpy-discussion] [SciPy-dev] SciPy Sprint results

Pierre GM pgmdevlist at gmail.com
Thu Dec 20 18:52:38 EST 2007


> > * cumsum(cumprod) works as if the _data array was filled with 0 (1). The
> > mask is preserved, but not updated. (the output of numpy.core.ma has
> > nomask).
>
> I don't understand what you mean here.    So, the mask effectively
> removes those elements from the sum(product) computation?  What does it
> mean that the mask is not updated?

Quick example:
>>> x= masked_array([1,2,3],mask=[0,1,0])
>>> x
masked_array(data = [1 -- 3],
      mask = [False  True False],
      fill_value=999999)
>>> x.cumsum()
masked_array(data = [1 -- 4],
      mask = [False  True False],
      fill_value=999999)

So, cumsum works as if the masked values were 0. The mask stays the same as it 
was initially (that's what I meant by "mask not updated").  An alternative 
would be to set the mask to True for all the values past the first masked: 
with our example, we would have:
masked_array(data = [1 --  --],
      mask = [False  True True],
      fill_value=999999)
I prefer the first version (the one that is currently implemented).




> > * bool(x) raises a ValueError, as it does for ndarrays.
>
> What does bool(x) raise for numpy.core.ma.

True

> If we can document exactly what the compatibility issues are (and it
> looks like we are almost there), we should move forward.

OK, I'll take care of that this week-end. Stefan, feel free to beat me to 
it...



More information about the NumPy-Discussion mailing list