From d94c8d1bf065e5795199199c0fb758373aa2d365 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 20 Jan 2021 15:47:15 +0100 Subject: greedy drift compensation: Handle left corner case as well. Oops. --- lib/lennart/DataProcessor.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/lennart/DataProcessor.py b/lib/lennart/DataProcessor.py index 10545c1..0fda100 100644 --- a/lib/lennart/DataProcessor.py +++ b/lib/lennart/DataProcessor.py @@ -509,12 +509,21 @@ class DataProcessor: end_right_sync = bisect_left(candidates, expected_end_ts) end_left_sync = end_right_sync - 1 - start_left_diff = expected_start_ts - candidates[start_left_sync] + if start_right_sync >= 0: + start_left_diff = expected_start_ts - candidates[start_left_sync] + else: + start_left_diff = np.inf + if start_right_sync < len(candidates): start_right_diff = candidates[start_right_sync] - expected_start_ts else: start_right_diff = np.inf - end_left_diff = expected_end_ts - candidates[end_left_sync] + + if end_left_sync >= 0: + end_left_diff = expected_end_ts - candidates[end_left_sync] + else: + end_left_diff = np.inf + if end_right_sync < len(candidates): end_right_diff = candidates[end_right_sync] - expected_end_ts else: -- cgit v1.2.3