Skip to content

Commit f0dda32

Browse files
committed
test: final decomp test + minor comment edits
1 parent 54d6d0b commit f0dda32

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

tests/test_decomposition.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sklearn.datasets import make_blobs
1313
from sklearn.cluster import KMeans
1414

15-
# Note: Fixtures are special pytest objects calld into individual tests,
15+
# Note: Fixtures are special pytest objects called into individual tests,
1616
# they are useful when data is required to test a function
1717

1818

@@ -442,3 +442,21 @@ def test_silhouette_score():
442442
assert np.isclose(
443443
sil, sil_by_hand
444444
), "Inter and intra distances incorrectly calculated."
445+
446+
def test_decomposition():
447+
"""
448+
Run unit test on decomposition function from EMGdecomPy.
449+
"""
450+
# load data
451+
gl_10 = loadmat("data/raw/GL_10.mat")
452+
raw = gl_10["SIG"]
453+
454+
decompose = emg.decomposition.decomposition(raw, M=3, R=2)
455+
keys = list(decompose.keys())
456+
457+
assert type(decompose) == dict, "Incorrect object returned."
458+
assert keys == ['B', 'MUPulses', 'SIL', 'PNR'], "Incorrect keys returned."
459+
assert type(decompose['B']) == np.ndarray, "Incorrect datatype returned in B key."
460+
assert type(decompose['MUPulses']) == np.ndarray, "Incorrect datatype returned in MUPulses key."
461+
assert type(decompose['SIL']) == np.ndarray, "Incorrect datatype returned in B key."
462+
assert type(decompose['PNR']) == np.ndarray, "Incorrect datatype returned in PNR key."

tests/test_viz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import panel
99
import pytest
1010

11-
# Note: Fixtures are special PyTest objects calld into individual tests,
11+
# Note: Fixtures are special PyTest objects called into individual tests,
1212
# they are useful when data is repeatedly required to test functions
1313

1414

0 commit comments

Comments
 (0)