Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Ryan May
On Tue, Mar 30, 2010 at 3:40 PM, Robert Kern wrote: > On Tue, Mar 30, 2010 at 16:35, Ryan May wrote: >> On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt >> wrote: > >>> x *= ((x <= 23) | (x >= 45))  . >> >> Interesting. In an ideal world, I'd love to see why exactly that is, >> because I don'

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Ryan May : > On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt > wrote: >> We recently found out that it executes faster using: >> >> x *= ((x <= 23) | (x >= 45))  . > > Interesting. In an ideal world, I'd love to see why exactly that is, > because I don't think multiplication should b

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Robert Kern
On Tue, Mar 30, 2010 at 16:35, Ryan May wrote: > On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt > wrote: >> x *= ((x <= 23) | (x >= 45))  . > > Interesting. In an ideal world, I'd love to see why exactly that is, > because I don't think multiplication should be faster than a boolean > op.

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Ryan May
On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt wrote: > 2010/3/30 Ryan May : >> On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac wrote: >>> On 3/30/2010 12:56 PM, Sean Mulcahy wrote: 512x512 arrays.  I would like to set elements of the array whose value fall within a specified range

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Ryan May : > On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac wrote: >> On 3/30/2010 12:56 PM, Sean Mulcahy wrote: >>> 512x512 arrays.  I would like to set elements of the array whose value fall >>> within a specified range to zero (eg 23<  x<  45). >> >> x[(23 > Or a version that seems a

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Ryan May
On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac wrote: > On 3/30/2010 12:56 PM, Sean Mulcahy wrote: >> 512x512 arrays.  I would like to set elements of the array whose value fall >> within a specified range to zero (eg 23<  x<  45). > > x[(23http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Alan G Isaac
On 3/30/2010 12:56 PM, Sean Mulcahy wrote: > 512x512 arrays. I would like to set elements of the array whose value fall > within a specified range to zero (eg 23< x< 45). x[(23http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Sean Mulcahy
Hello all, I'm relatively new to numpy. I'm working with text images as 512x512 arrays. I would like to set elements of the array whose value fall within a specified range to zero (eg 23 < x < 45). Any advice is much appreciated. Sean ___ NumPy-Dis