Skip to content

Commit 802b378

Browse files
committed
Skip streams if folder doesn't exist
1 parent e6ddc2e commit 802b378

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

neo/rawio/openephysbinaryrawio.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import os
1313
import json
1414
from pathlib import Path
15+
from warnings import warn
1516

1617
import numpy as np
1718

@@ -570,6 +571,15 @@ def explore_folder(dirname, experiment_names=None):
570571
stream_name = node_name + "#" + oe_stream_name
571572
else:
572573
stream_name = oe_stream_name
574+
575+
# skip streams if folder is on oebin, but doesn't exist
576+
if not (recording_folder / "continuous" / info["folder_name"]).is_dir():
577+
warn(
578+
f"For {recording_folder} the folder continuous/{info['folder_name']} is missing. "
579+
f"Skipping {stream_name} continuous stream."
580+
)
581+
continue
582+
573583
raw_filename = recording_folder / "continuous" / info["folder_name"] / "continuous.dat"
574584

575585
# Updates for OpenEphys v0.6:
@@ -604,6 +614,14 @@ def explore_folder(dirname, experiment_names=None):
604614
else:
605615
stream_name = oe_stream_name
606616

617+
# skip streams if folder is on oebin, but doesn't exist
618+
if not (recording_folder / "events" / info["folder_name"]).is_dir():
619+
warn(
620+
f"For {recording_folder} the folder events/{info['folder_name']} is missing. "
621+
f"Skipping {stream_name} event stream."
622+
)
623+
continue
624+
607625
event_stream = info.copy()
608626
for name in _possible_event_stream_names:
609627
npy_filename = root / "events" / info["folder_name"] / f"{name}.npy"

0 commit comments

Comments
 (0)