Skip to content

Commit e64dafe

Browse files
author
Thinh Nguyen
committed
code cleanup, added docstring & comments to code blocks
1 parent 238a511 commit e64dafe

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

elements_ephys/readers/openephys.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,26 @@ def __init__(self, experiment_dir):
3636
oe_file = pyopenephys.File(self.sess_dir.parent) # this is on the Record Node level
3737

3838
# extract the "recordings" for this session
39-
self.experiment = [experiment for experiment in oe_file.experiments
40-
if pathlib.Path(experiment.absolute_foldername) == self.sess_dir][0]
39+
self.experiment = next(experiment for experiment in oe_file.experiments
40+
if pathlib.Path(experiment.absolute_foldername) == self.sess_dir)
4141

4242
self.recording_time = self.experiment.datetime
4343

4444
# extract probe data
4545
self.probes = self.load_probe_data()
4646

4747
def load_probe_data(self):
48+
"""
49+
Loop through all OpenEphys "processors", identify the processor for neuropixels probe, extract probe info
50+
Loop through all recordings, associate recordings to the matching probes, extract recording info
51+
52+
Yielding multiple "Probe" objects, each containing meta information and timeseries data associated with each probe
53+
"""
54+
4855
probes = {}
4956
for processor in self.experiment.settings['SIGNALCHAIN']['PROCESSOR']:
5057
if processor['@pluginName'] in ('Neuropix-PXI', 'Neuropix-3a'):
5158
oe_probe = Probe(processor)
52-
5359
for rec in self.experiment.recordings:
5460
for cont_info, analog_signal in zip(rec._oebin['continuous'], rec.analog_signals):
5561
if cont_info['source_processor_id'] != oe_probe.processor_id:

0 commit comments

Comments
 (0)