Re: [Numpy-discussion] Trouble With MaskedArray and Shared Masks

2008-02-27 Thread Pierre GM
Alexander, > create the MaskedArray to: > >>> a = numpy.ma.MaskedArray( > > ... data=numpy.zeros((4,5), dtype=float), > ... mask=True, > ... fill_value=0.0 > ... ) By far the easiest indeed. > > So: should we introduce this extra parameter ? > > The propagation semantics and mechan

Re: [Numpy-discussion] Trouble With MaskedArray and Shared Masks

2008-02-27 Thread Alexander Michael
On Tue, Feb 26, 2008 at 2:32 PM, Pierre GM <[EMAIL PROTECTED]> wrote: > Alexander, > The rationale behind the current behavior is to avoid an accidental > propagation of the mask. Consider the following example: > > >>>m = numpy.array([1,0,0,1,0], dtype=bool_) > >>>x = numpy.array([1,2,3,4,5])

Re: [Numpy-discussion] Trouble With MaskedArray and Shared Masks

2008-02-26 Thread Pierre GM
Alexander, The rationale behind the current behavior is to avoid an accidental propagation of the mask. Consider the following example: >>>m = numpy.array([1,0,0,1,0], dtype=bool_) >>>x = numpy.array([1,2,3,4,5]) >>>y = numpy.sqrt([5,4,3,2,1]) >>>mx = masked_array(x,mask=m) >>>my = masked_array(y

[Numpy-discussion] Trouble With MaskedArray and Shared Masks

2008-02-26 Thread Alexander Michael
I'm having trouble with MaskedArray's _sharedmask flag. I would like to create a sub-view of a MaskedArray, fill it, and have the modifications reflected in the original array. This works with regular ndarrays, but only works with MaskedArrays if _sharedmask is set to False. Here's an example: >>>