Re: [Numpy-discussion] Speedup a code using apply_along_axis

2010-02-28 Thread Xavier Gnata
On 02/28/2010 08:17 PM, josef.p...@gmail.com wrote: > On Sun, Feb 28, 2010 at 1:51 PM, Xavier Gnata wrote: > >> Hi, >> >> I'm sure I reinventing the wheel with the following code: >> from numpy import * >> from scipy import polyfit,stats >> >> def f(x,y,z): >>return x+y+z >> M=fromfunction(

Re: [Numpy-discussion] Speedup a code using apply_along_axis

2010-02-28 Thread josef . pktd
On Sun, Feb 28, 2010 at 1:51 PM, Xavier Gnata wrote: > Hi, > > I'm sure I reinventing the wheel with the following code: > from numpy import * > from scipy import polyfit,stats > > def f(x,y,z): >    return x+y+z > M=fromfunction(f,(2000,2000,10)) > > def foo(M): >    ramp=where(M<1000)[0] is thi

[Numpy-discussion] Speedup a code using apply_along_axis

2010-02-28 Thread Xavier Gnata
Hi, I'm sure I reinventing the wheel with the following code: from numpy import * from scipy import polyfit,stats def f(x,y,z): return x+y+z M=fromfunction(f,(2000,2000,10)) def foo(M): ramp=where(M<1000)[0] l=len(ramp) t=arange(l) if(l>1): return polyfit(t,ramp,1)[0]