From 2669ced629c7fc543752597014809dc57c6347de Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 6 Dec 2022 15:43:44 -0500 Subject: [PATCH] Drop `_slice_from_time()` --- piker/data/_pathops.py | 63 ------------------------------------------ 1 file changed, 63 deletions(-) diff --git a/piker/data/_pathops.py b/piker/data/_pathops.py index d83752c3..a56b95da 100644 --- a/piker/data/_pathops.py +++ b/piker/data/_pathops.py @@ -272,55 +272,6 @@ def ohlc_flatten( return x, flat -@njit -def _slice_from_time( - arr: np.ndarray, - start_t: float, - stop_t: float, - -) -> tuple[int, int]: - ''' - Slice an input struct array to a time range and return the absolute - and "readable" slices for that array as well as the indexing mask - for the caller to use to slice the input array if needed. - - ''' - times = arr['time'] - index = arr['index'] - - if ( - start_t < 0 - or start_t >= stop_t - ): - return ( - ( - index[0], - index[-1], - ), - ( - 0, - len(arr), - ), - ) - - read_i_0: int = 0 - read_i_last: int = 0 - - for i in range(times.shape[0]): - time = times[i] - if time >= start_t: - read_i_0 = i - break - - for i in range(read_i_0, times.shape[0]): - time = times[i] - if time > stop_t: - read_i_last = time - break - - return read_i_0, read_i_last - - def slice_from_time( arr: np.ndarray, start_t: float, @@ -437,20 +388,6 @@ def slice_from_time( # ) read_i_start = new_read_i_start - # old much slower non-bin-search ``numba`` approach.. - # ( - # read_i_start, - # read_i_stop, - # ) = _slice_from_time( - # arr, - # start_t, - # stop_t, - # ) - # abs_i_start = int(index[0]) + read_i_0 - # abs_i_stop = int(index[0]) + read_i_last - # if read_i_stop == 0: - # read_i_stop = times.shape[0] - # read-relative indexes: gives a slice where `shm.array[read_slc]` # will be the data spanning the input time range `start_t` -> # `stop_t`