17 lines
1.0 KiB
Python
17 lines
1.0 KiB
Python
"""Lance ensemble.py --rigide sur chaque étiquette Thermal displacement de NORDEND (BASE = debut de l'étiquette,
|
|||
|
|
fenêtre = l'étiquette), garde la sortie texte dans ../rigide/<id>.txt et les PNG dans ../fig/.
|
||
|
|
Usage, depuis la racine : python3 <ce fichier> [ID ...]"""
|
||
|
|
import json, os, subprocess, sys
|
||
|
|
|
||
|
|
ICI = os.path.dirname(os.path.abspath(__file__))
|
||
|
|
SORTIE = os.path.join(ICI, "..", "rigide")
|
||
|
|
FIG = os.path.join(ICI, "..", "fig")
|
||
|
|
os.makedirs(SORTIE, exist_ok=True)
|
||
|
|
lignes = [json.loads(l) for l in open("labeling/auto/NORDEND.jsonl")]
|
||
|
|
ids = [int(x.lstrip("#")) for x in sys.argv[1:]] or [i + 1 for i, l in enumerate(lignes) if l["categorie"] == "Thermal displacement"]
|
||
|
|
for i in ids:
|
||
|
|
l = lignes[i - 1]
|
||
|
|
r = subprocess.run([".venv/bin/python", "agent-tools/ensemble.py", "data/NORDEND", "--debut", l["debut"], "--fin", l["fin"],
|
||
|
|
"--rigide", l["debut"], "--table", "non", "--sortie", FIG], capture_output=True, text=True)
|
||
|
|
open(os.path.join(SORTIE, f"{i}.txt"), "w").write(r.stdout + r.stderr)
|
||
|
|
print(i, r.returncode)
|