[Scipy-tickets] [SciPy] #1529: scipy.signal.convolve behavior in scipy.0.9.0-py2.6 has changed

SciPy Trac scipy-tickets@scipy....
Mon Oct 3 06:17:39 CDT 2011


#1529: scipy.signal.convolve behavior in scipy.0.9.0-py2.6 has changed
--------------------------------------+-------------------------------------
 Reporter:  Fusengammu                |       Owner:  somebody   
     Type:  defect                    |      Status:  new        
 Priority:  normal                    |   Milestone:  Unscheduled
Component:  scipy.signal              |     Version:  0.9.0      
 Keywords:  convolve remez mode same  |  
--------------------------------------+-------------------------------------
 Behavior is not consistent with documentation explaining usage of
 remez and convolve.  mode="same" should produce same size output as input
 (it used to), but now apparently doesn't.  I have access to two versions
 of scipy.  In one of them, the code below produces output I expect (old
 version, python 2.5.2).  In new version, size of output incorrect.

 import numpy as _N
 from scipy.signal import convolve, remez, freqz

 #################################################
 #################################################
 smpf = 1000
 nyqf = smpf/2
 ppntaps = 1200

 ppnidealBP= [0.001, 1, 0.001]
 beWIDE    = (0, 1, 4, 120, 123, nyqf)
 t         = _N.arange(0, 20, 0.001)

 f1        = 150.   #  150 Hz signal
 f2        =  70.   #  150 Hz signal

 twofs     = _N.sin(2*_N.pi*f1*t) + _N.sin(2*_N.pi*f2*t)

 b         = remez(ppntaps, beWIDE, ppnidealBP, Hz=smpf, type="bandpass")
 bp        = convolve(b, twofs, mode="same")

 print len(bp)
 #  on newest scipy for macpython 2.6 (scipy-0.9.0-py2.6.mpkg    MacOS X),
 len == 1200.  Older version of scipy gives me length of 20000.  Since I am
 filtering data, I want the output to be as long as the original data

 #  according to
 #  http://docs.scipy.org/doc/scipy/reference/tutorial/signal.html
 #convolution-correlation
 #  -->>  so that the output has the same length as the largest input  <<--

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1529>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list