3333
3434class IntanRawIO (BaseRawIO ):
3535 """
36- Intan reader can handle two file formats 'rhd' and 'rhs'. It will automatically
36+ Class for reading rhd and rhs Intan data
37+
38+ Parameters
39+ ----------
40+ filename: str, default: ''
41+ name of the 'rhd' or 'rhs' data file
42+
43+ Notes
44+ -----
45+ * Intan reader can handle two file formats 'rhd' and 'rhs'. It will automatically
3746 check for the file extension and will gather the header information based on the
3847 extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0,
3948 3.0, and 3.1 files.
40- Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D'
49+
50+ * Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D'
4151 depending on the port in which they were recorded along with the following
4252 additional channels.
53+ 0: 'RHD2000' amplifier channel
4354 1: 'RHD2000 auxiliary input channel',
4455 2: 'RHD2000 supply voltage channel',
4556 3: 'USB board ADC input channel',
4657 4: 'USB board digital input channel',
4758 5: 'USB board digital output channel'
48- Due to the structure of the digital input and output channels these can be accessed
59+
60+ * Due to the structure of the digital input and output channels these can be accessed
4961 as one long vector, which must be post-processed.
50- Parameters
51- ----------
52- filename: str
53- name of the 'rhd' or 'rhs' data file
62+
63+ Examples
64+ --------
65+ >>> import neo.rawio
66+ >>> reader = neo.rawio.IntanRawIO(filename='data.rhd')
67+ >>> reader.parse_header()
68+ >>> raw_chunk = reader.get_analogsignal_chunk(block_index=0,
69+ seg_index=0
70+ stream_index=0)
71+ >>> float_chunk = reader.rescale_signal_raw_to_float(raw_chunk, stream_index=0)
72+
5473 """
5574
5675 extensions = ["rhd" , "rhs" ]
@@ -86,7 +105,7 @@ def _parse_header(self):
86105 signal_channels = []
87106 for c , chan_info in enumerate (self ._ordered_channels ):
88107 name = chan_info ["custom_channel_name" ]
89- channel_id = chan_info ["native_channel_name" ]
108+ chan_id = chan_info ["native_channel_name" ]
90109 if chan_info ["signal_type" ] == 20 :
91110 # exception for temperature
92111 sig_dtype = "int16"
@@ -96,7 +115,7 @@ def _parse_header(self):
96115 signal_channels .append (
97116 (
98117 name ,
99- channel_id ,
118+ chan_id ,
100119 chan_info ["sampling_rate" ],
101120 sig_dtype ,
102121 chan_info ["units" ],
@@ -449,10 +468,7 @@ def read_rhd(filename):
449468
450469 global_info = read_variable_header (f , rhd_global_header_base )
451470
452- # This is a package.version object that allows lexicographic comparison
453- major_version = global_info ["major_version" ]
454- minor_version = global_info ["minor_version" ]
455- version = V (f"{ major_version } .{ minor_version } " )
471+ version = V (f"{ global_info ['major_version' ]} .{ global_info ['minor_version' ]} " )
456472
457473 # the header size depends on the version :-(
458474 header = list (rhd_global_header_part1 ) # make a copy
@@ -536,7 +552,7 @@ def read_rhd(filename):
536552
537553 # temperature is not an official channel in the header
538554 for i in range (global_info ["num_temp_sensor_channels" ]):
539- name = "temperature_{}" . format ( i )
555+ name = f "temperature_{ i } "
540556 chan_info = {"native_channel_name" : name , "signal_type" : 20 }
541557 chan_info ["sampling_rate" ] = sr / BLOCK_SIZE
542558 chan_info ["units" ] = "Celsius"
0 commit comments