From fa30df36ba840805ed11a7ee1573a4d1cfa3d449 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 19 May 2022 10:35:22 -0400 Subject: [PATCH] Simplify default xy formatter --- piker/ui/_flows.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/piker/ui/_flows.py b/piker/ui/_flows.py index d7c5c2e6..282231e9 100644 --- a/piker/ui/_flows.py +++ b/piker/ui/_flows.py @@ -925,15 +925,7 @@ def by_index_and_key( np.ndarray, np.ndarray, ]: - # full input data - x = array['index'] - y = array[array_key] - - return tuple({ - 'x': x, - 'y': y, - 'connect': 'all', - }.values()) + return array['index'], array[array_key], 'all' class Renderer(msgspec.Struct): @@ -941,7 +933,12 @@ class Renderer(msgspec.Struct): flow: Flow # last array view read last_read: Optional[tuple] = None - format_xy: Callable[np.ndarray, tuple[np.ndarray]] = by_index_and_key + + # default just returns index, and named array from data + format_xy: Callable[ + [np.ndarray, str], + tuple[np.ndarray] + ] = by_index_and_key # output graphics rendering, the main object # processed in ``QGraphicsObject.paint()``