Files
Support-Agent/src/analyse_01.py
T
maximeandClaude Opus 5.5 eacc0ecd4a Add analysis 03 entry point and documentation
src/analyse_03.py launches the common page; sheet 03 moves to
"prototype en place" with VERMONT results; CLAUDE.md, README and
sheet 01 list the third panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 10:53:15 +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, dessous, les analyses 02 (MOVING_AVERAGE_7_DAYS_MIDNIGHT_UTC_DROP) et 03 (DAILY_BATTERY_STATE).
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)