Slicec to an extra index around each timestamp input
parent
b4384209b6
commit
1546ff0001
|
@ -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`
|
||||
|
|
Loading…
Reference in New Issue