summaryrefslogtreecommitdiff
path: root/lib/lennart/DataProcessor.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-01-20 15:47:15 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-01-20 15:47:15 +0100
commitd94c8d1bf065e5795199199c0fb758373aa2d365 (patch)
tree98cd1e7c19aad640d41cd5ef4b74682cc8d03b39 /lib/lennart/DataProcessor.py
parentf6220796d20d8a8892c7ede92d12cab03e003748 (diff)
greedy drift compensation: Handle left corner case as well. Oops.
Diffstat (limited to 'lib/lennart/DataProcessor.py')
-rw-r--r--lib/lennart/DataProcessor.py13
1 files 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: