0
$\begingroup$

I have a large dataframe (7200, 132) and each column is a signal. I want to apply a butterworth filter to each signal, however, I'm not sure how to do this in Python.

When I do it in matlab I can apply the filter to the whole array and it will filter the columns independently, however, I'm not getting the same results when I apply the filter to the whole dataframe in Python... so I assume it's not filtering columns independently.

Here is a sample of the code I am using:

# filter 
fs = 240 #sampling frequency 
order = 2
fc = 6
cut = fc/0.802
adj_fc = cut/(fs/2)

b, a = signal.butter(order, adj_fc,'low')
data_filt  = signal.filtfilt(b, a, raw)

Since I have so many signals (132) I want to filter them all at once and avoid having to call individual columns.

Thanks!

$\endgroup$
  • $\begingroup$ Use numpy.multiply() for element-by-element multiplication and/or adjust the "orientation" of the filter and signal data. I am afraid that the way this question is phrased would make it off topic for DSP.SE $\endgroup$ – A_A Jan 29 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.