visibility: Target obscured left to target_issue; categories no longer imports a detector
Removed: the repeated rejections of a target in visibility.py with K_TARGET, TARGET_MIN, TARGET_GAP (Obstruction found -5, correct +3: found -14 at SNCF01, 3 instants, and -10 at WILDSTRUBEL); Target obscured now comes from target_issue only. categories.py keeps its own JUMP_BACK so that a broken displacement.py does not block it. Benchmark Totals (from the previous commit): Obstruction found 45 -> 40 %, correct 31 -> 34 %; the other families unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5e5d2a244
commit
8b5f8a34b9
2 files changed
+3
-17
No files matched your search
@@ -25,7 +25,6 @@ from pathlib import Path
|
|||||||
HERE = Path(__file__).resolve().parent
|
HERE = Path(__file__).resolve().parent
|
||||||
sys.path[:0] = [str(HERE), str(HERE.parents[1] / "aimsight-tools" / "scripts")]
|
sys.path[:0] = [str(HERE), str(HERE.parents[1] / "aimsight-tools" / "scripts")]
|
||||||
from common import targets # noqa: E402
|
from common import targets # noqa: E402
|
||||||
from displacement import JUMP_BACK # noqa: E402
|
|
||||||
from data import iso, load # noqa: E402
|
from data import iso, load # noqa: E402
|
||||||
|
|
||||||
DETECTORS = ("displacement", "no_data", "target_issue", "thermal_displacement", "visibility")
|
DETECTORS = ("displacement", "no_data", "target_issue", "thermal_displacement", "visibility")
|
||||||
@@ -39,6 +38,7 @@ CATEGORIES = {
|
|||||||
"No data": {"ignore": False, "process": "none"},
|
"No data": {"ignore": False, "process": "none"},
|
||||||
"Displacement": {"ignore": False, "process": "check"},
|
"Displacement": {"ignore": False, "process": "check"},
|
||||||
}
|
}
|
||||||
|
JUMP_BACK = "Sudden jump, back to normal" # the label of displacement.py
|
||||||
MERGE = timedelta(hours=1)
|
MERGE = timedelta(hours=1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-16
@@ -1,5 +1,5 @@
|
|||||||
"""Visibility family: the camera sees the targets less well (error_value), or the air trembles (heat shimmer). The same
|
"""Visibility family: the camera sees the targets less well (error_value), or the air trembles (heat shimmer). The same
|
||||||
error_value also finds objects in front of a few targets: Obstruction family (Brief obstruction, Target obscured).
|
error_value also finds something passing in front of a few targets: Brief obstruction (Obstruction family).
|
||||||
|
|
||||||
1. High measurement: error_value above the median of its sensor + K_MAD MAD and above FACTOR times that median.
|
1. High measurement: error_value above the median of its sensor + K_MAD MAD and above FACTOR times that median.
|
||||||
2. Brief obstruction (one instant): at least BRIEF_MIN sensors high, SALIENCE times more than at each neighbouring instant
|
2. Brief obstruction (one instant): at least BRIEF_MIN sensors high, SALIENCE times more than at each neighbouring instant
|
||||||
@@ -11,8 +11,6 @@ error_value also finds objects in front of a few targets: Obstruction family (Br
|
|||||||
4. Diffuse nuisance: at least RUN_MIN instants in a row where the median over the sensors of the error_value, in MAD
|
4. Diffuse nuisance: at least RUN_MIN instants in a row where the median over the sensors of the error_value, in MAD
|
||||||
above each one's median, reaches K_DIFFUSE: Poor visibility "reduced", unless within heat shimmer or another Poor
|
above each one's median, reaches K_DIFFUSE: Poor visibility "reduced", unless within heat shimmer or another Poor
|
||||||
visibility.
|
visibility.
|
||||||
5. Target obscured: a target rejected above K_TARGET MAD at least TARGET_MIN times, less than TARGET_GAP apart, mostly
|
|
||||||
outside the episodes above (leaves, snow, glare on one target).
|
|
||||||
Heat shimmer: end of file.
|
Heat shimmer: end of file.
|
||||||
"""
|
"""
|
||||||
import statistics
|
import statistics
|
||||||
@@ -29,12 +27,8 @@ BRIEF_MIN = 3 # trains of E-005: 5 to 17 sensors
|
|||||||
SALIENCE = 3 # a train stands out (E-005: 5 to 17 against 0 to 2); the cobweb of E-002 varies from 2 to 9
|
SALIENCE = 3 # a train stands out (E-005: 5 to 17 against 0 to 2); the cobweb of E-002 varies from 2 to 9
|
||||||
HALF = 0.5 # "nothing is seen": NORDEND 09.10 23:00 (68 % rejected) against the rain of E-005 (24 to 33 %)
|
HALF = 0.5 # "nothing is seen": NORDEND 09.10 23:00 (68 % rejected) against the rain of E-005 (24 to 33 %)
|
||||||
K_DIFFUSE = 2.5 # wf-improve Visibility, mod. 1, S2 (JUNGFRAU, FLORIDA, NORDEND: the whole scene less clear)
|
K_DIFFUSE = 2.5 # wf-improve Visibility, mod. 1, S2 (JUNGFRAU, FLORIDA, NORDEND: the whole scene less clear)
|
||||||
K_TARGET = 5 # leaves of E-005: 6 to 25 MAD, rejected
|
|
||||||
TARGET_MIN = 3
|
|
||||||
TARGET_GAP = timedelta(hours=6) # leaves of E-005: 7 rejections in 12 h, up to 5 h apart
|
|
||||||
|
|
||||||
BRIEF = "Something passed in front of {} for a single measurement. Ignore this point on the curves."
|
BRIEF = "Something passed in front of {} for a single measurement. Ignore this point on the curves."
|
||||||
OBSCURED = "{} was hidden several times while the targets around it stayed clear. Ignore its curve in this period."
|
|
||||||
|
|
||||||
|
|
||||||
def _levels(measurements, instants):
|
def _levels(measurements, instants):
|
||||||
@@ -61,7 +55,7 @@ def detect(measurements):
|
|||||||
refs = {s for s, v in measurements.items() if is_reference(v)}
|
refs = {s for s, v in measurements.items() if is_reference(v)}
|
||||||
instants = sorted({m["t"] for v in measurements.values() for m in v})
|
instants = sorted({m["t"] for v in measurements.values() for m in v})
|
||||||
z = {} # t -> {sensor: error_value in MAD above the sensor's median}
|
z = {} # t -> {sensor: error_value in MAD above the sensor's median}
|
||||||
high, strong, rejected, repeated = {}, {}, {}, {} # t -> {sensors}; repeated: target -> [t]
|
high, strong, rejected = {}, {}, {} # t -> {sensors}
|
||||||
for s, v in measurements.items():
|
for s, v in measurements.items():
|
||||||
e = [m["error_value"] for m in v if m["error_value"] is not None]
|
e = [m["error_value"] for m in v if m["error_value"] is not None]
|
||||||
if len(e) < 10:
|
if len(e) < 10:
|
||||||
@@ -78,8 +72,6 @@ def detect(measurements):
|
|||||||
rejected.setdefault(t, set()).add(s)
|
rejected.setdefault(t, set()).add(s)
|
||||||
if x > FACTOR * med:
|
if x > FACTOR * med:
|
||||||
strong.setdefault(t, set()).add(s)
|
strong.setdefault(t, set()).add(s)
|
||||||
if s not in refs and x > med + K_TARGET * mad:
|
|
||||||
repeated.setdefault(s, []).append(t)
|
|
||||||
n = lambda t: len(high.get(t, ())) # noqa: E731
|
n = lambda t: len(high.get(t, ())) # noqa: E731
|
||||||
out, briefs = [], set()
|
out, briefs = [], set()
|
||||||
|
|
||||||
@@ -119,12 +111,6 @@ def detect(measurements):
|
|||||||
e = _poor(r[0], r[-1], {s for t in r for s, x in z[t].items() if x >= K_DIFFUSE}, "reduced", refs)
|
e = _poor(r[0], r[-1], {s for t in r for s, x in z[t].items() if x >= K_DIFFUSE}, "reduced", refs)
|
||||||
if len(r) >= RUN_MIN and not any(h["start"] <= e["start"] and e["end"] <= h["end"] for h in hosts):
|
if len(r) >= RUN_MIN and not any(h["start"] <= e["start"] and e["end"] <= h["end"] for h in hosts):
|
||||||
out.append(e)
|
out.append(e)
|
||||||
|
|
||||||
seen = lambda t: t in briefs or any(a <= t <= b for a, b, _ in zones) # noqa: E731
|
|
||||||
for s, ts in repeated.items(): # 5. Target obscured
|
|
||||||
for r in runs(ts, TARGET_GAP):
|
|
||||||
if len(r) >= TARGET_MIN and 2 * sum(map(seen, r)) < len(r):
|
|
||||||
out.append(episode(r[0], r[-1], "Obstruction", "Target obscured", OBSCURED.format(s), [s], True))
|
|
||||||
return out + shimmer
|
return out + shimmer
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user