summaryrefslogtreecommitdiff
path: root/lib/lennart
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-01-14 15:35:33 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-01-14 15:35:33 +0100
commite7f181ed3eafbff9c38a993a263f771fe7377694 (patch)
tree0c1c3300202e89afa661c90f4efecd00d570dc33 /lib/lennart
parent3b3d166b266a6467591e1617a8856b211d9006ca (diff)
energytrace drift compensation: handle arbitrarily long detection failures
Diffstat (limited to 'lib/lennart')
-rw-r--r--lib/lennart/DataProcessor.py25
1 files changed, 6 insertions, 19 deletions
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)