Skip to content

Commit e3c0172

Browse files
committed
chan_id to channel_id
1 parent 693f1a1 commit e3c0172

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

neo/rawio/intanrawio.py

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,24 @@
3333

3434
class IntanRawIO(BaseRawIO):
3535
"""
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
36+
Intan reader can handle two file formats 'rhd' and 'rhs'. It will automatically
4637
check for the file extension and will gather the header information based on the
4738
extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0,
4839
3.0, and 3.1 files.
49-
50-
* Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D'
40+
Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D'
5141
depending on the port in which they were recorded along with the following
5242
additional channels.
53-
0: 'RHD2000' amplifier channel
5443
1: 'RHD2000 auxiliary input channel',
5544
2: 'RHD2000 supply voltage channel',
5645
3: 'USB board ADC input channel',
5746
4: 'USB board digital input channel',
5847
5: 'USB board digital output channel'
59-
60-
* Due to the structure of the digital input and output channels these can be accessed
48+
Due to the structure of the digital input and output channels these can be accessed
6149
as one long vector, which must be post-processed.
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-
50+
Parameters
51+
----------
52+
filename: str
53+
name of the 'rhd' or 'rhs' data file
7354
"""
7455

7556
extensions = ["rhd", "rhs"]
@@ -105,7 +86,7 @@ def _parse_header(self):
10586
signal_channels = []
10687
for c, chan_info in enumerate(self._ordered_channels):
10788
name = chan_info["custom_channel_name"]
108-
chan_id = chan_info["native_channel_name"]
89+
channel_id = chan_info["native_channel_name"]
10990
if chan_info["signal_type"] == 20:
11091
# exception for temperature
11192
sig_dtype = "int16"
@@ -115,7 +96,7 @@ def _parse_header(self):
11596
signal_channels.append(
11697
(
11798
name,
118-
chan_id,
99+
channel_id,
119100
chan_info["sampling_rate"],
120101
sig_dtype,
121102
chan_info["units"],
@@ -468,7 +449,10 @@ def read_rhd(filename):
468449

469450
global_info = read_variable_header(f, rhd_global_header_base)
470451

471-
version = V(f"{global_info['major_version']}.{global_info['minor_version']}")
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}")
472456

473457
# the header size depends on the version :-(
474458
header = list(rhd_global_header_part1) # make a copy
@@ -552,7 +536,7 @@ def read_rhd(filename):
552536

553537
# temperature is not an official channel in the header
554538
for i in range(global_info["num_temp_sensor_channels"]):
555-
name = f"temperature_{i}"
539+
name = "temperature_{}".format(i)
556540
chan_info = {"native_channel_name": name, "signal_type": 20}
557541
chan_info["sampling_rate"] = sr / BLOCK_SIZE
558542
chan_info["units"] = "Celsius"

0 commit comments

Comments
 (0)