Skip to content

Commit 2022e91

Browse files
author
Thinh Nguyen
committed
openephys loader - handles signalchain and processor as single element or list
1 parent 1c39568 commit 2022e91

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

element_array_ephys/readers/openephys.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def recording_time(self):
5858

5959
def load_probe_data(self):
6060
"""
61-
Loop through all Open Ephys "processors", identify the processor for
61+
Loop through all Open Ephys "signalchains/processors", identify the processor for
6262
the Neuropixels probe(s), extract probe info
6363
Loop through all recordings, associate recordings to
6464
the matching probes, extract recording info
@@ -68,16 +68,23 @@ def load_probe_data(self):
6868
"""
6969

7070
probes = {}
71-
for processor in self.experiment.settings['SIGNALCHAIN']['PROCESSOR']:
72-
if processor['@pluginName'] in ('Neuropix-PXI', 'Neuropix-3a'):
73-
if (processor['@pluginName'] == 'Neuropix-3a'
74-
or 'NP_PROBE' not in processor['EDITOR']):
75-
probe = Probe(processor)
76-
probes[probe.probe_SN] = probe
77-
else:
78-
for probe_index in range(len(processor['EDITOR']['NP_PROBE'])):
79-
probe = Probe(processor, probe_index)
71+
sigchain_iter = (self.experiment.settings['SIGNALCHAIN']
72+
if isinstance(self.experiment.settings['SIGNALCHAIN'], list)
73+
else [self.experiment.settings['SIGNALCHAIN']])
74+
for sigchain in sigchain_iter:
75+
processor_iter = (sigchain['PROCESSOR']
76+
if isinstance(sigchain['PROCESSOR'], list)
77+
else [sigchain['PROCESSOR']])
78+
for processor in processor_iter:
79+
if processor['@pluginName'] in ('Neuropix-PXI', 'Neuropix-3a'):
80+
if (processor['@pluginName'] == 'Neuropix-3a'
81+
or 'NP_PROBE' not in processor['EDITOR']):
82+
probe = Probe(processor)
8083
probes[probe.probe_SN] = probe
84+
else:
85+
for probe_index in range(len(processor['EDITOR']['NP_PROBE'])):
86+
probe = Probe(processor, probe_index)
87+
probes[probe.probe_SN] = probe
8188

8289
for probe_index, probe_SN in enumerate(probes):
8390

0 commit comments

Comments
 (0)