diff --git a/src/probeinterface/io.py b/src/probeinterface/io.py
index 1175c4b..a74cc3c 100644
--- a/src/probeinterface/io.py
+++ b/src/probeinterface/io.py
@@ -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:
@@ -1861,7 +1870,7 @@ 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
@@ -1869,7 +1878,7 @@ def read_openephys(
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
@@ -1877,7 +1886,7 @@ def read_openephys(
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
diff --git a/tests/data/openephys/OE_6.7_enabled_disabled_Neuropix-PXI/settings_enabled-disabled.xml b/tests/data/openephys/OE_6.7_enabled_disabled_Neuropix-PXI/settings_enabled-disabled.xml
new file mode 100755
index 0000000..30e5e54
--- /dev/null
+++ b/tests/data/openephys/OE_6.7_enabled_disabled_Neuropix-PXI/settings_enabled-disabled.xml
@@ -0,0 +1,584 @@
+
+
+
+
+ 0.6.7
+ 8
+ 14 Nov 2024 15:16:52
+ Windows 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/data/openephys/OE_6.7_enabled_disabled_Neuropix-PXI/settings_enabled-enabled.xml b/tests/data/openephys/OE_6.7_enabled_disabled_Neuropix-PXI/settings_enabled-enabled.xml
new file mode 100755
index 0000000..3ab3379
--- /dev/null
+++ b/tests/data/openephys/OE_6.7_enabled_disabled_Neuropix-PXI/settings_enabled-enabled.xml
@@ -0,0 +1,603 @@
+
+
+
+
+ 0.6.7
+ 8
+ 14 Nov 2024 15:49:46
+ Windows 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/test_io/test_openephys.py b/tests/test_io/test_openephys.py
index 5e70927..bf18711 100644
--- a/tests/test_io/test_openephys.py
+++ b/tests/test_io/test_openephys.py
@@ -140,6 +140,37 @@ def test_multiple_probes():
assert np.min(ypos) >= 0
+def test_multiple_probes_enabled():
+ # multiple probes, all enabled:
+
+ probe = read_openephys(
+ data_path / "OE_6.7_enabled_disabled_Neuropix-PXI" / "settings_enabled-enabled.xml", probe_name="ProbeA"
+ )
+ assert probe.get_shank_count() == 1
+
+ probe = read_openephys(
+ data_path / "OE_6.7_enabled_disabled_Neuropix-PXI" / "settings_enabled-enabled.xml", probe_name="ProbeB"
+ )
+ assert probe.get_shank_count() == 4
+
+
+def test_multiple_probes_disabled():
+ # multiple probes, some disabled
+ probe = read_openephys(
+ data_path / "OE_6.7_enabled_disabled_Neuropix-PXI" / "settings_enabled-disabled.xml", probe_name="ProbeA"
+ )
+
+ assert probe.get_shank_count() == 1
+
+ # Fail as this is disabled:
+ with pytest.raises(Exception) as e:
+ probe = read_openephys(
+ data_path / "OE_6.7_enabled_disabled_Neuropix-PXI" / "settings_enabled-disabled.xml", probe_name="ProbeB"
+ )
+
+ assert "Inconsistency between provided probe name ProbeB and available probe ProbeA" in str(e.value)
+
+
def test_np_opto_with_sync():
probe = read_openephys(data_path / "OE_Neuropix-PXI-opto-with-sync" / "settings.xml")
assert probe.model_name == "Neuropixels Opto"