From 5f3af1208b1a7d704ea254d64515e38e074afd5b Mon Sep 17 00:00:00 2001 From: Eva B <250416784+evadiva3@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:19:00 -0800 Subject: [PATCH] Show the actual selection shape in the contact-slicing error --- src/probeinterface/probe.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/probeinterface/probe.py b/src/probeinterface/probe.py index 0d7f0d0c..b45fcd16 100644 --- a/src/probeinterface/probe.py +++ b/src/probeinterface/probe.py @@ -1498,9 +1498,9 @@ def get_slice(self, selection: np.ndarray[bool | int]): selection = np.asarray(selection) if selection.dtype == "bool": - assert selection.shape == (n,), ( - f"if array of bool given it must be the same size " "as the number of contacts {selection.shape} != {n}" - ) + assert selection.shape == ( + n, + ), f"if array of bool given it must be the same size as the number of contacts {selection.shape} != {n}" elif selection.dtype.kind == "i": assert np.unique(selection).size == selection.size assert 0 <= np.min(selection) < n, f"An index within your selection is out of bounds {np.min(selection)}"