Rework analysis 01 entry point and plots, drop tests
- src/analyse_01.py: single entry point, analyses data/, writes and opens the HTML report (switches to .venv for plotly). - Plot: analysis on top, one subplot per time series below; zoom in time only, y axes rescaled to the visible range on every zoom. - Tests removed: experimental prototype phase (D-008). - Ignore __pycache__/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
128d4bc298
commit
0b950199b8
6 files changed
+109
-283
No files matched your search
@@ -0,0 +1,32 @@
|
||||
"""Analyse 01 : MA7D_DROP (tendance de BusVoltage en moyenne glissante), graphiques HTML ouverts dans le navigateur.
|
||||
|
||||
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)
|
||||
Reference in new issue
Block a user