From 80af3dfabf2377e8420769e25c78cacefa91548c Mon Sep 17 00:00:00 2001 From: Junyan Xu Date: Mon, 5 Oct 2026 12:12:36 -0700 Subject: [PATCH 1/2] Fix offline detection_time offset by one inference step The offline Postprocessor's t0 omitted the 1 / inference_sampling_rate term that online get_time_offset includes, so offline detection times came out one inference step (0.25 s at 4 Hz) early. --- projects/infer/infer/postprocess.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/infer/infer/postprocess.py b/projects/infer/infer/postprocess.py index cff748eb4..e106165f3 100644 --- a/projects/infer/infer/postprocess.py +++ b/projects/infer/infer/postprocess.py @@ -39,8 +39,16 @@ def __init__( # offset our initial time both by the psd data # that we're going to slough off as well as by - # the filter settle-in and integration time - self.t0 = t0 + psd_length - fduration / 2 - integration_window_length + # the filter settle-in and integration time, plus + # one inference step since the first output is + # produced from a full window ending one step in + self.t0 = ( + t0 + + psd_length + - fduration / 2 + - integration_window_length + + 1 / inference_sampling_rate + ) self.offset = int(psd_length * inference_sampling_rate) # convert our window lengths to sample units From a096e4ab69344c782420d378f262edb370ea5a50 Mon Sep 17 00:00:00 2001 From: Junyan Xu Date: Mon, 5 Oct 2026 12:55:39 -0700 Subject: [PATCH 2/2] Update Postprocessor test for corrected t0 offset --- projects/infer/tests/test_postprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/infer/tests/test_postprocess.py b/projects/infer/tests/test_postprocess.py index bf7b37512..a537621b2 100644 --- a/projects/infer/tests/test_postprocess.py +++ b/projects/infer/tests/test_postprocess.py @@ -11,4 +11,4 @@ def test_postprocessor(): integration_window_length=0.5, cluster_window_length=0.2, ) - assert postprocessor.t0 == 9.0 + assert postprocessor.t0 == 9.01