Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/spikeinterface/extractors/neoextractors/openephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ def __init__(
experiment_names: str | list | None = None,
all_annotations: bool = False,
):
folder_path = Path(folder_path)

# Handle experiment_names deprecation
if experiment_names is not None:
warnings.warn(
Expand Down Expand Up @@ -336,8 +338,15 @@ def __init__(
if sample_shifts is not None:
self.set_property("inter_sample_shift", sample_shifts)

# load synchronized timestamps and set_times to recording
recording_folder = Path(folder_path) / record_node
# folder_path can point to different levels of the OE folder structure
# (root, record node, experiment, or recording). We need to find the root folder
# in order to load the sync timestamps and set them as times to the recording.
if record_node in folder_path.parts:
root_index = len(folder_path.parts) - folder_path.parts.index(record_node) - 1
root_folder = folder_path.parents[root_index]
else:
root_folder = folder_path
recording_folder = root_folder / record_node
stream_folders = []
for segment_index, rec_id in enumerate(rec_ids):
stream_folder = (
Expand Down
Loading