[SciPy-user] Matlab function detrend

Travis Oliphant oliphant.travis at ieee.org
Wed Aug 14 10:52:01 CDT 2002


On Wed, 2002-08-14 at 05:23, Pearu Peterson wrote:
> 
> 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? Also, what lapack are you
> using? Is scipy.linalg.test(1) succesful?
> 
> 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 ])
> 
> 
> 
> Travis, is there any reasons to keep the line #1105 as
>             A = ones((Npts,2),'d')
> and not
>             A = ones((Npts,2),data.typecode())

I haven't made this to work with any other datatype.  It should
definitely be done, though.

-Travis





More information about the SciPy-user mailing list