11import unittest
2- import numpy as np
2+ import numpy as np
33
44from neo .rawio .intanrawio import IntanRawIO
55from neo .test .rawiotest .common_rawio_test import BaseTestRawIO
@@ -12,32 +12,46 @@ class TestIntanRawIO(
1212 rawioclass = IntanRawIO
1313 entities_to_download = ["intan" ]
1414 entities_to_test = [
15- "intan/intan_rhs_test_1.rhs" , # Format header-attached
15+ "intan/intan_rhs_test_1.rhs" , # Format header-attached
1616 "intan/intan_rhd_test_1.rhd" , # Format header-attached
1717 "intan/rhs_fpc_multistim_240514_082243/rhs_fpc_multistim_240514_082243.rhs" , # Format header-attached newer version
1818 "intan/intan_fpc_test_231117_052630/info.rhd" , # Format one-file-per-channel
1919 "intan/intan_fps_test_231117_052500/info.rhd" , # Format one file per signal
2020 "intan/intan_fpc_rhs_test_240329_091637/info.rhs" , # Format one-file-per-channel
21- "intan/intan_fps_rhs_test_240329_091536/info.rhs" , # Format one-file-per-signal
21+ "intan/intan_fps_rhs_test_240329_091536/info.rhs" , # Format one-file-per-signal
2222 "intan/rhd_fpc_multistim_240514_082044/info.rhd" , # Multiple digital channels one-file-per-channel rhd
2323 ]
2424
25-
2625 def test_annotations (self ):
27-
26+
2827 intan_reader = IntanRawIO (filename = self .get_local_path ("intan/intan_rhd_test_1.rhd" ))
2928 intan_reader .parse_header ()
30-
29+
3130 raw_annotations = intan_reader .raw_annotations
3231 annotations = raw_annotations ["blocks" ][0 ]["segments" ][0 ] # Intan is mono segment
3332 signal_annotations = annotations ["signals" ][0 ] # As in the other exmaples, annotaions are duplicated
34-
35-
33+
3634 # Scalar annotations
37- exepcted_annotations = {'intan_version' : '1.5' , 'desired_impedance_test_frequency' : 1000.0 , 'desired_upper_bandwidth' : 7500.0 , 'note1' : '' , 'notch_filter_mode' : 1 , 'notch_filter' : False , 'nb_signal_group' : 7 ,
38- 'dsp_enabled' : 1 , 'actual_impedance_test_frequency' : 1000.0 , 'desired_lower_bandwidth' : 0.1 , 'note3' : '' , 'actual_dsp_cutoff_frequency' : 1.165828 ,
39- 'desired_dsp_cutoff_frequency' : 1.0 , 'actual_lower_bandwidth' : 0.0945291 , 'eval_board_mode' : 0 , 'note2' : '' , 'num_temp_sensor_channels' : 0 }
40-
35+ exepcted_annotations = {
36+ "intan_version" : "1.5" ,
37+ "desired_impedance_test_frequency" : 1000.0 ,
38+ "desired_upper_bandwidth" : 7500.0 ,
39+ "note1" : "" ,
40+ "notch_filter_mode" : 1 ,
41+ "notch_filter" : False ,
42+ "nb_signal_group" : 7 ,
43+ "dsp_enabled" : 1 ,
44+ "actual_impedance_test_frequency" : 1000.0 ,
45+ "desired_lower_bandwidth" : 0.1 ,
46+ "note3" : "" ,
47+ "actual_dsp_cutoff_frequency" : 1.165828 ,
48+ "desired_dsp_cutoff_frequency" : 1.0 ,
49+ "actual_lower_bandwidth" : 0.0945291 ,
50+ "eval_board_mode" : 0 ,
51+ "note2" : "" ,
52+ "num_temp_sensor_channels" : 0 ,
53+ }
54+
4155 for key in exepcted_annotations :
4256 if isinstance (exepcted_annotations [key ], float ):
4357 self .assertAlmostEqual (signal_annotations [key ], exepcted_annotations [key ], places = 2 )
@@ -47,8 +61,11 @@ def test_annotations(self):
4761 # Array annotations
4862 signal_array_annotations = signal_annotations ["__array_annotations__" ]
4963 np .testing .assert_array_equal (signal_array_annotations ["native_order" ][:10 ], [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ])
50- np .testing .assert_array_equal (signal_array_annotations ["spike_scope_digital_edge_polarity" ][:10 ], [1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ])
64+ np .testing .assert_array_equal (
65+ signal_array_annotations ["spike_scope_digital_edge_polarity" ][:10 ], [1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
66+ )
5167 np .testing .assert_array_equal (signal_array_annotations ["board_stream_num" ][:10 ], [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ])
5268
69+
5370if __name__ == "__main__" :
5471 unittest .main ()
0 commit comments