Implement `stop_t` gap adjustments; the good lord said it is the problem

epoch_indexing_and_dataviz_layer
Tyler Goodlet 2022-12-07 19:58:55 -05:00
parent 96b871c4d7
commit 44f50e3d0e
1 changed files with 23 additions and 10 deletions

View File

@ -305,6 +305,7 @@ def slice_from_time(
index = arr['index'] index = arr['index']
i_first = index[0] i_first = index[0]
i_last = index[-1]
read_i_max = arr.shape[0] read_i_max = arr.shape[0]
if ( if (
@ -392,18 +393,30 @@ def slice_from_time(
# ) # )
read_i_start = new_read_i_start - 1 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 ( if (
i_stop_t <= t_last new_read_i_stop < read_i_stop
and t_iv_stop < i_stop_t
): ):
t_diff = stop_t - t_iv_stop read_i_stop = read_i_start + new_read_i_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-relative indexes: gives a slice where `shm.array[read_slc]` # read-relative indexes: gives a slice where `shm.array[read_slc]`
# will be the data spanning the input time range `start_t` -> # will be the data spanning the input time range `start_t` ->