[Numpy-discussion] logical masking, wrong length mask

2008-05-28 Thread John Hunter
I just spent a while tracking down a bug in my code, and found out the problem was numpy was letting me get away with using a logical mask of smaller size than the array it was masking. In [19]: x = np.random.rand(10) In [20]: x Out[20]: array([ 0.72253623, 0.8412243 , 0.12835194,

Re: [Numpy-discussion] logical masking, wrong length mask

2008-05-28 Thread Stéfan van der Walt
2008/5/28 John Hunter [EMAIL PROTECTED]: I initially thought line 24 below should raise an error, or coerce True to 1 and False to 0 and give me either y[0] or y[1] accordingly, but neither appear to be happening. Instead, I appear to be getting y[:len(mask)][mask] This feature looks