Skip to content

Commit 8799aa7

Browse files
authored
Merge pull request #361 from alejoe91/fix-openephys-probe-assignment
Fix QuadBase probe assignment with custom names+serial numbers
2 parents d8e0d27 + 8c60b5e commit 8799aa7

File tree

3 files changed

+1875
-4
lines changed

3 files changed

+1875
-4
lines changed

src/probeinterface/neuropixels_tools.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ def get_probe_contour_vertices(shank_width, tip_length, probe_length) -> list:
155155
.
156156
| |
157157
B | | D
158-
\ /
159-
\/
158+
\\ /
159+
\\/
160160
C
161161
162162
This function returns the points indicated in the diagram above in a list [A,B,C,D,E].
@@ -952,15 +952,21 @@ def read_openephys(
952952
if len(np_probes) > 1:
953953
found = False
954954
probe_names = [p["name"] for p in np_probes_info]
955-
956955
if stream_name is not None:
957956
assert probe_name is None and serial_number is None, (
958957
"Use one of 'stream_name', 'probe_name', " "or 'serial_number'"
959958
)
959+
# Here we have to check if the probe name or the serial number is in the stream name
960+
# If both are present, e.g., the name contains the serial number, the first match is used.
960961
for probe_idx, probe_info in enumerate(np_probes_info):
961-
if probe_info["name"] in stream_name or probe_info["serial_number"] in stream_name:
962+
if probe_info["name"] in stream_name:
962963
found = True
963964
break
965+
if not found:
966+
for probe_idx, probe_info in enumerate(np_probes_info):
967+
if probe_info["serial_number"] in stream_name:
968+
found = True
969+
break
964970
if not found:
965971
if raise_error:
966972
raise Exception(

0 commit comments

Comments
 (0)