Datasets:
File size: 1,306 Bytes
5afd2f7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """Deterministic audit indices; decoding and frame-clock validation remain complete."""
from ..artifacts import ContractError
def audit_indices(frame_count,policy):
if type(frame_count) is not int or frame_count<=0:
raise ContractError('Positive recording frame count required')
if policy['mode']=='full':return tuple(range(frame_count))
if policy['mode']!='sampled':raise ContractError('Unknown RGB audit mode')
return tuple(sorted(set(range(0,frame_count,policy['every_n_frames']))|{0,frame_count-1}))
def ground_indices(keys,policy,plan_times):
"""Local frame cadence plus exact recorded plan ticks; never choose nearest.
Missing plan samples are retained as explicit non-comparability metadata.
"""
selected={key.frame_index for key in keys if key.frame_index%policy['every_n_frames']==0}
by_time={key.world_s:key.frame_index for key in keys};missing=[];extra=[]
for t in plan_times:
if float(t) not in by_time:missing.append(float(t));continue
index=by_time[float(t)]
if index not in selected:extra.append(index)
selected.add(index)
return tuple(sorted(selected)),dict(extra_plan_frame_indices=sorted(set(extra)),missing_plan_times_s=missing,
rule=policy['rule'],every_n_frames=policy['every_n_frames'])
|