Optimizer : l'optimisation des détecteurs depuis une analyse (skill improve, ex wf-improve, agents du dépôt agents, benchmark detectors/bench) ; le batch et le scanner archivés
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
010c297f60
commit
2cb0c88a2b
117 files changed
+132
-38
No files matched your search
@@ -0,0 +1,37 @@
|
||||
# Diff the events (as score.py computes them: the range in one pass, 3 days of history) between two detector folders.
|
||||
# Usage: python3 diff_events.py <detectors A> <detectors B> <station folder> <from YYYY-MM-DD> <to YYYY-MM-DD> [family]
|
||||
import importlib.util
|
||||
import sys
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
def load_mod(d, name):
|
||||
sys.path.insert(0, d + "/scripts")
|
||||
spec = importlib.util.spec_from_file_location(name, d + "/scripts/categories.py")
|
||||
m = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(m)
|
||||
sys.path.pop(0)
|
||||
for k in [k for k in sys.modules if k in ("data", "visibility", "target_issue", "displacement")]:
|
||||
del sys.modules[k]
|
||||
return m
|
||||
|
||||
|
||||
def run(d, folder, a, b):
|
||||
c = load_mod(d, "cat_" + str(abs(hash(d))))
|
||||
import data
|
||||
ms = data.load(folder)
|
||||
s, e = data.parse_time(a), data.parse_time(b)
|
||||
chunk = {k: x for k, v in ms.items() if (x := [m for m in v if s - timedelta(days=3) <= m["t"] < e])}
|
||||
out = set()
|
||||
for v in c.events(chunk, folder=folder):
|
||||
if v["end"] >= data.iso(s) and (len(sys.argv) < 7 or v["category"] == sys.argv[6]):
|
||||
out.add(f"{v['start']} → {v['end']} {v['category']:<20} {v['episodes'][0]['label']} | {','.join(v['sensors'][:5])}")
|
||||
return out
|
||||
|
||||
|
||||
A = run(sys.argv[1], sys.argv[3], sys.argv[4], sys.argv[5])
|
||||
B = run(sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
|
||||
for x in sorted(A - B):
|
||||
print("<", x)
|
||||
for x in sorted(B - A):
|
||||
print(">", x)
|
||||
Reference in new issue
Block a user