"""Contract smoke test: denoise the example, check PSNR improves, save the summary.""" from __future__ import annotations import json import sys from PIL import Image from core.io import APP_TMP_DIR from core.processing import simulate_full def main() -> int: tif = APP_TMP_DIR / "example.tif" if not tif.exists(): import scripts.make_example as me me.main() r = simulate_full(str(tif), engine="nlm", strength=1.0) rep = r["report"] assert r["summary"].ndim == 3 and r["summary"].shape[2] == 3 assert rep["psnr_denoised_db"] > rep["psnr_noisy_db"], "denoising did not improve PSNR" Image.fromarray(r["summary"]).save(APP_TMP_DIR / "smoke_summary.png") print("REPORT:", json.dumps(rep)) return 0 if __name__ == "__main__": sys.exit(main())