[SciPy-User] scipy.signal.filtfilt small off by one error

Paul Northug pnorthug at gmail.com
Wed Feb 23 23:03:49 EST 2011


I am using scipy 0.8.0 on a Mac. I am not sure, but there may be very 
small error in this function in the line,

 s=r_[2*x[0]-x[edge:1:-1],x,2*x[-1]-x[-1:-edge:-1]]

should be,

s=r_[2*x[0]-x[edge-1:0:-1],x,2*x[-1]-x[-1:-edge:-1]]

The intent is to take a signal x and pad it on both sides with negative 
mirrors of the ends of x of length edge. I have checked that this function 
doesn't produce the same output as matlab's filtfilt on the boundaries 
and it looks from the code that the intention was to match matlab.

If someone with better python knowledge could check this, that would 
be great and I can put in a bug report if necessary.




More information about the SciPy-User mailing list