From 2b6ce90714ff2e1f5588066f9cf731da647389d5 Mon Sep 17 00:00:00 2001 From: Christian Tabedzki <35670232+tabedzki@users.noreply.github.com> Date: Sat, 7 Nov 2026 08:41:56 -0500 Subject: [PATCH] perf: shrink the document every session builds on the event loop Each session builds, validates, serialises and sends its Bokeh document on the loop that serves every other session and /liveness. - Draw shank outlines, bank lines and labels with one renderer per style. A 4-shank document drops from 33 renderers and 485 models to 9 and 269. - Limit tap and box-select tools to the electrode and survey-bar renderers, so a tap on a shared outline renderer can't dim the other outlines. - Send numeric electrode columns as arrays, compute their geometry with NumPy, and skip Bokeh's per-cell check of that fixed-shape source. - Reuse the cached data URI for tool icons instead of re-encoding six PNGs. Assisted-by: ClaudeCode:claude-opus-5-5 --- pixelmap/gui/gui.py | 351 +++++++++++++------------------ tests/test_session_build_cost.py | 147 +++++++++++++ 2 files changed, 291 insertions(+), 207 deletions(-) create mode 100644 tests/test_session_build_cost.py diff --git a/pixelmap/gui/gui.py b/pixelmap/gui/gui.py index 61a73dd..2b5e172 100644 --- a/pixelmap/gui/gui.py +++ b/pixelmap/gui/gui.py @@ -16,7 +16,7 @@ from dataclasses import dataclass, field from io import BytesIO, StringIO from pathlib import Path -from typing import Any +from typing import Any, NamedTuple import matplotlib.pyplot as plt import numpy as np @@ -24,6 +24,7 @@ import panel as pn import param from bokeh import events +from bokeh.core.properties import validate from bokeh.models import ( BoxSelectTool, ColorBar, @@ -270,6 +271,55 @@ def _restore_selection(self, target: frozenset[Electrode]): #### GUI app #### ################# +class ShankOutlineGeometry(NamedTuple): + """What a probe's outline draws, ready for one renderer per style.""" + + x_limits: tuple[float, float] + outline_xs: list[list[float]] + outline_ys: list[list[float]] + bank_lines_xs: list[list[float]] + bank_lines_ys: list[list[float]] + shank_labels: tuple[list[float], list[float], list[str]] # xs, ys, texts + bank_labels: tuple[list[float], list[float], list[str]] # xs, ys, texts + + +def shank_outline_geometry(positions: np.ndarray, single_shank: bool) -> ShankOutlineGeometry: + """Compute outlines, bank lines and labels from ``(shank, electrode, x, y)`` rows.""" + half_width = 50 + if single_shank: + centers = [0] + tip_fraction = 0.1 + x_limits = (-half_width - 150, half_width + 150) + else: + centers = [shank_id * 250 for shank_id in range(4)] + tip_fraction = 0.08 + x_limits = (-half_width - 100, centers[-1] + half_width + 100) + + geometry = ShankOutlineGeometry(x_limits, [], [], [], [], ([], [], []), ([], [], [])) + for shank_id, center in enumerate(centers): + ys = positions[positions[:, 0] == shank_id, -1] + max_y, min_y = float(np.max(ys)), float(np.min(ys)) + tip_y = min_y - (max_y - min_y) * tip_fraction + left, right = center - half_width, center + half_width + + geometry.outline_xs.append([left, right, right, center, left, left]) + geometry.outline_ys.append([max_y + 100, max_y + 100, min_y, tip_y, min_y, max_y + 100]) + + if not single_shank: + geometry.shank_labels[0].append(center) + geometry.shank_labels[1].append(tip_y - 250) + geometry.shank_labels[2].append(f"Shank {shank_id}") + + for bank, bank_y in enumerate(ys[::384].tolist()): + geometry.bank_lines_xs.append([left, right]) + geometry.bank_lines_ys.append([bank_y, bank_y]) + if center == centers[-1]: # bank labels only beside the rightmost shank + geometry.bank_labels[0].append(right + 17) + geometry.bank_labels[1].append(bank_y) + geometry.bank_labels[2].append(f"Bank {bank}") + return geometry + + class ChannelmapGUI(param.Parameterized): """Main GUI class for interactive channelmap generation using Bokeh""" @@ -441,98 +491,77 @@ def load_probe_data(self): def create_electrode_data(self): """Create the electrode data for Bokeh visualization""" positions = self.positions_df.values - - # Calculate electrode positions and colors - electrode_data = { - "x": [], - "y": [], - "width": [], - "height": [], - "shank_id": [], - "electrode_id": [], - "color": [], - "alpha": [], - "line_color": [], - "line_width": [], - "status": [], - "val": [], - "bar_x": [], - "bar_height": [], - "bar_color": [], - "bar_alpha": [], - } + shank_ids, electrode_ids, orig_x, y = positions.T # Parameters for visualization BAR_WIDTH = 16 BAR_GAP = 4 # gap between shank outline and survey bar + shank_width = 100 + half_span = shank_width * 0.7 / 2 - if self.probe_type in ["1.0", "2.0-1shank"]: - # Single shank - shank_width = 100 - electrode_width = 15 - electrode_height = 9 if self.probe_type == "2.0-1shank" else 14 - shank_spacing = None - else: - # Multi-shank - shank_width = 100 - shank_spacing = 250 - electrode_width = 12 - electrode_height = 8 + # Map each electrode's x position to the drawn shank's width. + if self.probe_type == "1.0": + electrode_width, electrode_height = 15, 14 + x_center_shank = np.zeros(len(positions)) + x = (orig_x - 35) / 24 * half_span + elif self.probe_type == "2.0-1shank": + electrode_width, electrode_height = 15, 9 + x_center_shank = np.zeros(len(positions)) + x = (orig_x - 16) / 16 * half_span + else: # 4-shanks 2.0 or NXT + electrode_width, electrode_height = 12, 8 + x_center_shank = shank_ids * 250 + x = x_center_shank + (orig_x - x_center_shank - 16) / 16 * half_span # Bars sit just outside the shank outline, mirroring the column the # electrode lives in: left-column contacts → bar on the left of the # outline, right-column contacts → bar on the right. bar_offset = shank_width / 2 + BAR_GAP + BAR_WIDTH / 2 + bar_x = x_center_shank + np.where(x >= x_center_shank, 1, -1) * bar_offset + + # Numeric columns are arrays: Bokeh sends those as binary instead of + # encoding each of the thousands of values separately. + electrode_data = { + "x": x, + "y": y, + "width": np.full(len(positions), electrode_width), + "height": np.full(len(positions), electrode_height), + "shank_id": shank_ids, + "electrode_id": electrode_ids, + "bar_x": bar_x, + "bar_height": np.full(len(positions), electrode_height * 1.5), + **self._electrode_appearance_columns(shank_ids.tolist(), electrode_ids.tolist()), + } - for shank_id, electrode_id, orig_x, y in positions: - - # Map x position to shank width - if self.probe_type == "1.0": - x_norm = (orig_x - 35) / 24 - x = x_norm * (shank_width * 0.7) / 2 - x_center_shank = 0.0 - elif self.probe_type == "2.0-1shank": - x_norm = (orig_x - 16) / 16 - x = x_norm * (shank_width * 0.7) / 2 - x_center_shank = 0.0 - else: # 4-shanks 2.0 or NXT - # Calculate shank center - x_center_shank = shank_id * shank_spacing - # Map electrode position within shank - x_norm = (orig_x - x_center_shank - 16) / 16 - x = x_center_shank + x_norm * (shank_width * 0.7) / 2 - - # Bar x: just outside the shank outline, on the side matching - # the electrode's column relative to the shank center. - side = 1 if (x - x_center_shank) >= 0 else -1 - bar_x = x_center_shank + side * bar_offset - - # Determine electrode status and color + # Skip Bokeh's check of every cell, which took half of this method and + # runs on the event loop for each session: the shape is fixed right here. + with validate(False): + self.electrode_source = ColumnDataSource(data=electrode_data) + + def _electrode_appearance_columns(self, shank_ids, electrode_ids) -> dict[str, Any]: + """Selection- and survey-dependent columns, one value per electrode.""" + n_electrodes = len(shank_ids) + colors = [""] * n_electrodes + alphas = np.empty(n_electrodes, dtype=np.float64) + line_colors = [""] * n_electrodes + line_widths = np.empty(n_electrodes, dtype=np.int32) + statuses = [""] * n_electrodes + vals = np.empty(n_electrodes, dtype=np.float64) + bar_colors = [""] * n_electrodes + bar_alphas = np.empty(n_electrodes, dtype=np.float64) + + for i, (shank_id, electrode_id) in enumerate(zip(shank_ids, electrode_ids, strict=True)): electrode = Electrode(shank_id, electrode_id) - status, color, alpha, line_color, line_width = self.get_electrode_plotting_params(electrode) - val = self._get_survey_val(electrode) - bar_color, bar_alpha = self._get_bar_color_alpha(electrode) - - electrode_data["x"].append(x) - electrode_data["y"].append(y) - electrode_data["width"].append(electrode_width) - electrode_data["height"].append(electrode_height) - electrode_data["shank_id"].append(shank_id) - electrode_data["electrode_id"].append(electrode_id) - electrode_data["color"].append(color) - electrode_data["alpha"].append(alpha) - electrode_data["line_color"].append(line_color) - electrode_data["line_width"].append(line_width) - electrode_data["status"].append(status) - electrode_data["val"].append(val) - electrode_data["bar_x"].append(bar_x) - electrode_data["bar_height"].append(electrode_height * 1.5) - electrode_data["bar_color"].append(bar_color) - electrode_data["bar_alpha"].append(bar_alpha) - - # Create ColumnDataSource - self.electrode_source = ColumnDataSource(data=electrode_data) + statuses[i], colors[i], alphas[i], line_colors[i], line_widths[i] = ( + self.get_electrode_plotting_params(electrode) + ) + vals[i] = self._get_survey_val(electrode) + bar_colors[i], bar_alphas[i] = self._get_bar_color_alpha(electrode) + return { + "color": colors, "alpha": alphas, "line_color": line_colors, "line_width": line_widths, + "status": statuses, "val": vals, "bar_color": bar_colors, "bar_alpha": bar_alphas, + } def get_electrode_plotting_params(self, electrode: Electrode): """Get electrode fill/border appearance based on selection state.""" @@ -610,96 +639,28 @@ def setup_electrode_visualization(self): def add_shank_outlines(self): - """Add shank outlines and bank labels""" - positions = self.positions_df.values - - if self.probe_type in ["1.0", "2.0-1shank"]: - # Single shank outline - shank_width = 100 - xlim = [-shank_width / 2 - 150, shank_width / 2 + 150] - max_y = np.max(positions[:, -1]) - min_y = np.min(positions[:, -1]) - tip_height = (max_y - min_y) * 0.1 - - # Shank outline - shank_x = [-shank_width / 2, shank_width / 2, shank_width / 2, 0, -shank_width / 2, -shank_width / 2] - shank_y = [max_y + 100, max_y + 100, min_y, min_y - tip_height, min_y, max_y + 100] - - self.plot.line(shank_x, shank_y, line_width=3, color="black", alpha=1) - self.plot.x_range = Range1d(xlim[0], xlim[1]) - - # Bank labels - for bank_i in np.arange(0, len(positions), 384): - if bank_i < len(positions): - bank_y = positions[bank_i, -1] - self.plot.line( - [-shank_width / 2, shank_width / 2], [bank_y, bank_y], line_width=2, color="gray", alpha=0.7 - ) - self.plot.text( - [shank_width / 2 + 17], - [bank_y], - text=[f"Bank {bank_i // 384}"], - text_font_size="10pt", - text_color="gray", - ) - - else: - # Multi-shank outlines - shank_width = 100 - shank_spacing = 250 - xlim = [-shank_width / 2 - 100, 3 * shank_spacing + shank_width / 2 + 100] - - for shank_id in range(4): - shank_mask = positions[:, 0] == shank_id - x_center = shank_id * shank_spacing - - max_y = np.max(positions[shank_mask, -1]) - min_y = np.min(positions[shank_mask, -1]) - tip_height = (max_y - min_y) * 0.08 - - # Shank outline - shank_x = [ - x_center - shank_width / 2, - x_center + shank_width / 2, - x_center + shank_width / 2, - x_center, - x_center - shank_width / 2, - x_center - shank_width / 2, - ] - shank_y = [max_y + 100, max_y + 100, min_y, min_y - tip_height, min_y, max_y + 100] - - self.plot.line(shank_x, shank_y, line_width=3, color="black", alpha=1) - self.plot.x_range = Range1d(xlim[0], xlim[1]) - - # Shank label - self.plot.text( - [x_center], - [min_y - tip_height - 250], - text=[f"Shank {shank_id}"], - text_font_size="12pt", - text_color="black", - text_align="center", - ) + """Add shank outlines and bank labels. - # Bank lines and labels - for bank_i in np.arange(0, len(positions[shank_mask]), 384): - if bank_i < len(positions[shank_mask]): - bank_y = positions[shank_mask][bank_i, -1] - self.plot.line( - [x_center - shank_width / 2, x_center + shank_width / 2], - [bank_y, bank_y], - line_width=2, - color="gray", - alpha=0.7, - ) - if shank_id == 3: # Bank labels (only on rightmost shank) - self.plot.text( - [x_center + shank_width / 2 + 17], - [bank_y], - text=[f"Bank {bank_i // 384}"], - text_font_size="10pt", - text_color="gray", - ) + One renderer per style, not one per shape: each renderer brings about + ten Bokeh models, which every session then builds, validates, + serialises and sends on the event loop. + """ + geometry = shank_outline_geometry( + self.positions_df.values, + single_shank=self.probe_type in ["1.0", "2.0-1shank"], + ) + self.plot.x_range = Range1d(*geometry.x_limits) + self.plot.multi_line(geometry.outline_xs, geometry.outline_ys, line_width=3, color="black", alpha=1) + self.plot.multi_line(geometry.bank_lines_xs, geometry.bank_lines_ys, line_width=2, color="gray", alpha=0.7) + + label_xs, label_ys, labels = geometry.shank_labels + if labels: + self.plot.text( + label_xs, label_ys, text=labels, + text_font_size="12pt", text_color="black", text_align="center", + ) + label_xs, label_ys, labels = geometry.bank_labels + self.plot.text(label_xs, label_ys, text=labels, text_font_size="10pt", text_color="gray") # Set appropriate axis limits self.plot.axis.visible = False @@ -708,39 +669,9 @@ def add_shank_outlines(self): def update_electrode_colors(self): """Update electrode colors in the Bokeh plot""" - n_electrodes = len(self.electrode_source.data["shank_id"]) - - # Pre-allocate numpy arrays for better memory efficiency - colors = np.empty(n_electrodes, dtype=object) - alphas = np.empty(n_electrodes, dtype=np.float64) - line_colors = np.empty(n_electrodes, dtype=object) - line_widths = np.empty(n_electrodes, dtype=np.int32) - statuses = np.empty(n_electrodes, dtype=object) - vals = np.empty(n_electrodes, dtype=np.float64) - bar_colors = np.empty(n_electrodes, dtype=object) - bar_alphas = np.empty(n_electrodes, dtype=np.float64) - - for i in range(n_electrodes): - shank_id = self.electrode_source.data["shank_id"][i] - electrode_id = self.electrode_source.data["electrode_id"][i] - electrode = Electrode(shank_id, electrode_id) - - status, color, alpha, line_color, line_width = self.get_electrode_plotting_params(electrode) - - colors[i] = color - alphas[i] = alpha - line_colors[i] = line_color - line_widths[i] = line_width - statuses[i] = status - vals[i] = self._get_survey_val(electrode) - bar_colors[i], bar_alphas[i] = self._get_bar_color_alpha(electrode) - - # Update the data source with new data, replacing old arrays + data = self.electrode_source.data self.electrode_source.data.update( - {"color": colors.tolist(), "alpha": alphas.tolist(), - "line_color": line_colors.tolist(), "line_width": line_widths.tolist(), - "status": statuses.tolist(), "val": vals.tolist(), - "bar_color": bar_colors.tolist(), "bar_alpha": bar_alphas.tolist()} + self._electrode_appearance_columns(data["shank_id"].tolist(), data["electrode_id"].tolist()) ) @@ -2239,27 +2170,27 @@ def setup_bokeh_plot(self): dependentdeselect_box_string = "Deselect Dependents" zigzagdependentdeselect_box_string = "Zigzag-deselect Dependents" - self.box_select_tool = BoxSelectTool(description=select_box_string, icon=GUI_ASSETS_DIR / "selector.png") + self.box_select_tool = BoxSelectTool(description=select_box_string, icon=_asset_data_uri("selector.png")) self.box_deselect_tool = BoxSelectTool( - description=deselect_box_string, icon=GUI_ASSETS_DIR / "deselector.png" + description=deselect_box_string, icon=_asset_data_uri("deselector.png") ) self.box_zigzagselect_tool = BoxSelectTool( - description=zigzagselect_box_string, icon=GUI_ASSETS_DIR / "zigzag_selector.png" + description=zigzagselect_box_string, icon=_asset_data_uri("zigzag_selector.png") ) self.box_interleavedselect_tool = BoxSelectTool( - description=interleavedselect_box_string, icon=GUI_ASSETS_DIR / "interleaved_selector.png" + description=interleavedselect_box_string, icon=_asset_data_uri("interleaved_selector.png") ) self.box_dependent_deselect_tool = BoxSelectTool( - description=dependentdeselect_box_string, icon=GUI_ASSETS_DIR / "dependent_deselector.png" + description=dependentdeselect_box_string, icon=_asset_data_uri("dependent_deselector.png") ) self.box_zigzag_dependent_deselect_tool = BoxSelectTool( description=zigzagdependentdeselect_box_string, - icon=GUI_ASSETS_DIR / "zigzag_dependent_deselector.png", + icon=_asset_data_uri("zigzag_dependent_deselector.png"), ) # Always-on gesture tools — hidden from toolbar (visible=False). @@ -2316,6 +2247,12 @@ def setup_bokeh_plot(self): self.setup_electrode_visualization() # Restrict hover tool to electrode rectangles only (prevents ??? on overlay glyphs) hover_tool.renderers = [self.electrode_renderer] + # Selection tools hit only what shares the electrode data. Left on "auto", + # a tap on a shared outline renderer selects that one outline and Bokeh + # dims all the others. + electrode_renderers = [self.electrode_renderer, self.survey_bar_renderer] + for tool in self.plot.select({"type": (TapTool, BoxSelectTool)}): + tool.renderers = electrode_renderers # Set initial y_range so only the bottom third of the probe is visible: # probe tips pinned at the bottom, top two-thirds hidden above the frame. diff --git a/tests/test_session_build_cost.py b/tests/test_session_build_cost.py new file mode 100644 index 0000000..2f30047 --- /dev/null +++ b/tests/test_session_build_cost.py @@ -0,0 +1,147 @@ +"""Keep a session's Bokeh document small: every session pays for it on the event loop. + +``panel serve`` builds, validates, serialises and sends each session's document +on the loop that serves every other session and ``/liveness``, and all of that +scales with the number of models and the size of their data. +""" + +from __future__ import annotations + +import numpy as np +import pytest +from bokeh.models import BoxSelectTool, GlyphRenderer, MultiLine, Rect, TapTool, Text + +from pixelmap.constants import WIRING_FILE_MAP +from pixelmap.gui.gui import ChannelmapGUI, shank_outline_geometry +from pixelmap.types import Electrode + +NUMERIC_COLUMNS = ( + "x", "y", "width", "height", "shank_id", "electrode_id", "alpha", "line_width", + "val", "bar_x", "bar_height", "bar_alpha", +) +SINGLE_SHANK = np.array([[0, e, 0, y] for e, y in enumerate(range(0, 7680, 10))], dtype=float) + + +@pytest.fixture(scope="module", params=sorted(WIRING_FILE_MAP)) +def probe_gui(request): + gui = ChannelmapGUI() + gui.probe_type = request.param + gui.load_probe_data() + gui.setup_bokeh_plot() + return gui + + +def _glyph_counts(gui): + renderers = gui.plot.select({"type": GlyphRenderer}) + return { + kind: sum(isinstance(r.glyph, kind) for r in renderers) + for kind in (Rect, MultiLine, Text) + } + + +def test_outlines_use_one_renderer_per_style_on_every_probe(probe_gui): + counts = _glyph_counts(probe_gui) + assert counts[MultiLine] == 2 # outlines, bank lines + # Bank labels, the anatomy region labels and, on multi-shank probes, shank labels. + assert counts[Text] <= 3 + + +@pytest.mark.parametrize("tool_type", [TapTool, BoxSelectTool]) +def test_selection_tools_only_hit_electrodes_never_decoration(probe_gui, tool_type): + # A shared outline renderer is hit-tested per item, so a tap on one outline + # would "select" it and Bokeh would dim every other outline. + tools = probe_gui.plot.select({"type": tool_type}) + assert tools + for tool in tools: + assert set(tool.renderers) == {probe_gui.electrode_renderer, probe_gui.survey_bar_renderer} + + +def test_numeric_electrode_columns_are_arrays_for_binary_encoding(probe_gui): + for column in NUMERIC_COLUMNS: + assert isinstance(probe_gui.electrode_source.data[column], np.ndarray), column + + +def test_electrode_columns_keep_one_value_per_electrode(probe_gui): + lengths = {len(v) for v in probe_gui.electrode_source.data.values()} + assert lengths == {len(probe_gui.positions_df)} + + +def test_tool_icons_reuse_the_cached_data_uri(probe_gui): + icons = [probe_gui.box_select_tool.icon, probe_gui.box_deselect_tool.icon] + assert all(icon.startswith("data:image/png;base64,") for icon in icons) + + +@pytest.fixture +def default_gui(): + gui = ChannelmapGUI() + yield gui + gui.electrodes.clear_selection() + + +def test_rebuilding_keeps_the_current_selection_and_survey(default_gui): + gui = default_gui + first = Electrode(*gui.positions_df[["shank", "electrode"]].iloc[0].tolist()) + gui.electrodes.selected.add(first) + gui.survey_values = {first: 0.0} # zero is a real value, not "missing" + + gui.create_electrode_data() + + data = gui.electrode_source.data + assert (data["status"][0], data["color"][0], data["alpha"][0]) == ("Selected", "red", 1.0) + assert data["val"][0] == 0.0 + assert data["status"][1] == "Unselected" + assert np.isnan(data["val"][1]) # no survey value for this electrode + gui.survey_values = None + + +def test_updating_colors_matches_a_full_rebuild(default_gui): + gui = default_gui + gui.electrodes.selected.add(Electrode(*gui.positions_df[["shank", "electrode"]].iloc[5].tolist())) + + gui.update_electrode_colors() + updated = dict(gui.electrode_source.data) + gui.create_electrode_data() + + assert updated["status"][5] == "Selected" + for column, values in gui.electrode_source.data.items(): + np.testing.assert_array_equal(updated[column], values, err_msg=column) + + +def test_single_shank_geometry_matches_the_drawn_probe(): + geometry = shank_outline_geometry(SINGLE_SHANK, single_shank=True) + + assert geometry.outline_xs == [[-50, 50, 50, 0, -50, -50]] + assert geometry.outline_ys[0][:3] == [7770.0, 7770.0, 0.0] + assert geometry.outline_ys[0][3] == pytest.approx(-767.0) + assert geometry.shank_labels == ([], [], []) + assert geometry.bank_labels[2] == ["Bank 0", "Bank 1"] # banks start at 0 and 384 + assert geometry.bank_lines_ys == [[0.0, 0.0], [3840.0, 3840.0]] + + +def test_multi_shank_geometry_draws_every_shank_and_labels_banks_on_the_last(): + positions = np.vstack([SINGLE_SHANK + [shank, 0, 0, 0] for shank in range(4)]) + + geometry = shank_outline_geometry(positions, single_shank=False) + + assert len(geometry.outline_xs) == 4 + assert geometry.outline_xs[3][3] == 750 # tip of the rightmost shank + assert geometry.shank_labels[2] == ["Shank 0", "Shank 1", "Shank 2", "Shank 3"] + assert len(geometry.bank_lines_xs) == 8 # two banks on each shank + assert set(geometry.bank_labels[0]) == {817} # right of the rightmost shank + + +@pytest.mark.parametrize("single_shank", [True, False]) +def test_geometry_of_a_probe_shorter_than_one_bank_has_one_bank_line(single_shank): + positions = np.array([[s, e, 0, e * 20.0] for s in range(4) for e in range(3)]) + if single_shank: + positions = positions[positions[:, 0] == 0] + + geometry = shank_outline_geometry(positions, single_shank=single_shank) + + assert len(geometry.bank_lines_xs) == (1 if single_shank else 4) + assert geometry.bank_labels[2] == ["Bank 0"] + + +def test_geometry_of_a_single_electrode_has_a_flat_tip(): + geometry = shank_outline_geometry(np.array([[0, 0, 0, 0.0]]), single_shank=True) + assert geometry.outline_ys[0][2:4] == [0.0, 0.0]