16 lines
949 B
Python
16 lines
949 B
Python
# The raw episodes of every detector (before categories.py) overlapping a time span. Args: <detectors folder> <station folder> <from YYYY-MM-DDTHH:MM> <to YYYY-MM-DDTHH:MM>
|
|
import importlib, sys
|
|
from datetime import timedelta
|
|
from pathlib import Path
|
|
det = Path(sys.argv[1]).resolve()
|
|
sys.path[:0] = [str(det / "scripts"), str(Path.home() / "aimsight-tools" / "scripts")]
|
|
from data import load, parse_time # noqa: E402
|
|
a, b = sys.argv[3] + "Z", sys.argv[4] + "Z"
|
|
ms = load(sys.argv[2])
|
|
h0, h1 = parse_time(a) - timedelta(days=3), parse_time(b) + timedelta(days=1)
|
|
chunk = {s: k for s, v in ms.items() if (k := [m for m in v if h0 <= m["t"] < h1])}
|
|
for name in ("visibility", "displacement", "target_issue", "thermal_displacement"):
|
|
for e in importlib.import_module(name).detect(chunk):
|
|
if e["start"] <= b and e["end"] >= a:
|
|
print(name, e["start"], e["end"], e["kind"], e["label"], len(e["sensors"]), ",".join(e["sensors"]))
|