[SciPy-user] filtering without phase shift

Andrew Straw andrew.straw at adelaide.edu.au
Tue Apr 8 02:00:26 EDT 2003


I trying to lowpass filter my data without introducing a phase shift.  
I'm not a signal analysis whiz, but I know enough to be dangerous.  So 
far I've come up with the following, which works except that it has 
some serious edge-effects.

     from scipy.signal import lfilter
     from scipy import flipud

     def filtfilt(b, a, input_vector):
         """input_vector has shape (n,1)"""
         forward = lfilter(b, a, input_vector, axis=0)
         return flipud(lfilter(b, a, flipud(forward), axis = 0))

Should I attempt to use the signal.lfiltic to minimize edge effects?  
Or should I maybe use symiirorder1?  Is there any code anywhere that I 
can look at using these functions?

I think the matlab function filtfilt that does what I want.  Is there a 
translation of it to scipy anywhere?

Cheers!
Andrew




More information about the SciPy-User mailing list