Re: [Numpy-discussion] Operations on masked items

2009-02-03 Thread Ryan May
Ryan May wrote: Pierre, I know you did some preliminary work on helping to make sure that doing operations on masked arrays doesn't change the underlying data. I ran into the following today. import numpy as np a = np.ma.array([1,2,3], mask=[False, True, False]) b = a * 10 c = 10 *

Re: [Numpy-discussion] Operations on masked items

2009-02-03 Thread Pierre GM
On Feb 3, 2009, at 4:00 PM, Ryan May wrote: Well, I guess I hit send too soon. Here's one easy solution (consistent with what you did for __radd__), change the code for __rmul__ to do: return multiply(self, other) instead of: return multiply(other, self) That fixes it

[Numpy-discussion] Operations on masked items

2009-02-03 Thread Ryan May
Pierre, I know you did some preliminary work on helping to make sure that doing operations on masked arrays doesn't change the underlying data. I ran into the following today. import numpy as np a = np.ma.array([1,2,3], mask=[False, True, False]) b = a * 10 c = 10 * a print b.data # Prints [10

Re: [Numpy-discussion] Operations on masked items

2009-02-03 Thread Ryan May
Pierre GM wrote: On Feb 3, 2009, at 4:00 PM, Ryan May wrote: Well, I guess I hit send too soon. Here's one easy solution (consistent with what you did for __radd__), change the code for __rmul__ to do: return multiply(self, other) instead of: return multiply(other, self)