Plot daily analysis points at noon of their day
Analyses 03 and 04 now place each day's point and bar at 12:00 UTC instead of 23:00, where they read as the next day. Computations are unchanged. D-019 records the choice and the rejected one-day shift of the night-end voltage (tried in 03, then in 04 only); sheet 04 gains limit 6 (night end of J reflects J-1), and the data-pitfalls note explains why. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3082f75429
commit
129d4ff59b
5 files changed
+31
-7
No files matched your search
+12
-5
@@ -4,6 +4,7 @@ Documentation : docs/analyses/analyse_01.md à analyse_04.md
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
from datetime import datetime, time, timezone
|
||||
|
||||
from plotly.subplots import make_subplots
|
||||
|
||||
@@ -68,11 +69,16 @@ STATE_STYLE = {
|
||||
}
|
||||
|
||||
|
||||
def noon(day):
|
||||
"""Abscisse d'un point journalier (analyses 03 et 04) : midi UTC de son jour, au milieu de la journée."""
|
||||
return datetime.combine(day, time(12), timezone.utc)
|
||||
|
||||
|
||||
def daily_state_panel(fig, result, row):
|
||||
"""Panneau DAILY_BATTERY_STATE : maximum et fin de nuit par jour, seuils, état en marqueurs (fiche analyse_03)."""
|
||||
group = dict(legendgroup=result["analysis"], legendgrouptitle_text=f"Analyse {result['analysis']}")
|
||||
rule, pts = result["rule"], result["points"]
|
||||
x = [p["t"] for p in pts]
|
||||
x = [noon(p["t"].date()) for p in pts]
|
||||
fig.add_scatter(x=x, y=[p["facts"].get("max_v") for p in pts], name="maximum du jour", mode="lines",
|
||||
line=dict(color="#52514e", width=1.5), hoverinfo="skip", row=row, col=1, **group)
|
||||
fig.add_scatter(x=x, y=[p["facts"].get("night_end_v") for p in pts], name="fin de nuit", mode="lines",
|
||||
@@ -89,7 +95,8 @@ def daily_state_panel(fig, result, row):
|
||||
continue
|
||||
hover = [f"{p['t']:%Y-%m-%d} : {label}<br>" + "<br>".join(f"{k}={val}" for k, val in p["facts"].items())
|
||||
for p in sel]
|
||||
fig.add_scatter(x=[p["t"] for p in sel], y=[p["facts"]["max_v"] for p in sel], name=label, mode="markers",
|
||||
fig.add_scatter(x=[noon(p["t"].date()) for p in sel], y=[p["facts"]["max_v"] for p in sel], name=label,
|
||||
mode="markers",
|
||||
marker=dict(color=color, symbol=symbol, size=8, line=dict(color="white", width=1)),
|
||||
text=hover, hovertemplate="%{text}<extra></extra>", row=row, col=1, **group)
|
||||
fig.update_yaxes(title_text="BusVoltage [V]", row=row, col=1)
|
||||
@@ -104,7 +111,7 @@ def daily_trend_panel(fig, result, row):
|
||||
"""Panneau DAILY_BATTERY_TREND : écart de fin de nuit J − J−1 en barres, couleur = tendance (fiche analyse_04)."""
|
||||
group = dict(legendgroup=result["analysis"], legendgrouptitle_text=f"Analyse {result['analysis']}")
|
||||
pts, db = result["points"], result["rule"]["night_end_deadband_v"]
|
||||
x = [p["t"] for p in pts]
|
||||
x = [noon(p["t"].date()) for p in pts]
|
||||
# Zone morte tracée comme une courbe (un point par jour, None entre +db et −db) : visible au zoom (D-013).
|
||||
fig.add_scatter(x=x + [None] + x, y=[db] * len(x) + [None] + [-db] * len(x), name=f"zone morte ±{db} V",
|
||||
mode="lines", hoverinfo="skip", line=dict(color="#52514e", dash="dash", width=1),
|
||||
@@ -116,8 +123,8 @@ def daily_trend_panel(fig, result, row):
|
||||
hover = [f"{p['t']:%Y-%m-%d} : {label} (décidé par {p['facts']['decided_by']})<br>"
|
||||
f"{p['facts']['state_prev']} → {p['facts']['state']}<br>"
|
||||
+ "<br>".join(f"{k}={v}" for k, v in p["facts"].items() if k.startswith("delta")) for p in sel]
|
||||
fig.add_bar(x=[p["t"] for p in sel], y=[p["value"] for p in sel], name=label, marker_color=color,
|
||||
width=0.8 * 86_400_000, hovertext=hover, hovertemplate="%{hovertext}<extra></extra>",
|
||||
fig.add_bar(x=[noon(p["t"].date()) for p in sel], y=[p["value"] for p in sel], name=label,
|
||||
marker_color=color, width=0.8 * 86_400_000, hovertext=hover, hovertemplate="%{hovertext}<extra></extra>",
|
||||
row=row, col=1, **group)
|
||||
fig.update_yaxes(title_text="Δ fin de nuit [V]", row=row, col=1)
|
||||
|
||||
|
||||
Reference in new issue
Block a user