赞
踩
网上找的
-
- 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
-
-
- 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
data格式:[trial,channel,time]
其中,[lowcut,highcut]指的是频率区域,fs是采样率,order是阶数。
使用的时候,把要滤波的data放进butter_bandpass()即可。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。