summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-01-19 11:07:56 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-01-19 11:07:56 +0100
commitcb2af15124b1489897763ae5785029db59cb0dbe (patch)
treedd836feb609aab8957e1fb24074826074bbd8969
parent88cb3fead0c2faa60f1891f86a1edbd2f6a705b2 (diff)
greedy drift compensation: handle edge cases
-rw-r--r--lib/lennart/DataProcessor.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/lennart/DataProcessor.py b/lib/lennart/DataProcessor.py
index e45fba3..fe9ae80 100644
--- a/lib/lennart/DataProcessor.py
+++ b/lib/lennart/DataProcessor.py
@@ -495,9 +495,15 @@ class DataProcessor:
end_left_sync = end_right_sync - 1
start_left_diff = expected_start_ts - candidates[start_left_sync]
- start_right_diff = candidates[start_right_sync] - expected_start_ts
+ 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]
- end_right_diff = candidates[end_right_sync] - expected_end_ts
+ if end_right_sync < len(candidates):
+ end_right_diff = candidates[end_right_sync] - expected_end_ts
+ else:
+ end_right_diff = np.inf
drift_candidates = (
start_left_diff,