def butter_lowpass_filter(data, cut, fs, order, zero_phase=False):
from scipy.signal import butter, lfilter, filtfilt
nyq = 0.5 * fs
cut = cut / nyq
b, a = butter(order, cut, btype='low')
y = (filtfilt if zero_phase else lfilter)(b, a, data)
return y
评论列表
文章目录