File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from emgdecompy import preprocessing as emg
55import numpy as np
66from 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
187206def test_center_matrix ():
You can’t perform that action at this time.
0 commit comments