Skill and agents no longer name Diagnostic-app paths (analyses, labeling/auto, demande.json, summary location, git rules of the working repository). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
2.1 KiB
Python
37 lines
2.1 KiB
Python
"""Detector of the Obstruction family (the families document): 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 the families document; wf-improve 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"])
|