[Numpy-discussion] The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

2010-10-27 Thread Rick Muller
Help! I'm having a problem in searching through the *elements* if a 2d array. I have a loop over a numpy array: n,m = G.shape print n,m for i in xrange(n): for j in xrange(m): print type(G), type(G[i,j]), type(float(G[i,j])) g = float(abs(G[i,j]))

Re: [Numpy-discussion] The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

2010-10-27 Thread Robert Kern
On Wed, Oct 27, 2010 at 15:58, Rick Muller rpmul...@gmail.com wrote: Help! I'm having a problem in searching through the *elements* if a 2d array. I have a loop over a numpy array:     n,m = G.shape     print n,m     for i in xrange(n):     for j in xrange(m):     print

Re: [Numpy-discussion] The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

2010-10-27 Thread Zachary Pincus
Help! I'm having a problem in searching through the *elements* if a 2d array. I have a loop over a numpy array: n,m = G.shape print n,m for i in xrange(n): for j in xrange(m): print type(G), type(G[i,j]), type(float(G[i,j])) g =

Re: [Numpy-discussion] The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

2010-10-27 Thread Rick Muller
Robert, Zachary, Thanks for the quick help. I tried to write a little self-contained example of the crash, but it wasn't working. (I'm sure you've already figured out how this ends.) When I tracked down why it wasn't working, I found my bug. Turned out that cut, which I assumed was just a small