From 01fc1d3887944c76475aa55c1a8fa0f81c9bbfc6 Mon Sep 17 00:00:00 2001 From: goodboy Date: Tue, 24 Feb 2026 14:48:23 -0500 Subject: [PATCH] Just warn on single-bar nulls instead of bping Replace the debug breakpoint with a warning-log when a single-bar null-segment is detected in `get_null_segs()`. This lets the gap analysis continue while still alerting about the anomaly. Deats, - extract the 3-bar window (before, null, after) and calculate a `gap: pendulum.Interval` for the warning msg. - comment-out the old breakpoint block for optional debugging as needed. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- piker/tsp/_anal.py | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) 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