Skip to content

Commit 1554bbb

Browse files
authored
Merge pull request #834 from ComputationalCryoEM/patch_flaky_utest_again
Update randomized unit test that was flaky after running large trial
2 parents de78829 + ac349d8 commit 1554bbb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_noise.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from aspire.noise import CustomNoiseAdder, WhiteNoiseAdder, WhiteNoiseEstimator
99
from aspire.operators import FunctionFilter, ScalarFilter
1010
from aspire.source.simulation import Simulation
11-
from aspire.utils import utest_tolerance
1211
from aspire.volume import AsymmetricVolume
1312

1413
DATA_DIR = os.path.join(os.path.dirname(__file__), "saved_test_data")
@@ -62,7 +61,12 @@ def test_white_noise_estimator_clean_corners(sim_fixture):
6261
noise_variance = noise_estimator.estimate()
6362
# Using a compactly supported volume should yield
6463
# virtually no noise in the image corners.
65-
assert np.isclose(noise_variance, 0, atol=utest_tolerance(sim_fixture.dtype))
64+
assert np.isclose(noise_variance, 0, atol=1e-6)
65+
# 1e-6 was chosen by running the unit test suite 10k (x4 fixture expansion) times.
66+
# min=7.544584748608862e-12 max=1.6798412007391812e-07
67+
# mean=1.0901885456753326e-09 var=5.27460957578949e-18
68+
# To reduce the randomness would require a increasing simulation `n`
69+
# and/or increasing resolution. Both would increase test time.
6670

6771

6872
def test_adder_reprs(adder):

0 commit comments

Comments
 (0)