Files
Support-Agent/src/analyse_01.py
T
maximeandClaude Opus 5.5 7b1da6d7cf Add analysis 02 (midnight sample), simplify plots, spell out rule names
- Analysis 02 MOVING_AVERAGE_7_DAYS_MIDNIGHT_UTC_DROP: same rule as
  analysis 01 on the 00:00 UTC BusVoltage sample only, one point per
  day. Shared computation in energy_check._ma_drop(); analysis 01
  results unchanged on VERMONT.
- Common page: one panel per analysis (02 under 01), then the time
  series (D-016); src/analyse_02.py launches that page.
- Analysis panel reduced to two curves on one volt axis: 7-day mean
  and threshold; gap and reference moved to hover (D-015).
- Date tick labels under every subplot.
- Rule IDs spelled out: MA7D_DROP -> MOVING_AVERAGE_7_DAYS_DROP,
  MA7D_MIDNIGHT_DROP -> MOVING_AVERAGE_7_DAYS_MIDNIGHT_UTC_DROP (D-017).
- Docs: analysis sheet 02, sheet 01, CLAUDE.md, README, decisions
  D-015..D-017, analysis rule and nouvelle-analyse skill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 09:31:52 +02:00

34 lines
1.2 KiB
Python

"""Analyse 01 : MOVING_AVERAGE_7_DAYS_DROP (tendance de BusVoltage en moyenne glissante), graphiques HTML ouverts dans le navigateur.
La page montre aussi, juste dessous, l'analyse 02 (MOVING_AVERAGE_7_DAYS_MIDNIGHT_UTC_DROP), pour comparer les deux méthodes.
Usage : python3 src/analyse_01.py [CSV ou dossiers...] (défaut : data/, sortie dans out/)
Documentation : docs/analyses/analyse_01.md
"""
import importlib.util
import os
import shutil
import subprocess
import sys
import webbrowser
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
VENV = ROOT / ".venv" / "bin" / "python"
if importlib.util.find_spec("plotly") is None and VENV.exists():
os.execv(VENV, [str(VENV), *sys.argv]) # plotly n'est installé que dans .venv
import energy_plot # noqa: E402
def open_html(path):
if shutil.which("explorer.exe") and shutil.which("wslpath"): # WSL : navigateur Windows
subprocess.run(["explorer.exe", subprocess.check_output(["wslpath", "-w", path], text=True).strip()])
else:
webbrowser.open(Path(path).resolve().as_uri())
if __name__ == "__main__":
args = sys.argv[1:] or [str(ROOT / "data")]
for p in energy_plot.main([*args, "--out", str(ROOT / "out")]):
open_html(p)