Skip to content

Commit

Permalink
Merge pull request #308 from iurillilab/fix-disabled-probe
Browse files Browse the repository at this point in the history
Fix OpenEphys interface issue with multiple probes of which some are disabled
  • Loading branch information
alejoe91 authored Dec 2, 2024
2 parents 1fc2d35 + 705c0d1 commit 26a7d33
Show file tree
Hide file tree
Showing 4 changed files with 1,230 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/probeinterface/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,15 @@ def read_openephys(
raise Exception("NP_PROBE field not found in settings")
return None

# In neuropixel plugin 0.7.0, the option for enabling/disabling probes was added.
# Make sure we only keep enabled probes.
if neuropix_pxi_version >= parse("0.7.0") and neuropix_pxi_version < parse("1.0.0dev0"):
np_probes = [probe for probe in np_probes if probe.attrib["isEnabled"] == "1"]
if len(np_probes) == 0:
if raise_error:
raise Exception("No enabled probes found in settings")
return None

# read probes info
# If STREAMs are not available, probes are sequentially named based on the node id
if not has_streams:
Expand Down Expand Up @@ -1861,23 +1870,23 @@ def read_openephys(
if available_probe_name not in stream_name:
if raise_error:
raise Exception(
f"Inconsistency betweem provided stream {stream_name} and available probe "
f"Inconsistency between provided stream {stream_name} and available probe "
f"{available_probe_name}"
)
return None
if probe_name:
if probe_name != available_probe_name:
if raise_error:
raise Exception(
f"Inconsistency betweem provided probe name {probe_name} and available probe "
f"Inconsistency between provided probe name {probe_name} and available probe "
f"{available_probe_name}"
)
return None
if serial_number:
if str(serial_number) != available_serial_number:
if raise_error:
raise Exception(
f"Inconsistency betweem provided serial number {serial_number} and available serial numbers "
f"Inconsistency between provided serial number {serial_number} and available serial numbers "
f"{available_serial_number}"
)
return None
Expand Down
Loading

0 comments on commit 26a7d33

Please sign in to comment.