consecutive filtered blocks with filtfilt I'm doing basic signal processing in Python. I'm filtering consecutive blocks of a signal with scipy's filtfilt (to get zero phase). I would like to concatenate several blocks after filtering, however, each filtered block doesn't seem to be properly continuous with the other filtered blocks. Is there some way to work this out?

I'd like to note that when I'm doing the same with scipy's lfilter with "Initial Conditions"(zi) parameter being passed to it at each iteration the filtered blocks seems to be continuous.

Any help will be highly appreciated. 

Mike
Both the SciPy and MATLAB implementations of filtfilt use a mirrored part of the beginning and end of the signal (roughly with a length equal to the impulse response of the filter) to reduce the effect of initial conditions on the filtered signal (i.e. to reduce ringing the signal is artificially lengthened by concatenating mirrored parts of the signal).

As these mirrored signal parts are probably not equal to the data in the previous and subsequent data blocks, concatenation of the filtered blocks will not result in a continuous signal. 

A possible workaround might be to select longer data blocks from the original signal and discard a part from the beginning and end after application of the filter but before concatenation. Note that this might require a FIR filter to work properly although I would expect acceptable results for a IIR filter if the data block can be made long enough.