Skip to content

Commit de09cdf

Browse files
committed
update streams post buffer api
1 parent 43f2c36 commit de09cdf

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

neo/rawio/neuronexusrawio.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,27 @@ def _parse_header(self):
167167
signal_channels = []
168168
channel_info = self.metadata["sapiens_base"]["biointerface_map"]
169169

170-
# as per dicussion with the Neo/SpikeInterface teams stream_id will become buffer_id
171-
# and because all data is stored in the same buffer stream for the moment all channels
172-
# will be in stream_id = 0. In the future this will be split into sub_streams based on
173-
# type but for now it will be the end-users responsability for this.
174-
stream_id = "0" # hard-coded see note above
170+
# NeuroNexus uses a single buffer for all file types. Now that we buffer API
171+
# we divide each Allego signal into it's appropriate stream for the end-user
175172
buffer_id = "0"
176173
for channel_index, channel_name in enumerate(channel_info["chan_name"]):
177174
channel_id = channel_info["ntv_chan_name"][channel_index]
178175
# 'ai0' indicates analog data which is stored as microvolts
179176
if channel_info["chan_type"][channel_index] == "ai0":
180177
units = "uV"
178+
stream_id = "0"
181179
# 'd' means digital. Per discussion with neuroconv users the use of
182180
# 'a.u.' makes the units clearer
183-
elif channel_info["chan_type"][channel_index][0] == "d":
181+
elif channel_info["chan_type"][channel_index][:2] == "di":
184182
units = "a.u."
185-
# aux channel
183+
stream_id = "1"
184+
elif channel_info["chan_type"][channel_index][:2] == "do":
185+
# aux channel
186+
units = "a.u."
187+
stream_id = "2"
186188
else:
187189
units = "V"
190+
stream_id = "3"
188191

189192
signal_channels.append(
190193
(
@@ -297,4 +300,9 @@ def _get_analogsignal_buffer_description(self, block_index, seg_index, buffer_id
297300
# this is pretty useless right now, but I think after a
298301
# refactor with sub streams we could adapt this for the sub-streams
299302
# so let's leave this here for now :)
300-
stream_id_to_stream_name = {"0": "Neuronexus Allego Data"}
303+
stream_id_to_stream_name = {
304+
"0": "Neuronexus Allego Analog (pri) Data",
305+
"1": "NeuroNexus Allego Digital-in (din) Data",
306+
"2": "NeuroNexus Allego Digital-out (dout) Data",
307+
"3": "NeuroNexus Allego Auxiliary (aux) Data",
308+
}

0 commit comments

Comments
 (0)