Skip to content

Commit b50ac80

Browse files
committed
Sam's suggestion
1 parent 9b09a51 commit b50ac80

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

neo/rawio/neuronexusrawio.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,11 @@ def _parse_header(self):
132132
self._n_samples, self._n_channels = self.metadata["status"]["shape"]
133133
# Stored as a simple float32 binary file
134134
BINARY_DTYPE = "float32"
135+
TIMESTAMP_DTYPE = "int64" # this is from the allego sample reader timestamps are np.int64
135136
binary_file = self.binary_file
136137
timestamp_file = self.timestamp_file
137138

138-
# the will cretae a memory map with teh generic mechanism
139+
# the will cretae a memory map with the generic mechanism
139140
buffer_id = "0"
140141
self._buffer_descriptions = {0: {0: {}}}
141142
self._buffer_descriptions[0][0][buffer_id] = {
@@ -149,7 +150,7 @@ def _parse_header(self):
149150
# Make the memory map for timestamp
150151
self._timestamps = np.memmap(
151152
timestamp_file,
152-
dtype=np.int64, # this is from the allego sample reader timestamps are np.int64
153+
dtype=TIMESTAMP_DTYPE,
153154
mode="r",
154155
offset=0, # headerless binary file
155156
)
@@ -173,21 +174,22 @@ def _parse_header(self):
173174
for channel_index, channel_name in enumerate(channel_info["chan_name"]):
174175
channel_id = channel_info["ntv_chan_name"][channel_index]
175176
# 'ai0' indicates analog data which is stored as microvolts
177+
# sometimes also called the pri data for NeuroNexus terminology
176178
if channel_info["chan_type"][channel_index] == "ai0":
177179
units = "uV"
178-
stream_id = "0"
180+
stream_id = "ai-pri"
179181
# 'd' means digital. Per discussion with neuroconv users the use of
180182
# 'a.u.' makes the units clearer
181183
elif channel_info["chan_type"][channel_index][:2] == "di":
182184
units = "a.u."
183-
stream_id = "1"
185+
stream_id = "di"
184186
elif channel_info["chan_type"][channel_index][:2] == "do":
185187
# aux channel
186188
units = "a.u."
187-
stream_id = "2"
189+
stream_id = "do"
188190
else:
189191
units = "V"
190-
stream_id = "3"
192+
stream_id = "aux"
191193

192194
signal_channels.append(
193195
(
@@ -299,8 +301,8 @@ def _get_analogsignal_buffer_description(self, block_index, seg_index, buffer_id
299301

300302
# here we map the stream_id to the more descriptive stream_name
301303
stream_id_to_stream_name = {
302-
"0": "NeuroNexus Allego Analog (pri) Data",
303-
"1": "NeuroNexus Allego Digital-in (din) Data",
304-
"2": "NeuroNexus Allego Digital-out (dout) Data",
305-
"3": "NeuroNexus Allego Auxiliary (aux) Data",
304+
"ai-pri": "NeuroNexus Allego Analog (pri) Data",
305+
"di": "NeuroNexus Allego Digital-in (din) Data",
306+
"do": "NeuroNexus Allego Digital-out (dout) Data",
307+
"aux": "NeuroNexus Allego Auxiliary (aux) Data",
306308
}

0 commit comments

Comments
 (0)