AstroFrame/tools/check_visual_holdout.py
2026-10-03 18:29:15 -07:00

12 lines
950 B
Python

"""Provisional cloud-only screen of fixed time samples, selected before v2 results."""
import json,sys
from pathlib import Path
p=json.loads(Path(sys.argv[1] if len(sys.argv)>1 else 'projects/Sample Survey/project.json').read_text())
labels=json.loads(Path('tests/visual-cloud-holdout.json').read_text())['frames']
by_name={Path(f['Path']).name:f for f in p['Frames']};failures=[]
for label in labels:
f=by_name[label['file']]
good=(f['Automatic']=='Reject') if label['expected']=='Reject' else (f['Automatic']!='Reject')
if not good:failures.append({'file':label['file'],'expected':label['expected'],'actual':f['Automatic'],'cause':f['Cause']})
report={'samples':len(labels),'passes':len(labels)-len(failures),'failures':failures,'limitation':'Provisional cloud-only visual screen of fixed time samples. No PSF validation, unbiased accuracy estimate, or stack-quality proof.'}
print(json.dumps(report,indent=2));sys.exit(bool(failures))