Re: [Numpy-discussion] equivalent to isempty command in matlab (newbie question), (Robert Kern)

2006-12-07 Thread Francesc Altet
El dj 07 de 12 del 2006 a les 11:36 +0100, en/na Giorgio Luciano va escriure: > Does it exist a workaround for that to make numpy understand when an > array is empty ? > Giorgio > I guess there should be many. One possibility is to use .size: In [9]:a=numpy.array([]) In [10]:a.size == False Out

Re: [Numpy-discussion] equivalent to isempty command in matlab (newbie question), (Robert Kern)

2006-12-07 Thread Giorgio Luciano
t; From: Robert Kern <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] equivalent to isempty command in > matlab (newbie question) > To: Discussion of Numerical Python > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=UTF-8 > > Filip Wasile

Re: [Numpy-discussion] equivalent to isempty command in matlab (newbie question)

2006-12-06 Thread Filip Wasilewski
On 12/6/06, Robert Kern <[EMAIL PROTECTED]> wrote: > Filip Wasilewski wrote: > > > Just like for other Python objects: > > > > if ifs3: > >print "not empty" > > No, that doesn't work. numpy arrays do not have a truth value. They raise an > error when you try to use them in such a context. Righ

Re: [Numpy-discussion] equivalent to isempty command in matlab (newbie question)

2006-12-06 Thread Robert Kern
Filip Wasilewski wrote: > Just like for other Python objects: > > if ifs3: >print "not empty" No, that doesn't work. numpy arrays do not have a truth value. They raise an error when you try to use them in such a context. -- Robert Kern "I have come to believe that the whole world is an en

Re: [Numpy-discussion] equivalent to isempty command in matlab (newbie question)

2006-12-06 Thread Filip Wasilewski
On 12/6/06, Giorgio Luciano <[EMAIL PROTECTED]> wrote: > Today I've also posted a question to scipy groups because I've thought > I've found a solution but > > this work good > > bar(N, b1[:,0], width, color='r', yerr=binterv) > > s3=find(sig1[:,arange(ini,c)]<=0.001) Just a few ti

Re: [Numpy-discussion] equivalent to isempty command in matlab (newbie question)

2006-12-06 Thread Robert Kern
Giorgio Luciano wrote: > Today I've also posted a question to scipy groups because I've thought > I've found a solution but > > this work good > > bar(N, b1[:,0], width, color='r', yerr=binterv) > > s3=find(sig1[:,arange(ini,c)]<=0.001) > b1=b.flatten() > #if s3!=[]: > for i3

[Numpy-discussion] equivalent to isempty command in matlab (newbie question)

2006-12-06 Thread Giorgio Luciano
Today I've also posted a question to scipy groups because I've thought I've found a solution but this work good bar(N, b1[:,0], width, color='r', yerr=binterv) s3=find(sig1[:,arange(ini,c)]<=0.001) b1=b.flatten() #if s3!=[]: for i3 in arange(len(s3)): text(s3[i3], b1[s3[i3]+