Skip to content

Commit cbeb19c

Browse files
committed
test: add butter band test
1 parent f0dda32 commit cbeb19c

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/test_preprocessing.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from emgdecompy import preprocessing as emg
55
import numpy as np
66
from scipy import linalg
7+
from scipy.io import loadmat
78

89
# Test script for all functions defined in src/preprocessing.py
910

@@ -182,6 +183,24 @@ def test_flatten_signal():
182183

183184
# Test that empty channel has been removed
184185
assert (m * n) != flat.shape[0], "Empty array not removed"
186+
187+
def test_butter_bandpass_filter():
188+
"""
189+
Run unit test on butter_bandpass_filter function from EMGdecomPy.
190+
"""
191+
192+
gl_10 = loadmat("data/raw/GL_10.mat")
193+
raw = gl_10["SIG"]
194+
195+
# select two channels from raw data
196+
data = raw[1, 1:3]
197+
198+
d = emg.flatten_signal(data)
199+
x = emg.butter_bandpass_filter(d)
200+
201+
assert type(x) == np.ndarray, "Incorrect datatype returned."
202+
assert x.shape == d.shape, "Incorrect shape returned."
203+
185204

186205

187206
def test_center_matrix():

0 commit comments

Comments
 (0)