[SciPy-user] Matlab function detrend

Nils Wagner nwagner at mecha.uni-stuttgart.de
Wed Aug 14 06:52:31 CDT 2002


Pearu Peterson schrieb:
> 
> On Wed, 14 Aug 2002, Nils Wagner wrote:
> 
> > There seems to be a problem with detrend
> >
> > dgelss:lwork=134
> > Traceback (most recent call last):
> >   File "io.py", line 36, in ?
> >     detrend_intyou = signal.detrend(intyou,-1,'linear')
> >   File
> > "/usr/local/lib/python2.1/site-packages/scipy/signal/signaltools.py",
> > line 1107, in detrend
> >     coef,resids,rank,s = linalg.lstsq(A,newdata[sl])
> >   File "/usr/local/lib/python2.1/site-packages/scipy/linalg/basic.py",
> > line 277, in lstsq
> >     overwrite_b = overwrite_b)
> > flapack.error: (lwork>=3*minmn+MAX(2*minmn,MAX(maxmn,nrhs))) failed for
> > 2nd keyword lwork
> >
> > Any idea or suggestion ?
> 
> What is intyou? 


An array of what type and shape? 

you = zeros(4096,Float)
.... skipped 
intyou = cumsum(you)*h

Also, what lapack are you
> using? 
I am using ATLAS

Is scipy.linalg.test(1) succesful?
Yes
> 
> detrend works here:
> 
> >>> scipy.signal.detrend(array([1,2,3,4,6,7],'d'),-1,'linear')
> array([ 0.23809524,  0.00952381, -0.21904762, -0.44761905,  0.32380952,
> 0.0952381 ])
> 
I get the same result.


> Travis, is there any reasons to keep the line #1105 as
>             A = ones((Npts,2),'d')
> and not
>             A = ones((Npts,2),data.typecode())
> ? Or may be data should be set to 'd' from the beginning? Is detrend
> supposed to work with complex input as well?
> 
> These questions arised when I used a list of integers as an input to
> detrend:
> >>> scipy.signal.detrend([1,2,3,4,6,7],-1,'linear')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File
> "/home/peterson/opt/lib/python2.2/site-packages/scipy/signal/signaltools.py",
> line 1108, in detrend
>     newdata[sl] = newdata[sl] - dot(A,coef)
> TypeError: Array can not be safely cast to required type
> 
> Regards,
>         Pearu
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user



More information about the SciPy-user mailing list