Re: [Numpy-discussion] Complex 'where' expression

2007-03-27 Thread Tom Denniston
You need to use numpy.logical_and. The and and or operators do not work elementwise on arrays to the best of my understanding. I think it is a limitation on the way logical operators are applied in python or maybe it is an intentional numpy limitation. I'm sure others on the list could explain be

Re: [Numpy-discussion] Complex 'where' expression

2007-03-27 Thread Robert Kern
Ludwig wrote: > In pseudo code: > > indexes = where(image1 > 0 and image2 > 0 and sigma < quality) > result[indexes] = i # scalar > > > When I run this numpy tells me that the that the truth value of the array > comparison is ambiguous -- but I do not want to compare the whole arrays here, > bu

[Numpy-discussion] Complex 'where' expression

2007-03-27 Thread Ludwig
A bit new to numpy, trying to move over some IDL code. I have a complex array selection expression, where I need an array of indexes as a result, so I can use this as a selection expression to apply changes to a different array. I have two images, image1 and image2, plus an array sigma, the resul