From 712f1a47a0f9b7c892e1c24c31bd1d9aab502d75 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 7 Mar 2023 14:36:19 -0500 Subject: [PATCH] Require `step: float` input to `slice_from_time()` There's been way too many issues when trying to calculate this dynamically from the input array, so just expect the caller to know what it's doing and don't bother with ever hitting the error case of calculating and incorrect value internally. --- piker/data/_pathops.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/piker/data/_pathops.py b/piker/data/_pathops.py index d8c15511..48a11f40 100644 --- a/piker/data/_pathops.py +++ b/piker/data/_pathops.py @@ -295,7 +295,7 @@ def slice_from_time( arr: np.ndarray, start_t: float, stop_t: float, - step: int | None = None, + step: float, # sampler period step-diff ) -> slice: ''' @@ -324,12 +324,6 @@ def slice_from_time( # end of the input array. read_i_max = arr.shape[0] - # TODO: require this is always passed in? - if step is None: - step = round(t_last - times[-2]) - if step == 0: - step = 1 - # compute (presumed) uniform-time-step index offsets i_start_t = floor(start_t) read_i_start = floor(((i_start_t - t_first) // step)) - 1 @@ -412,7 +406,7 @@ def slice_from_time( times[read_i_start:], # times, i_stop_t, - side='left', + side='right', ) if (