Add the day focus: a day and the day before only
D-024: to explain a day's color, show only that day and the day before, the only days analyses 03 and 04 read for it. day_color.focus() selects the data (standard library); src/focus_jour.py prints a traceable fact summary and writes a 48 h BusVoltage figure (out/<STATION>_focus_<date> .html and .json). Analysis 03 gains the night_end_h fact; the other facts are unchanged. The client Energy mockup does not use this figure: the user prefers numeric facts there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8452973912
commit
1a2220d317
8 files changed
+177
-4
No files matched your search
@@ -40,7 +40,9 @@ def day_facts(day):
|
||||
low = h
|
||||
if day[h] - day[low] > rise_v:
|
||||
rise_v, night_end_h = day[h] - day[low], low
|
||||
night_end_v = day[night_end_h] if rise_v else min_v # sans montée : le point le plus bas du jour
|
||||
if not rise_v:
|
||||
night_end_h = min(day, key=day.get) # sans montée : le point le plus bas du jour
|
||||
night_end_v = day[night_end_h]
|
||||
hours_full = sum(v >= FULL_CHARGE_V for v in day.values())
|
||||
coverage = len(day) / 24
|
||||
# Les états 1 et 2 reposent sur une valeur mesurée : ils passent avant la couverture minimale.
|
||||
@@ -55,6 +57,7 @@ def day_facts(day):
|
||||
else:
|
||||
state = "PARTIAL_CHARGE"
|
||||
return {"state": state, "max_v": round(max_v, 3), "min_v": round(min_v, 3), "night_end_v": round(night_end_v, 3),
|
||||
"night_end_h": night_end_h,
|
||||
"rise_v": round(rise_v, 3), "hours_full": hours_full, "coverage": round(coverage, 3)}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user