From 29b9091711e5befae9a72e0b4b17c5ff76d3b175 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 8 Dec 2022 15:43:11 -0500 Subject: [PATCH] Slicec to an extra index around each timestamp input --- piker/data/_pathops.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/piker/data/_pathops.py b/piker/data/_pathops.py index cfb2e1cb..da51e9c1 100644 --- a/piker/data/_pathops.py +++ b/piker/data/_pathops.py @@ -328,10 +328,10 @@ def slice_from_time( # compute (presumed) uniform-time-step index offsets i_start_t = round(start_t) - read_i_start = ((i_start_t - t_first) // step) - 1 + read_i_start = round(((i_start_t - t_first) // step)) - 1 i_stop_t = round(stop_t) - read_i_stop = (i_stop_t - t_first) // step + read_i_stop = round((i_stop_t - t_first) // step) + 1 # always clip outputs to array support # for read start: @@ -346,11 +346,6 @@ def slice_from_time( min(read_i_stop, read_i_max), ) - samples = (i_stop_t - i_start_t) // step - index_diff = read_i_stop - read_i_start + 1 - if index_diff > (samples + 3): - breakpoint() - # check for larger-then-latest calculated index for given start # time, in which case we do a binary search for the correct index. # NOTE: this is usually the result of a time series with time gaps @@ -418,6 +413,12 @@ def slice_from_time( ): read_i_stop = read_i_start + new_read_i_stop + # sanity checks for range size + # samples = (i_stop_t - i_start_t) // step + # index_diff = read_i_stop - read_i_start + 1 + # if index_diff > (samples + 3): + # breakpoint() + # read-relative indexes: gives a slice where `shm.array[read_slc]` # will be the data spanning the input time range `start_t` -> # `stop_t`