feat(backend): introduce session controller and status models
Implement DeviceController and SessionController to bridge QML requests with backend state, supporting playback replay tracking, cluster averaging, and slot error boundaries.
This commit is contained in:
@@ -2,14 +2,14 @@ import numpy as np
|
||||
|
||||
|
||||
class ReplayStatsTracker:
|
||||
"""Accumulates per-frames statistic acrossa replay session."""
|
||||
"""Accumulates per-frame statistics across a replay session."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.history: list[dict] = []
|
||||
self.running_avg: float = 0.0
|
||||
|
||||
def track(self, frame_index: int, temperatures: list[float]) -> dict:
|
||||
arr = np.array(temperatures, dtype = np.float32)
|
||||
arr = np.array(temperatures, dtype=np.float32)
|
||||
clean_arr = arr[np.isfinite(arr)]
|
||||
|
||||
if clean_arr.size == 0:
|
||||
@@ -24,12 +24,11 @@ class ReplayStatsTracker:
|
||||
}
|
||||
|
||||
self.history.append(stats)
|
||||
if self.history:
|
||||
self.running_avg = float(np.mean([s["avg"] for s in self.history]))
|
||||
self.running_avg = float(np.mean([s["avg"] for s in self.history]))
|
||||
return stats
|
||||
|
||||
def get_trend(self) -> list[float]:
|
||||
"""Return list of per-frame average for trend chat"""
|
||||
"""Return list of per-frame averages for the trend chart."""
|
||||
return [s["avg"] for s in self.history]
|
||||
|
||||
def reset(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user