Detectors in English, under scripts/; learner tools under scripts/learner/
- data.py (was donnees.py): unused filtrer, heure_image and image sorting removed - score.py: dead functions (validite, marquer, detectes, score, familles) and the validity levels removed; --from/--to - regression.py: history.csv and --seance/--etape removed - categories.py: --from/--to/--chunk/--history; process values images/none/check - benchmark on all stations unchanged (same 132 figures) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b3ac0ecfe
commit
969637499f
23 files changed
+1877
-1971
No files matched your search
@@ -0,0 +1,36 @@
|
||||
"""Detector of the Obstruction family (labeling/familles.md): an object hides one or a few targets, for an instant or
|
||||
for long. It reuses two computations shared with other families:
|
||||
- the error_value of visibility.py: Brief obstruction (something passing, one instant) and Target obscured (a target
|
||||
rejected again and again while the others stay seen, or a nuisance that only touches a few targets, no reference);
|
||||
- the day-by-day rejections of target_issue.py: a target rejected for less than a week, Target obscured.
|
||||
A sensor already in an overlapping Target issue episode (Degraded target, Target stuck) is not returned as Obstruction:
|
||||
its curve is already to be ignored, the family is Target issue (boundary "Target issue or an episode of another family"
|
||||
of labeling/familles.md; learner session Obstruction, mod. 1: S1, problem targets of FLORIDA, NORDEND, SNCF01,
|
||||
NIEDERHORN, JUNGFRAU, CLARIDEN cut into Target obscured; S3, their isolated rejections as Brief obstruction).
|
||||
Usage: python3 detectors/obstruction.py <station folder> (prints the episodes)
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # data.py and the detectors, next to it
|
||||
import target_issue # noqa: E402
|
||||
import visibility # noqa: E402
|
||||
from data import load # noqa: E402
|
||||
|
||||
|
||||
def detect(measurements):
|
||||
ti = target_issue.episodes(measurements)
|
||||
issues = [e for e in ti if e["kind"] == "Target issue"]
|
||||
out = []
|
||||
for e in visibility.episodes(measurements) + ti:
|
||||
if e["kind"] != "Obstruction":
|
||||
continue
|
||||
taken = {s for h in issues if h["start"] <= e["end"] and h["end"] >= e["start"] for s in h["sensors"]}
|
||||
if (e := {**e, "sensors": [s for s in e["sensors"] if s not in taken]})["sensors"]: # minus the sensors
|
||||
out.append(e) # already in Target issue
|
||||
return sorted(out, key=lambda e: e["start"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for e in detect(load(sys.argv[1])):
|
||||
print(e["start"], "→", e["end"], e["label"], f"| {len(e['sensors'])}:", ",".join(e["sensors"][:8]), "|", e["text"])
|
||||
Reference in new issue
Block a user