From 36de44565baca95f6555d9b1ad00fdb63a059303 Mon Sep 17 00:00:00 2001 From: yoshikisd Date: Mon, 7 Jul 2025 15:16:12 +0000 Subject: [PATCH] Set fixed RNG seed for reconstruction pytests --- tests/models/test_fancy_ptycho.py | 2 ++ tests/models/test_simple_ptycho.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tests/models/test_fancy_ptycho.py b/tests/models/test_fancy_ptycho.py index 7ef429f..3f78a73 100644 --- a/tests/models/test_fancy_ptycho.py +++ b/tests/models/test_fancy_ptycho.py @@ -5,6 +5,8 @@ import torch as t import cdtools from matplotlib import pyplot as plt +# Force all reconstructions to use the same RNG seed +t.manual_seed(0) def test_center_probe(lab_ptycho_cxi): dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(lab_ptycho_cxi) diff --git a/tests/models/test_simple_ptycho.py b/tests/models/test_simple_ptycho.py index f74dd0d..f77c589 100644 --- a/tests/models/test_simple_ptycho.py +++ b/tests/models/test_simple_ptycho.py @@ -1,6 +1,10 @@ import pytest import cdtools from matplotlib import pyplot as plt +import torch as t + +# Force all reconstructions to use the same RNG seed +t.manual_seed(0) @pytest.mark.slow def test_simple_ptycho(lab_ptycho_cxi, reconstruction_device, show_plot):