Files
aimsight-models/test_decode.py
T
maximeandClaude Opus 5.5 4836929bc7 Steps 5 and 6: pre-trained M2 passes the criterion for Obstruction, not for Visibility; episodes and sensors (decode.py)
m2.py: one thread per process, --test to share the stations left out between processes, --out on the time split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:59:49 +01:00

14 lines
630 B
Python

"""Checks of decode.py: python test_decode.py."""
import numpy as np
import decode
assert decode.episodes(np.array([0, 1, 1, 0, 1, 0, 0, 1])) == [[1, 4], [7, 7]] # one instant bridged, two not
assert decode.named("PB1_2 alone, unlike PB1 and PB2_2.", ["PB1", "PB1_2", "PB2", "PR12"]) == [0, 1]
instants = np.array(["t0", "t1", "t2", "t3", "t4", "t5"])
yhat = np.zeros((6, 1), np.uint8)
yhat[1:3, 0] = 1
c = decode.score_station([{"start": "t2", "end": "t3"}, {"start": "t5", "end": "t5"}], instants, yhat, 0)
assert c[:4] == [2, 1, 1, 1] and c[4] == [1 / 3], c # label t2..t3 and episode t1..t2 share t2 of t1..t3
print("ok")