From 44f50e3d0e31aee5a6a9653a41c5de0f719a1967 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 7 Dec 2022 19:58:55 -0500 Subject: [PATCH] Implement `stop_t` gap adjustments; the good lord said it is the problem --- piker/data/_pathops.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/piker/data/_pathops.py b/piker/data/_pathops.py index 72405cd8..cfb2e1cb 100644 --- a/piker/data/_pathops.py +++ b/piker/data/_pathops.py @@ -305,6 +305,7 @@ def slice_from_time( index = arr['index'] i_first = index[0] + i_last = index[-1] read_i_max = arr.shape[0] if ( @@ -392,18 +393,30 @@ def slice_from_time( # ) read_i_start = new_read_i_start - 1 - t_iv_stop = times[read_i_stop - 1] + i_iv_stop = index[read_i_stop - 1] + t_iv_stop = times[read_i_stop - 1] + if ( + i_iv_stop < i_last + # i_stop_t <= t_last + and t_iv_stop > i_stop_t + ): + # t_diff = stop_t - t_iv_stop + # print( + # f"WE'RE CUTTING OUT TIME - STEP:{step}\n" + # f'calced iv stop:{t_iv_stop} -> stop_t:{stop_t}\n' + # f'diff: {t_diff}\n' + # # f'SHOULD REMAP STOP: {read_i_start} -> {new_read_i_start}\n' + # ) + new_read_i_stop = np.searchsorted( + times[read_i_start:], + i_stop_t, + side='right', + ) + if ( - i_stop_t <= t_last - and t_iv_stop < i_stop_t + new_read_i_stop < read_i_stop ): - t_diff = stop_t - t_iv_stop - print( - f"WE'RE CUTTING OUT TIME - STEP:{step}\n" - f'calced iv stop:{t_iv_stop} -> stop_t:{stop_t}\n' - f'diff: {t_diff}\n' - # f'SHOULD REMAP STOP: {read_i_start} -> {new_read_i_start}\n' - ) + read_i_stop = read_i_start + new_read_i_stop # read-relative indexes: gives a slice where `shm.array[read_slc]` # will be the data spanning the input time range `start_t` ->