Scipy butterworth Bandpass filter

155 Views Asked by At

I am new to butterworth filter and want to know my result specifically.

The data has columns of date and relative velocity variation. (The number of rows is 764)

data=pd.read_csv('dtt_median_ZZ-f1-m10_f07_1.csv')
date=data.Date
data=data.M*(-100)

def butter_bandpass(lowcut, highcut, fs, order=5):
    nyq=0.5*fs
    low=lowcut/nyq
    high=highcut/nyq
    b,a=butter(order, [low,high],btype='band')
    return b, a

def butter_bandpass_filter(data,lowcut,highcut,fs,order=5):
    b,a = butter_bandpass(lowcut, highcut, fs, order=order)
    y=lfilter(b,a,data)
    return y

F=butter_bandpass_filter(data, 1, 20, 200, 3)
#print(F)


plt.plot(date, F)
plt.show()

enter image description here

  1. I want to specify whether the x axis is frequency domain or time domain.

  2. If it is frequency domain, is there any way to transform it to time domain (fft?) Because I have to control the period to see the variation during the period

  3. The sampling rate that I used for getting data was 200Hz but I think the sampling rate in this code is different with it. So what would be the variation of the fq(sampling rate)?

  4. What would be the normal variation of lowcut, highcut? I used 0.7-1.0Hz to export data from raw data. But I think I have to use different variation of frequency.

0

There are 0 best solutions below