diff --git a/piker/tsp/_anal.py b/piker/tsp/_anal.py index 46bee231..14d34238 100644 --- a/piker/tsp/_anal.py +++ b/piker/tsp/_anal.py @@ -276,14 +276,41 @@ def get_null_segs( absi_zdiff: np.ndarray = np.diff(absi_zeros) if zero_t.size < 2: - try: - breakpoint() - except RuntimeError: - # XXX, if greenback not active from - # piker store ldshm cmd.. - log.exception( - "Can't debug single-sample null!\n" - ) + idx: int = zero_t['index'][0] + idx_before: int = idx - 1 + idx_after: int = idx + 1 + index = frame['index'] + before_cond = idx_before <= index + after_cond = index <= idx_after + bars: np.ndarray = frame[ + before_cond + & + after_cond + ] + time: np.ndarray = bars['time'] + from pendulum import ( + from_timestamp, + Interval, + ) + gap: Interval = ( + from_timestamp(time[-1]) + - + from_timestamp(time[0]) + ) + log.warning( + f'Single OHLCV-bar null-segment detected??\n' + f'gap -> {gap}\n' + ) + + # ^^XXX, if you want to debug the above bar-gap^^ + # try: + # breakpoint() + # except RuntimeError: + # # XXX, if greenback not active from + # # piker store ldshm cmd.. + # log.exception( + # "Can't debug single-sample null!\n" + # ) return None