From 4bb580ae607573d4b75910db02eb6ab5daafe11d Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 6 Mar 2023 18:30:58 -0500 Subject: [PATCH] Don't `@lru_cache` on `Viz.i_from_t()`, since view state.. --- piker/ui/_dataviz.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/piker/ui/_dataviz.py b/piker/ui/_dataviz.py index dd3ec411..2d1b6eed 100644 --- a/piker/ui/_dataviz.py +++ b/piker/ui/_dataviz.py @@ -1372,18 +1372,30 @@ class Viz(Struct): case 'both': return r_up, r_down - @lru_cache(maxsize=6116) + # @lru_cache(maxsize=6116) def i_from_t( self, t: float, - ) -> int: - return slice_from_time( + return_y: bool = False, + + ) -> int | tuple[int, float]: + + istart = slice_from_time( self.vs.in_view, start_t=t, stop_t=t, step=self.index_step(), ).start + if not return_y: + return istart + + vs = self.vs + arr = vs.in_view + key = 'open' if self.is_ohlc else self.name + yref = arr[istart][key] + return istart, yref + def scalars_from_index( self, xref: float | None = None,