File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
element_array_ephys/readers Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,18 @@ class OpenEphys:
3535 def __init__ (self , experiment_dir ):
3636 self .session_dir = pathlib .Path (experiment_dir )
3737
38- openephys_file = pyopenephys .File (self .session_dir .parent ) # this is on the Record Node level
38+ if self .session_dir .name .startswith ('recording' ):
39+ openephys_file = pyopenephys .File (self .session_dir .parent .parent ) # this is on the Record Node level
40+ self ._is_recording_folder = True
41+ else :
42+ openephys_file = pyopenephys .File (self .session_dir .parent ) # this is on the Record Node level
43+ self ._is_recording_folder = False
3944
4045 # extract the "recordings" for this session
4146 self .experiment = next (experiment for experiment in openephys_file .experiments
42- if pathlib .Path (experiment .absolute_foldername ) == self .session_dir )
47+ if pathlib .Path (experiment .absolute_foldername ) == (
48+ self .session_dir .parent if self ._is_recording_folder else self .session_dir )
49+ )
4350
4451 # extract probe data
4552 self .probes = self .load_probe_data ()
@@ -106,6 +113,9 @@ def load_probe_data(self):
106113 probe = probes [probe_SN ]
107114
108115 for rec in self .experiment .recordings :
116+ if self ._is_recording_folder and rec .absolute_foldername != self .session_dir :
117+ continue
118+
109119 assert len (rec ._oebin ['continuous' ]) == len (rec .analog_signals ), \
110120 f'Mismatch in the number of continuous data' \
111121 f' - expecting { len (rec ._oebin ["continuous" ])} (from structure.oebin file),' \
You can’t perform that action at this time.
0 commit comments