This tutorial was prepared with AI assistance.
A flat list of timestamps can hide a missing shot. Add a tray ID and an event to make the handoff checkable.
Run the complete and missing examples. The first returns PASS, the second CHECK. The script checks only events and source order. A reviewer still needs to match the picture to the tray.
python check-tray-marks.py tray-complete.csv
python check-tray-marks.py tray-missing.csv
check-tray-marks.py
import csv
import sys
with open(sys.argv[1], encoding='utf-8', newline='') as source:
rows = list(csv.DictReader(source))
expected = ['in', 'out', 'cross_section']
trays = sorted({row['tray'] for row in rows})
passed = bool(trays)
for tray in trays:
sequence = [row for row in rows if row['tray'] == tray]
events = [row['event'] for row in sequence]
seconds = [int(row['source_seconds']) for row in sequence]
complete = events == expected and all(a < b for a, b in zip(seconds, seconds[1:]))
print(f'Tray {tray}: {"PASS" if complete else "CHECK"}')
passed = passed and complete
raise SystemExit(0 if passed else 1)
tray-complete.csv
tray,event,source_seconds
2,in,860
2,out,1390
2,cross_section,2045
tray-missing.csv
tray,event,source_seconds
2,in,860
2,out,1390
Top comments (0)