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

Stefan van der Walt stefan@sun.ac...
Sat Dec 22 14:45:34 CST 2007


Hi Eric

On Fri, Dec 21, 2007 at 08:13:13AM -1000, Eric Firing wrote:
> I think the description of the putmask difference is missing the point. 
>   The real difference is not in the way the third argument is handled, 
> or  its required shape, but in whether the mask is updated or not.

This behaviour was changed in the maskedarray branch:

> In [18]:import maskedarray as ma
> In [19]:mask1 = [False, True, False]
> In [21]:x = ma.array([1,2,3], mask=mask1)
> In [22]:mask2 = [False, True, True]
> In [23]:ma.putmask(x, mask2, 10)
> In [24]:x
> Out[24]:
> masked_array(data = [1 -- 10],
>        mask = [False  True False],
>        fill_value=999999)

In [2]: import numpy as N
In [3]: ma = N.ma
In [4]: mask1 = [False, True, False]
In [5]: x = ma.array([1,2,3], mask=mask1)
In [6]: mask2 = [False, True, True]
In [7]: ma.putmask(x, mask2, 10)
In [8]: x
Out[8]: 
masked_array(data = [1 10 10],
      mask = [False False False],
      fill_value=999999)

Regards
Stéfan


More information about the Numpy-discussion mailing list