5PACE3Dmodelsatellites / ORCASat /ORCASat_CAD /source /finalize_validation.py
MateuszBocko's picture
Initial | Project Setup
6237959 verified
Raw History Blame Contribute Delete
2.18 kB
#!/usr/bin/env python3
"""Reuse measured STEP checks only when their byte hashes still match, then check GLBs."""
from pathlib import Path
import csv,hashlib,json,time
import validate_release as v
def main():
start=time.time();out=Path(__file__).resolve().parent.parent;target=out/'EXPORT'
steps=json.loads((out/'step_roundtrip_measurements.json').read_text())
for row in steps:
assert row['valid'] and row['units']=='mm'
assert hashlib.sha256((out/row['path']).read_bytes()).hexdigest()==row['sha256'],row['path']
for name in ['Stowed','Deployed','Internal','Exploded']:
r=next(x for x in steps if x['path']=='ORCASat_'+name+'.step')
assert r['volume_relative_error']<1e-6
inventory=list(csv.DictReader((out/'component_manifest.csv').open()))
manifest=json.loads((target/'manifest.json').read_text());glbs=v.validate_glbs(target,manifest,inventory=inventory)
summary=json.loads((out/'build_summary.json').read_text())
report={'version':'2.1','geometry':'All defined source shapes and all distinct re-imported STEP files passed Open CASCADE shape validity checks. Cached STEP measurements were reused only after exact SHA-256 verification.','corrections':summary['correction_checks'],'targeted_fit_checks':json.loads((out/'fit_checks.json').read_text()),'STEP':steps,'GLB':glbs,'volume_method':'Adaptive face integration, relative integration epsilon 1e-8; aggregate roundtrip comparison tolerance 1e-6. Differences are recorded per main scene.','SolidWorks_application_test':'Not run here; no SolidWorks runtime is available. User confirmed previous blank view was long loading.','dimensional_scope':'Reference reconstruction; original source antenna geometry, with most other details and placements estimated. Full interference, tolerance, mass and flight-configuration validation not established.'}
(out/'validation_report.json').write_text(json.dumps(report,indent=2));(target/'validation_report.json').write_text(json.dumps(glbs,indent=2))
print('VALIDATION PASS:',len(steps),'STEP paths,',glbs['all_files_validated'],'GLBs;',round(time.time()-start,1),'s',flush=True)
if __name__=='__main__':main()