From f30a48b82cafa27a4345299616776df8b255e598 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 21 Dec 2022 13:21:49 -0500 Subject: [PATCH] Use `np.diff()` on last 16 samples instead of only last datum pair --- piker/ui/_dataviz.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/piker/ui/_dataviz.py b/piker/ui/_dataviz.py index ba34616e..33047678 100644 --- a/piker/ui/_dataviz.py +++ b/piker/ui/_dataviz.py @@ -285,7 +285,10 @@ class Viz(msgspec.Struct): # , frozen=True): ) -> float: if self._index_step is None: index = self.shm.array[self.index_field] - self._index_step = index[-1] - index[-2] + self._index_step = max( + np.diff(index[-16:]).max(), + 1, + ) return self._index_step