Why is this fringe behavior happening when I am filtering a matrix of data with Butterworth filter using scipy's Python?

259 Views Asked by At

I am high-pass filtering a matrix of data using Python 3.7 with scipy 1.6 (using signal.butter and signal.cheby2). When I plot the filtered data using imshow(), an undesired fringe behavior occurs on the left edge of the data (input data on the left, filtered data on the right):

On the left side, the original data; on the right side, the filtered data

Such fringe behavior becomes more visible as filter order increases and it is a problem for the signal processing pipeline because the filtered data is then binarized (filtered data on the left, binarized filtered data on the right):

On the left side, the filtered data; on the right side, the binarized filtered data

The main issue is that in the binarized data, I get true signal mixed with the fringes from the filtering.

My doubts are: why is this behavior hapenning and is it possible to suppress it? how?

Additional details:

Code

sos = butter(order, wCutoff, 'hp', fs=defines.FS, output='sos')
filtered = sosfilt(sos, data)

Bode plot of the filter

0

There are 0 best solutions below