Re: [Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-25 Thread Eric Firing
On 03/25/2012 12:22 PM, Pierre Haessig wrote: > Hi Eric, > > Thanks for the hints ! > > Le 25/03/2012 20:33, Eric Firing a écrit : >> Using the bitwise operators in place of logical operators is a hack to >> get around limitations of the language; but, if done carefully, it is a >> useful one. > Wh

Re: [Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-25 Thread Pierre Haessig
Hi Eric, Thanks for the hints ! Le 25/03/2012 20:33, Eric Firing a écrit : > Using the bitwise operators in place of logical operators is a hack to > get around limitations of the language; but, if done carefully, it is a > useful one. What is the rationale behind not overloading __and__ & othe

Re: [Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-25 Thread Eric Firing
On 03/25/2012 06:55 AM, Pierre Haessig wrote: > Hi, > > I have an off topic but somehow related question : > > Le 19/03/2012 12:04, Matthieu Rigal a écrit : >> array = numpy.logical_and(numpy.logical_and(aBlueChannel< 1.0, aNirChannel> >> (aBlueChannel * 1.0)), aNirChannel< (aBlueChannel * 1.8))

Re: [Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-25 Thread Pierre Haessig
Hi, I have an off topic but somehow related question : Le 19/03/2012 12:04, Matthieu Rigal a écrit : > array = numpy.logical_and(numpy.logical_and(aBlueChannel < 1.0, aNirChannel > > (aBlueChannel * 1.0)), aNirChannel < (aBlueChannel * 1.8)) Is there any significant difference between : z = np.

Re: [Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-20 Thread Frédéric Bastien
ginal solution, even if >>  probably using less memory than the 2 previous ones. (same was possible >>  with operator +, but slower than operator *) >> >> Regards, >> Matthieu Rigal >> >> On Monday 19 March 2012 18:00:02 numpy-discussion-req

Re: [Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-20 Thread Matthieu Rigal
with operator +, but slower than operator *) > > Regards, > Matthieu Rigal > > On Monday 19 March 2012 18:00:02 numpy-discussion-requ...@scipy.org wrote: > > Message: 2 > > Date: Mon, 19 Mar 2012 13:20:23 +0000 > > From: Richard Hattersley > > Subject:

Re: [Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-19 Thread Richard Hattersley
What do you mean by "efficient"? Are you trying to get it execute faster? Or using less memory? Or have more concise source code? Less memory: - numpy.vectorize would let you get to the end result without any intermediate arrays but will be slow. - Using the "out" parameter of numpy.logical_and

[Numpy-discussion] Using logical function on more than 2 arrays, availability of a "between" function ?

2012-03-19 Thread Matthieu Rigal
Dear Numpy fellows, I have actually a double question, which only aims to answer a single one : how to get the following line being processed more efficiently : array = numpy.logical_and(numpy.logical_and(aBlueChannel < 1.0, aNirChannel > (aBlueChannel * 1.0)), aNirChannel < (aBlueChannel * 1.8