fix: comparison results never reached QML; restore click-box run selection

This commit is contained in:
jack
2026-07-06 13:12:58 -07:00
parent f604308466
commit 3b919f576f
3 changed files with 137 additions and 149 deletions
@@ -40,8 +40,10 @@ class SessionController(QObject):
liveStatsChanged = Signal() # emitted when receivedCount or errorCount change
# trend: per-frame avg for live graph
trendData = Signal(str) # JSON array of floats
comparisonResult = Signal(object) # dict with success, distance, warping_path, max_sensor_deviation, series_a, series_b
splitResult = Signal(object) # dict with success, segments
# NOTE: dict (QVariantMap), not object — Signal(object) delivers Python
# dicts to QML as an opaque empty wrapper with no accessible fields.
comparisonResult = Signal(dict) # dict with success, distance, warping_path, max_sensor_deviation, series_a, series_b
splitResult = Signal(dict) # dict with success, segments
# private: marshal a worker-thread frame onto the main thread
_liveFrame = Signal(object) # Frame
_liveError = Signal() # worker-thread error ping
@@ -357,10 +359,11 @@ class SessionController(QObject):
result = compare_runs(series_a, series_b)
# Mean temporal shif along the DTW path: positive means run B
# reaches the same profile features lather than run A.
# Mean temporal shift along the DTW path: positive means run B
# reaches the same profile features later than run A.
path = result["warping_path"]
frame_offset = round(sum(j - i for i, j in path) / len(path)) if path else 0
# Max sensor deviation: walk the DTW-aligned frame pairs and take
# the largest per-sensor abs difference across all sensors, not
# just the sensor[0] series used for alignment.
@@ -422,7 +425,8 @@ class SessionController(QObject):
self.comparisonResult.emit({
"success": True,
"distance": result["distance"],
"warping_path": result["warping_path"][:50], # limit path size
# Lists, not tuples — tuples don't survive QVariant conversion
"warping_path": [list(p) for p in result["warping_path"][:50]],
"frame_offset": frame_offset,
"max_sensor_deviation": max_sensor_deviation,
"series_a": series_a,
@@ -709,6 +713,9 @@ class SessionController(QObject):
self._trend_timestamps.pop(0)
self._trend_buffer.pop(0)
def _flush_repaint(self) -> None:
if not self._dirty:
return