MCPcopy Create free account
hub / github.com/AggieSportsAnalytics/CourtCheck / _nearest

Function _nearest

backend/eval/annotate.py:71–78  ·  view source on GitHub ↗

Return (event_index, distance) of the nearest event within ±window, or None.

(events: list[dict], frame_idx: int, window: int)

Source from the content-addressed store, hash-verified

69
70
71def _nearest(events: list[dict], frame_idx: int, window: int) -> tuple[int, int] | None:
72 """Return (event_index, distance) of the nearest event within ±window, or None."""
73 best = None
74 for i, ev in enumerate(events):
75 d = abs(int(ev["frame"]) - frame_idx)
76 if d <= window and (best is None or d < best[1]):
77 best = (i, d)
78 return best
79
80
81def draw_hud(

Callers 2

draw_hudFunction · 0.85
annotateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected