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.storage_cli
parent
4da772292f
commit
b9c2c254dc
|
@ -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 (
|
||||
|
|
Loading…
Reference in New Issue