Skip to content

Commit 2d62f2a

Browse files
committed
add failing test
1 parent 685fd3d commit 2d62f2a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

neo/test/rawiotest/test_intanrawio.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
import numpy as np
3+
from pathlib import Path
34

45
from neo.rawio.intanrawio import IntanRawIO
56
from neo.test.rawiotest.common_rawio_test import BaseTestRawIO
@@ -66,6 +67,23 @@ def test_annotations(self):
6667
)
6768
np.testing.assert_array_equal(signal_array_annotations["board_stream_num"][:10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
6869

70+
71+
def test_correct_reading_one_file_per_channel(self):
72+
# Test reading of one-file-per-channel format file. The channels should match the raw files
73+
file_path = Path(self.get_local_path("intan/intan_fpc_test_231117_052630/info.rhd"))
74+
intan_reader = IntanRawIO(filename=file_path)
75+
intan_reader.parse_header()
76+
77+
# This should be the folder where the files of all the channels are stored
78+
folder_path = file_path.parent
79+
amplifier_file_paths = [p for p in folder_path.iterdir() if "amp" in p.name]
80+
81+
channel_names = [p.name[4:-4] for p in amplifier_file_paths]
82+
83+
for channel_name, amplifier_file_path in zip(channel_names, amplifier_file_paths):
84+
data_raw = np.fromfile(amplifier_file_path, dtype=np.int16).squeeze()
85+
data_from_neo = intan_reader.get_analogsignal_chunk(channel_ids=[channel_name], stream_index=0).squeeze()
86+
np.testing.assert_allclose(data_raw, data_from_neo)
6987

7088
if __name__ == "__main__":
7189
unittest.main()

0 commit comments

Comments
 (0)