Do single `ShmArray.array` read on zero-time filtering

account_tests
Tyler Goodlet 2023-07-26 15:41:04 -04:00
parent 2c6ae5d994
commit 08e8990fe3
1 changed files with 7 additions and 2 deletions

View File

@ -209,8 +209,13 @@ def detect_null_time_gap(
NOTE: for now presumes only ONE gap XD
'''
zero_pred: np.ndarray = shm.array['time'] == 0
zero_t: np.ndarray = shm.array[zero_pred]
# ensure we read buffer state only once so that ShmArray rt
# circular-buffer updates don't cause a indexing/size mismatch.
array: np.ndarray = shm.array
zero_pred: np.ndarray = array['time'] == 0
zero_t: np.ndarray = array[zero_pred]
if zero_t.size:
istart, iend = zero_t['index'][[0, -1]]
start, end = shm._array['time'][