From 178e9a4e4e63605d74ab859da5a95c1cd78eacc0 Mon Sep 17 00:00:00 2001 From: allevitan Date: Thu, 19 Mar 2026 17:40:07 +0100 Subject: [PATCH] Add loss function coverage to slow reconstruction tests Use poisson_nll in test_near_field_ptycho and intensity_mse in test_Adam_gold_balls to exercise these loss paths end-to-end. Thresholds left as-is pending re-running on a GPU machine. Co-Authored-By: Claude Sonnet 4.6 --- tests/models/test_fancy_ptycho.py | 4 ++++ tests/test_reconstructors.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/models/test_fancy_ptycho.py b/tests/models/test_fancy_ptycho.py index 19953d7..7eb81dd 100644 --- a/tests/models/test_fancy_ptycho.py +++ b/tests/models/test_fancy_ptycho.py @@ -138,7 +138,11 @@ def test_near_field_ptycho(near_field_ptycho_cxi, reconstruction_device, show_pl n_modes=1, near_field=True, propagation_distance=3.65e-3, # 3.65 downstream from focus +<<<<<<< HEAD panel_plot_mode=False, # test without panel plot mode +======= + loss='poisson_nll', +>>>>>>> f0f1577 (Add loss function coverage to slow reconstruction tests) ) print('Running reconstruction on provided reconstruction_device,', diff --git a/tests/test_reconstructors.py b/tests/test_reconstructors.py index fc394d6..b1ae6a5 100644 --- a/tests/test_reconstructors.py +++ b/tests/test_reconstructors.py @@ -38,7 +38,11 @@ def test_Adam_gold_balls(gold_ball_cxi, reconstruction_device, show_plot): propagation_distance=2e-6, units='um', probe_fourier_crop=pad, +<<<<<<< HEAD panel_plot_mode=False, # At least one check without panel plot mode +======= + loss='intensity_mse',#NOTE: Only to check that it works. +>>>>>>> f0f1577 (Add loss function coverage to slow reconstruction tests) ) model.translation_offsets.data += 0.7 * \