From 57eee43af72ed7362bd7bef6305819e48973ad44 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 20 Mar 2026 10:25:21 +0100 Subject: [PATCH] Fix quad-base with custom names --- .gitignore | 6 +- .../generate_cambridgeneurotech_library.py | 2 +- src/probeinterface/neuropixels_tools.py | 12 + .../settings_custom_names.xml | 5177 +++++++++++------ .../settings_custom_names_w_shank.xml | 1850 ++++++ tests/test_io/test_openephys.py | 51 +- 6 files changed, 5399 insertions(+), 1699 deletions(-) create mode 100644 tests/data/openephys/OE_Neuropix-PXI-QuadBase/settings_custom_names_w_shank.xml diff --git a/.gitignore b/.gitignore index b62199b7..0ee5de65 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ dev_* cov.xml .DS_Store - -neuropixel_library_generated/* uv.lock + +# libraries +**/neuropixels_library_generated +**/cambridgeneurotech_library diff --git a/resources/generate_cambridgeneurotech_library.py b/resources/generate_cambridgeneurotech_library.py index ed670a3a..00327489 100644 --- a/resources/generate_cambridgeneurotech_library.py +++ b/resources/generate_cambridgeneurotech_library.py @@ -32,7 +32,7 @@ help="Path to the folder containing the CambridgeNeurotech probe tables CSV files from https://github.com/cambridge-neurotech/probe_maps", ) parser.add_argument( - "--output-folder", type=str, default="./cambridgeneurotech", help="Output folder to save the generated probes" + "--output-folder", type=str, default="./cambridgeneurotech_library", help="Output folder to save the generated probes" ) diff --git a/src/probeinterface/neuropixels_tools.py b/src/probeinterface/neuropixels_tools.py index ca186b9c..2e4eb888 100644 --- a/src/probeinterface/neuropixels_tools.py +++ b/src/probeinterface/neuropixels_tools.py @@ -1265,6 +1265,18 @@ def _parse_openephys_settings( else: name = probe_names_used[probe_idx] + # For Quad Base probes, the stream name is the same for all 4 shanks, + # so we append the shank id to match the stream name (if not already present) + # and ensure consistency with stream names. + shank = np_probe.attrib.get("shank") + if shank is not None: + shank_str = f"-{int(shank) + 1}" + if shank_str not in name: + name = f"{name}{shank_str}" + # update the name in the probe_name_used so that the correct probe name + # shows up in the list of available probe names + probe_names_used[probe_idx] = name + info = { "probe_part_number": probe_part_number, "serial_number": probe_serial_number, diff --git a/tests/data/openephys/OE_Neuropix-PXI-QuadBase/settings_custom_names.xml b/tests/data/openephys/OE_Neuropix-PXI-QuadBase/settings_custom_names.xml index cf427273..e2b67bcf 100644 --- a/tests/data/openephys/OE_Neuropix-PXI-QuadBase/settings_custom_names.xml +++ b/tests/data/openephys/OE_Neuropix-PXI-QuadBase/settings_custom_names.xml @@ -1,1850 +1,3645 @@ - - - + + - - - 1.0.0-dev - - - 9 - - - 12 Mar 2025 16:11:26 - - + 1.0.0 + 10 + 28 Aug 2025 15:21:17 Windows 11 - - - - - + - - - - - - - + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + + + + + + + + + + - - - - - - - + - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + + + + + + + + + + - - - - - - - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - - - + + - - - - - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - + - - - - - - - - + + - - - - - - - + - - - - - - - - - - + + - - - - - -
- - + +
- - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - + - - - - - - - - - - - - - - - - - - - - - - - - -