Skip to content

Commit 27a6a76

Browse files
committed
#21 Add test_qc2
1 parent c87b34f commit 27a6a76

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tests/test_herg_qc.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,30 @@ def passed(result):
9393
)
9494

9595
def test_qc2(self):
96-
pass
96+
plot_dir = os.path.join(self.output_dir, "test_qc2")
97+
if not os.path.exists(plot_dir):
98+
os.makedirs(plot_dir)
99+
100+
hergqc = hERGQC(sampling_rate=self.sampling_rate,
101+
plot_dir=plot_dir,
102+
voltage=self.voltage)
103+
104+
# qc2 checks that raw and subtracted SNR are above a minimum threshold
105+
recording = np.asarray([0, 1] * 500 + [0, 10] * 500) # snr = 70.75
106+
result = hergqc.qc2(recording)
107+
self.assertTrue(result[0], f"({result[1]})")
108+
109+
recording = np.asarray([0, 1] * 500 + [0, 6.03125] * 500) # snr = 25.02
110+
result = hergqc.qc2(recording)
111+
self.assertTrue(result[0], f"({result[1]})")
112+
113+
recording = np.asarray([0, 1] * 500 + [0, 6.015625] * 500) # snr = 24.88
114+
result = hergqc.qc2(recording)
115+
self.assertFalse(result[0], f"({result[1]})")
116+
117+
recording = np.asarray([0, 1] * 1000) # snr = 1.0
118+
result = hergqc.qc2(recording)
119+
self.assertFalse(result[0], f"({result[1]})")
97120

98121
def test_qc3(self):
99122
pass

0 commit comments

Comments
 (0)