Skip to content

Commit 47babf3

Browse files
author
Thinh Nguyen
committed
added assertion - safeguard against failed loading of continuous.dat
1 parent cd5fe70 commit 47babf3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

element_array_ephys/readers/openephys.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def load_probe_data(self):
8686
for probe_index in range(len(processor['EDITOR']['PROBE'])):
8787
probe = Probe(processor, probe_index)
8888
probes[probe.probe_SN] = probe
89-
else:
89+
else: # Neuropix-PXI
9090
for probe_index in range(len(processor['EDITOR']['NP_PROBE'])):
9191
probe = Probe(processor, probe_index)
9292
probes[probe.probe_SN] = probe
@@ -96,6 +96,11 @@ def load_probe_data(self):
9696
probe = probes[probe_SN]
9797

9898
for rec in self.experiment.recordings:
99+
assert len(rec._oebin['continuous']) == len(rec.analog_signals), \
100+
f'Mismatch in the number of continuous data' \
101+
f' - expecting {len(rec._oebin["continuous"])} (from structure.oebin file),' \
102+
f' found {len(rec.analog_signals)} (in continuous folder)'
103+
99104
for continuous_info, analog_signal in zip(rec._oebin['continuous'],
100105
rec.analog_signals):
101106
if continuous_info['source_processor_id'] != probe.processor_id:
@@ -170,7 +175,7 @@ def __init__(self, processor, probe_index=0):
170175
self.probe_model = _probe_model_name_mapper[processor['@pluginName']]
171176
self._channels_connected = {int(re.search(r'\d+$', k).group()): int(v)
172177
for k, v in self.probe_info.pop('CHANNELSTATUS').items()}
173-
else:
178+
else: # Neuropix-PXI
174179
self.probe_info = processor['EDITOR']['NP_PROBE'][probe_index]
175180
self.probe_SN = self.probe_info['@probe_serial_number']
176181
self.probe_model = _probe_model_name_mapper[self.probe_info['@probe_name']]

0 commit comments

Comments
 (0)