Re: [Numpy-discussion] Indices returned by where()

2006-12-06 Thread Charles R Harris
On 12/6/06, Christian Marquardt <[EMAIL PROTECTED]> wrote: Dear list, apologies if the answer to my question is obvious... Is the following intentional? $>python Python 2.4 (#1, Mar 22 2005, 21:42:42) [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright",

Re: [Numpy-discussion] Overlapping copy with object_ arrays

2006-12-06 Thread Travis Oliphant
James Flowers wrote: > Hello, > > Having a problem with overlapping copies. Memory being freed twice > ??? See below: Thanks for the test. This problem is fixed and will be checked into SVN as soon as I can figure out why I'm not able to access SVN from my work machine. The problem is tha

Re: [Numpy-discussion] Resizing without allocating additional memory

2006-12-06 Thread David Huard
Thanks Travis, I guess we'll have to tweak the fortran subroutines. It would have been neat though. David Answer: Since g+=1 adds one to all N elements of g, the buffer a gets incremented N times. So a = array(i) g = ndarray(shape=(1,N), dtype=int, buffer=a, strides=(0,0)) g+=M returns i + M*N

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] Resizing without allocating additional memory

2006-12-06 Thread Travis Oliphant
David Huard wrote: > Hi, > > I have fortran subroutines wrapped with f2py that take arrays as > arguments, and I often need to use resize(a, N) to pass an array of > copies of an element. The resize call , however, is becoming the speed > bottleneck, so my question is: > Is it possible to creat

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] Indices returned by where()

2006-12-06 Thread Christian Marquardt
Dear list, apologies if the answer to my question is obvious... Is the following intentional? $>python Python 2.4 (#1, Mar 22 2005, 21:42:42) [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import num

[Numpy-discussion] Resizing without allocating additional memory

2006-12-06 Thread David Huard
Hi, I have fortran subroutines wrapped with f2py that take arrays as arguments, and I often need to use resize(a, N) to pass an array of copies of an element. The resize call , however, is becoming the speed bottleneck, so my question is: Is it possible to create an (1xN) array from a scalar with

[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]+