赞
踩
- import scipy.signal as signal
-
- # 定义滤波器
- def butter_bandpass(lowcut, highcut, fs, order):
- nyq = 0.5*fs
- low = lowcut/nyq
- high = highcut/nyq
- b, a = signal.butter(8, [low, high], 'bandpass')
- return b, a
-
- # 将data数据应用到滤波器上
- def butter_bandpass_filter(data, lowcut, highcut, fs, order):
- b, a = butter_bandpass(lowcut, highcut, fs, order)
- y = signal.filtfilt(b, a, data, axis=2)
- return y
网上找的代码,一般在脑电数据处理的时候使用。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。