From e7f181ed3eafbff9c38a993a263f771fe7377694 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 14 Jan 2021 15:35:33 +0100 Subject: energytrace drift compensation: handle arbitrarily long detection failures --- lib/lennart/DataProcessor.py | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'lib/lennart') diff --git a/lib/lennart/DataProcessor.py b/lib/lennart/DataProcessor.py index 7c161ab..40f1a26 100644 --- a/lib/lennart/DataProcessor.py +++ b/lib/lennart/DataProcessor.py @@ -289,6 +289,8 @@ class DataProcessor: edge_dsts.append(new_node) delta_drift = np.abs(prev_drift - new_drift) + # TODO evaluate "delta_drift ** 2" or similar nonlinear + # weights -> further penalize large drift deltas csr_weights.append(delta_drift) # a transition's candidate list may be empty @@ -362,26 +364,11 @@ class DataProcessor: transition = transition_by_node[node] drift = node_drifts[node] - if transition - prev_transition >= 2: - # previous transition was skipped due to lack of detected changepoints + while transition - prev_transition > 1: prev_drift = node_drifts[nodes[i - 1]] - mean_drift = np.mean([prev_drift, drift]) - expected_start_ts = ( - sync_timestamps[(prev_transition + 1) * 2] + mean_drift - ) - expected_end_ts = ( - sync_timestamps[(prev_transition + 1) * 2 + 1] + mean_drift - ) - compensated_timestamps.append(expected_start_ts) - compensated_timestamps.append(expected_end_ts) - if transition - prev_transition >= 3: - # previous transition was skipped due to lack of detected changepoints - expected_start_ts = ( - sync_timestamps[(prev_transition + 2) * 2] + mean_drift - ) - expected_end_ts = ( - sync_timestamps[(prev_transition + 2) * 2 + 1] + mean_drift - ) + prev_transition += 1 + expected_start_ts = sync_timestamps[prev_transition * 2] + prev_drift + expected_end_ts = sync_timestamps[prev_transition * 2 + 1] + prev_drift compensated_timestamps.append(expected_start_ts) compensated_timestamps.append(expected_end_ts) -- cgit v1.2.3