Re: [Numpy-discussion] masked arrays as array indices (is a bad idea)

2009-09-21 Thread Pierre GM
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 w

Re: [Numpy-discussion] masked arrays as array indices (is a bad idea)

2009-09-21 Thread Ernest Adrogué
21/09/09 @ 14:43 (-0400), thus spake Pierre GM: > > > On Sep 21, 2009, at 12:17 PM, Ryan May wrote: > > > 2009/9/21 Ernest Adrogué > > Hello there, > > > > Given a masked array such as this one: > > > > In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1) > > > > In [20]: x > > Out[20]: > >

Re: [Numpy-discussion] masked arrays as array indices (is a bad idea)

2009-09-21 Thread Pierre GM
On Sep 21, 2009, at 12:17 PM, Ryan May wrote: > 2009/9/21 Ernest Adrogué > Hello there, > > Given a masked array such as this one: > > In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1) > > In [20]: x > Out[20]: > masked_array(data = [-- -- 0 -- 2], > mask = [ True True False

Re: [Numpy-discussion] masked arrays as array indices

2009-09-21 Thread Ryan May
2009/9/21 Ernest Adrogué > Hello there, > > Given a masked array such as this one: > > In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1) > > In [20]: x > Out[20]: > masked_array(data = [-- -- 0 -- 2], > mask = [ True True False True False], > fill_value = 99) > > Whe

[Numpy-discussion] masked arrays as array indices

2009-09-21 Thread Ernest Adrogué
Hello there, Given a masked array such as this one: In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1) In [20]: x Out[20]: masked_array(data = [-- -- 0 -- 2], mask = [ True True False True False], fill_value = 99) When you make an assignemnt in the vein of x[x ==