From bc5014a7c60572208bf6f725d404ab96385d15e1 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 16 Oct 2026 14:40:46 +0200 Subject: [PATCH 1/3] fix: duplicated probe_id field in version mismatch --- src/probeinterface/probegroup.py | 4 +++- tests/test_probegroup.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/probeinterface/probegroup.py b/src/probeinterface/probegroup.py index f56aaa6c..db1b1515 100644 --- a/src/probeinterface/probegroup.py +++ b/src/probeinterface/probegroup.py @@ -144,12 +144,14 @@ def to_numpy(self, complete: bool = False) -> np.ndarray: # loop over probes to get all fields dtype = [("probe_index", "int64"), ("probe_id", "U100")] + # set by the probegroup: skip same-named contact annotations (e.g. from files saved with probeinterface<0.4) + group_fields = [name for name, _ in dtype] fields = [] for probe_index, probe in enumerate(self.probes): arr = probe.to_numpy(complete=complete) probe_arr.append(arr) for k in arr.dtype.fields: - if k not in fields: + if k not in fields and k not in group_fields: fields.append(k) dtype += [(k, arr.dtype.fields[k][0])] diff --git a/tests/test_probegroup.py b/tests/test_probegroup.py index 15d9c1a6..1aadba8f 100644 --- a/tests/test_probegroup.py +++ b/tests/test_probegroup.py @@ -53,6 +53,22 @@ def test_probegroup_3d(): assert probegroup.ndim == 3 +def test_to_numpy_with_probe_id_contact_annotation(): + """A 'probe_id' contact annotation (e.g. from files saved with probeinterface<0.4) must not + duplicate the probegroup 'probe_id' field.""" + probegroup = ProbeGroup() + for i in range(2): + probe = generate_dummy_probe() + probe.move([i * 100, 0]) + probe.annotate_contacts(probe_id=["0"] * probe.get_contact_count()) + probegroup.add_probe(probe) + + arr = probegroup.to_numpy(complete=True) + assert list(arr.dtype.names).count("probe_id") == 1 + assert np.array_equal(np.unique(arr["probe_id"]), ["0", "1"]) + ProbeGroup.from_numpy(arr) + + def test_probegroup_allows_duplicate_positions_across_probes(): """Test that ProbeGroup allows duplicate contact positions if they are in different probes.""" from probeinterface import ProbeGroup, Probe From d5c8fc1a0f97263b6ae5ccb4f2df4ff39d7d1d0e Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 16 Oct 2026 14:42:04 +0200 Subject: [PATCH 2/3] bump up version --- doc/release_notes.rst | 1 + doc/releases/0.4.2.rst | 9 +++++++++ pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 doc/releases/0.4.2.rst diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 5e1cb072..08626538 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -6,6 +6,7 @@ Release notes .. toctree:: :maxdepth: 1 + releases/0.4.2.rst releases/0.4.1.rst releases/0.4.0.rst releases/0.3.2.rst diff --git a/doc/releases/0.4.2.rst b/doc/releases/0.4.2.rst new file mode 100644 index 00000000..9eb0b6e7 --- /dev/null +++ b/doc/releases/0.4.2.rst @@ -0,0 +1,9 @@ +probeinterface 0.4.1 +-------------------- + +Oct, 13th 2026 + + +Bug fixes +^^^^^^^^^ +* OpenEphys: check channel maps on same signal chain as NP probe (#471) diff --git a/pyproject.toml b/pyproject.toml index 69490d28..c19f86bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "probeinterface" -version = "0.4.1" +version = "0.4.2" authors = [ { name="Samuel Garcia", email="sam.garcia.die@gmail.com" }, { name="Alessio Buccino", email="alessiop.buccino@gmail.com" }, From 47a2e3fac5458f9f47131a21255b4ff5bd2ed3b9 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 16 Oct 2026 14:46:32 +0200 Subject: [PATCH 3/3] doc: update 0.4.2 release notes --- doc/releases/0.4.2.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/releases/0.4.2.rst b/doc/releases/0.4.2.rst index 9eb0b6e7..4b57737a 100644 --- a/doc/releases/0.4.2.rst +++ b/doc/releases/0.4.2.rst @@ -1,9 +1,9 @@ -probeinterface 0.4.1 +probeinterface 0.4.2 -------------------- -Oct, 13th 2026 +Oct, 16th 2026 Bug fixes ^^^^^^^^^ -* OpenEphys: check channel maps on same signal chain as NP probe (#471) +* Fix duplicate ``probe_id`` field in ``ProbeGroup.to_numpy(complete=True)`` (#473)