Skip to content

Commit 4b7418a

Browse files
committed
bette stream path
1 parent c7b7796 commit 4b7418a

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/probeinterface/neuropixels_tools.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,11 +1581,16 @@ def _compute_wiring_from_oebin(
15811581
with open(oebin_file, "r") as f:
15821582
oebin = json.load(f)
15831583

1584+
# Neo/SpikeInterface prepends "Record Node NNN#" to stream names.
1585+
# Strip that prefix so we can match against the raw oebin folder_name.
1586+
is_neo_stream = "#" in stream_name
1587+
oebin_stream_name = stream_name.split("#")[-1] if is_neo_stream else stream_name
1588+
15841589
continuous_streams = oebin.get("continuous", [])
15851590
matched_stream = None
15861591
for cs in continuous_streams:
1587-
folder_name = cs.get("folder_name", "")
1588-
if stream_name in folder_name or folder_name in stream_name:
1592+
folder_name = cs.get("folder_name", "").rstrip("/")
1593+
if folder_name == oebin_stream_name:
15891594
matched_stream = cs
15901595
break
15911596

tests/test_io/test_openephys.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,11 @@ def _read_oebin_electrode_indices(oebin_file, stream_name):
499499
"""Read electrode_index metadata from an oebin file for a given stream."""
500500
with open(oebin_file) as f:
501501
oebin = json.load(f)
502+
is_neo_stream = "#" in stream_name
503+
oebin_stream_name = stream_name.split("#")[-1] if is_neo_stream else stream_name
502504
for cs in oebin.get("continuous", []):
503-
folder_name = cs.get("folder_name", "")
504-
if stream_name in folder_name or folder_name in stream_name:
505+
folder_name = cs.get("folder_name", "").rstrip("/")
506+
if folder_name == oebin_stream_name:
505507
indices = []
506508
for ch in cs.get("channels", []):
507509
for m in ch.get("channel_metadata", []):

0 commit comments

Comments
 (0)