diff --git a/piker/data/_formatters.py b/piker/data/_formatters.py index ef892c7a..4fbe3151 100644 --- a/piker/data/_formatters.py +++ b/piker/data/_formatters.py @@ -222,6 +222,7 @@ class IncrementalFormatter(msgspec.Struct): profiler: Profiler, slice_to_inview: bool = True, + force_full_realloc: bool = False, ) -> tuple[ np.ndarray, @@ -248,7 +249,10 @@ class IncrementalFormatter(msgspec.Struct): # we first need to allocate xy data arrays # from the source data. - if self.y_nd is None: + if ( + self.y_nd is None + or force_full_realloc + ): self.xy_nd_start = shm._first.value self.xy_nd_stop = shm._last.value self.x_nd, self.y_nd = self.allocate_xy_nd( diff --git a/piker/ui/_dataviz.py b/piker/ui/_dataviz.py index a24c7d5c..57a477d1 100644 --- a/piker/ui/_dataviz.py +++ b/piker/ui/_dataviz.py @@ -752,6 +752,7 @@ class Viz(Struct): profiler: Profiler | None = None, do_append: bool = True, + force_redraw: bool = False, **kwargs, @@ -796,7 +797,7 @@ class Viz(Struct): graphics, ) - should_redraw: bool = False + should_redraw: bool = force_redraw or False ds_allowed: bool = True # guard for m4 activation # TODO: probably specialize ``Renderer`` types instead of @@ -906,6 +907,11 @@ class Viz(Struct): should_ds=should_ds, showing_src_data=showing_src_data, + # XXX: reallocate entire underlying "format graphics array" + # whenever the caller insists, such as on history + # backfills. + force_reformat=force_redraw, + do_append=do_append, ) @@ -925,6 +931,7 @@ class Viz(Struct): reset_cache = False if ( reset_cache + or should_redraw ): # assign output paths to graphicis obj but # after a coords-cache reset. diff --git a/piker/ui/_render.py b/piker/ui/_render.py index fb41b696..2a442e98 100644 --- a/piker/ui/_render.py +++ b/piker/ui/_render.py @@ -136,6 +136,7 @@ class Renderer(msgspec.Struct): do_append: bool = True, use_fpath: bool = True, + force_reformat: bool = False, # only render datums "in view" of the ``ChartView`` use_vr: bool = True, @@ -174,6 +175,7 @@ class Renderer(msgspec.Struct): profiler, slice_to_inview=use_vr, + force_full_realloc=force_reformat, ) # no history in view case @@ -222,7 +224,10 @@ class Renderer(msgspec.Struct): or should_redraw ): # print(f"{self.viz.name} -> REDRAWING BRUH") - if new_sample_rate and showing_src_data: + if ( + new_sample_rate + and showing_src_data + ): log.info(f'DE-downsampling -> {array_key}') self._in_ds = False