"""NIEDERHORN : pour chaque étiquette de la plante dont l'image n'a pas été regardée, les heures où PWD_IMP_B07_016_C09 est rejetée (error_value > seuil) dans la plage.""" import csv, glob, json from datetime import datetime def t(s): return datetime.fromisoformat(s.replace('Z', '+00:00')) ev = {} for p in glob.glob('data/NIEDERHORN/displacement/NIEDERHORN_advanced_*.csv'): for r in csv.DictReader(open(p)): if r['sensor_name'].strip() == 'PWD_IMP_B07_016_C09': ev[datetime.fromisoformat(r['time_utc']).replace(minute=0, second=0, microsecond=0)] = float(r['error_value']) > float(r['error_threshold']) for n, l in enumerate(open('labeling/auto/NIEDERHORN.jsonl'), 1): e = json.loads(l) if e['categorie'] == 'Obstruction' and "n'a pas été regardée" in e['description']: d0, d1 = t(e['debut']), t(e['fin']) print(f"NIEDERHORN#{n}", e['debut'], e['fin'], [f'{i:%dT%H}' for i in sorted(ev) if d0 < i < d1 and ev[i]])