The detectors are in detectors/detectors/; the manual set and the benchmark in models/rules/ (moved from aimsight-detectors)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-25 14:28:23 +01:00
1 parent cae07a2787
commit 9d75a71522
5 files changed
+13 -13

No files matched your search

+6 -6
View File
@@ -1,7 +1,7 @@
"""The data of the Data page: a station's images, its curves, its labels.
Data are read as the agents read them, tools/scripts/data.py (the tools repository, through the tools/ link); the detectors'
events are those of detectors/scripts/categories.py (window); the rules of the labels and what the client is told, those of
events are those of detectors/detectors/categories.py (window); the rules of the labels and what the client is told, those of
labeling/scripts (validate, ids, client). Read-only on data/, filled only by pump.sh; writes only in
labeling/auto/. What brings data in (the pumping, the list of the tracked stations) is in ~/aimsight-data, called as it
is (extraction/pumping.py); the weather is pumped with the data, data/<STATION>/weather/ (data.load_weather).
@@ -25,7 +25,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
# ~/aimsight-data, the repository of data/: the method that brings data in (the pumping, the weather with it), called as it is
DATA_REPOSITORY = Path(os.environ.get("AIMSIGHT_DATA", ROOT / "data")).resolve().parent
sys.path[:0] = [str(ROOT / "tools" / "scripts"), str(ROOT / "detectors" / "scripts"), str(ROOT / "labeling" / "scripts"),
sys.path[:0] = [str(ROOT / "tools" / "scripts"), str(ROOT / "detectors" / "detectors"), str(ROOT / "labeling" / "scripts"),
str(DATA_REPOSITORY / "extraction")]
import categories # noqa: E402
import client # noqa: E402 (labeling: what the client is told of an event)
@@ -266,9 +266,9 @@ def pump(body):
# --- the Data page, "Detectors" labels: the events of the journal, read-only
# The sets of detectors: detectors/scripts/ (classic, imported here), detectors/manual/ (the same layout, hand-made: run in
# The sets of detectors: detectors/detectors/ (classic, imported here), models/rules/manual/ (the same layout, hand-made: run in
# a process of its own, its modules bear the same names as the classic ones)
MANUAL = ROOT / "detectors" / "manual"
MANUAL = ROOT / "models" / "rules" / "manual"
CHILD = ("import pickle, sys; out, sys.stdout = sys.stdout.buffer, sys.stderr; sys.path.insert(0, sys.argv[1]); import categories; "
"pickle.dump(categories.window(*pickle.load(sys.stdin.buffer)), out)")
@@ -278,7 +278,7 @@ def window(set_, every, a, b, sensitivity=0):
if set_ != "manual":
return categories.window(every, a, b)
if not (MANUAL / "categories.py").is_file():
raise Refusal("no manual detectors: detectors/manual/ has no categories.py")
raise Refusal("no manual detectors: models/rules/manual/ has no categories.py")
run = subprocess.run([sys.executable, "-c", CHILD, str(MANUAL)], input=pickle.dumps((every, a, b, sensitivity or None)), capture_output=True, cwd=ROOT)
sys.stderr.write(run.stderr.decode(errors="replace"))
if run.returncode:
@@ -296,7 +296,7 @@ def detectors(station, start, end, targets="", set_="classic", sensitivity=0):
def journal(station, start, end, targets="", set_="classic", sensitivity=0):
"""-> the detectors' events over the range, in the label format (start, end, family, description); plus kind,
sensors, ignore (greyed area of the journal). targets: the sensors kept, comma-separated (empty: all); the others are
removed before the detectors, as if they did not exist. set_: classic (detectors/scripts/) or manual (detectors/manual/);
removed before the detectors, as if they did not exist. set_: classic (detectors/detectors/) or manual (models/rules/manual/);
sensitivity: of the manual set, 1 (tolerant) to 10 (severe), 0: the default of the code."""
d = folder(station)
every = data.load(d)