Rework radar system

This commit is contained in:
Ayzen
2026-10-06 12:32:26 +03:00
parent 552cdc688a
commit 5bb86b7165
299 changed files with 13537 additions and 27763 deletions
+35
View File
@@ -0,0 +1,35 @@
"""Acquisition identity shared unchanged by every pipeline stage."""
from __future__ import annotations
from collections.abc import Iterable, Mapping, Sequence
from typing import Protocol, TypeVar
class CollectionIdentity(Protocol):
@property
def collection_id(self) -> int: ...
@property
def capture_start_ns(self) -> int: ...
TCollection = TypeVar("TCollection", bound=CollectionIdentity)
def collection_key(collection: CollectionIdentity) -> tuple[int, int]:
return collection.collection_id, collection.capture_start_ns
def index_collections(collections: Iterable[TCollection]) -> dict[tuple[int, int], TCollection]:
return {collection_key(collection): collection for collection in collections}
def history_collection_removed(
collection: CollectionIdentity, clear_before_ns: int, removed: Sequence[Mapping[str, int]],
) -> bool:
"""Apply a capture-time cutoff and exact acquisition deletions to late results."""
return (bool(clear_before_ns) and collection.capture_start_ns <= clear_before_ns) or any(
collection_key(collection) == (target["collection_id"], target["capture_start_ns"])
for target in removed
)