Skip to content

Commit c22ed5e

Browse files
authored
Create filtering
1 parent f4415a7 commit c22ed5e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

filtering

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import scipy.signal as sps
2+
3+
def butter_bandpass(lowcut, highcut, fs, order=5):
4+
nyq = 0.5 * fs
5+
low = lowcut/nyq
6+
high = highcut/nyq
7+
b, a = sps.butter(order, [low, high], btype = 'bandpass')
8+
return b, a
9+
10+
def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
11+
b, a = butter_bandpass(lowcut, highcut, fs, order=order)
12+
y = sps.filtfilt(b, a, data)
13+
return y

0 commit comments

Comments
 (0)