Skip to content

Commit ebebd29

Browse files
committed
fix annotations
1 parent 84efcb8 commit ebebd29

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

neo/rawio/openephysbinaryrawio.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,16 +441,31 @@ def _parse_header(self):
441441
seg_ann = bl_ann["segments"][seg_index]
442442

443443
# array annotations for signal channels
444-
for stream_index, stream_name in enumerate(sig_stream_names):
444+
for stream_index, stream_name in enumerate(self.header["signal_streams"]["name"]):
445445
sig_ann = seg_ann["signals"][stream_index]
446-
info = self._sig_streams[block_index][seg_index][stream_index]
447-
has_sync_trace = self._sig_streams[block_index][seg_index][stream_index]["has_sync_trace"]
446+
if stream_index < self._num_of_signal_streams:
447+
_sig_stream_index = stream_index
448+
is_neural_stream = True
449+
else:
450+
_sig_stream_index = stream_index - self._num_of_signal_streams
451+
is_neural_stream = False
452+
info = self._sig_streams[block_index][seg_index][_sig_stream_index]
453+
has_sync_trace = self._sig_streams[block_index][seg_index][_sig_stream_index]["has_sync_trace"]
448454

449455
for k in ("identifier", "history", "source_processor_index", "recorded_processor_index"):
450456
if k in info["channels"][0]:
451457
values = np.array([chan_info[k] for chan_info in info["channels"]])
458+
459+
452460
if has_sync_trace:
453461
values = values[:-1]
462+
463+
num_neural_channels = sum(1 for ch_info in info["channels"] if "ADC" not in ch_info["channel_name"])
464+
if is_neural_stream:
465+
values = values[:num_neural_channels]
466+
else:
467+
values = values[num_neural_channels:]
468+
454469
sig_ann["__array_annotations__"][k] = values
455470

456471
# array annotations for event channels

0 commit comments

Comments
 (0)