From 9f70130c46524c97f4d69b859133fb397394b806 Mon Sep 17 00:00:00 2001 From: Jon McCullough Date: Mon, 4 Dec 2023 14:23:16 +0000 Subject: [PATCH] Modify test value of N to remove warning on number of samples not being 2^n --- tests/test_analysis_qmc_analysis.py | 2 +- tests/test_sampling_qmc.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_analysis_qmc_analysis.py b/tests/test_analysis_qmc_analysis.py index b32e78b4e..01dc81133 100644 --- a/tests/test_analysis_qmc_analysis.py +++ b/tests/test_analysis_qmc_analysis.py @@ -13,7 +13,7 @@ def test_analyse(): "a": cp.Uniform(0.0, 1.0), "b": cp.Uniform(0.0, 1.0) } - sampler = QMCSampler(vary, 100) + sampler = QMCSampler(vary, 128) samples = {('run_id', 0): [], ('a', 0): [], ('b', 0): [], ('a+b', 0): []} for i, sample in enumerate(sampler): samples[('run_id', 0)].append(i) diff --git a/tests/test_sampling_qmc.py b/tests/test_sampling_qmc.py index d21cf4f34..6b55b1f0e 100644 --- a/tests/test_sampling_qmc.py +++ b/tests/test_sampling_qmc.py @@ -5,21 +5,21 @@ def test_init(): with pytest.raises(RuntimeError): - QMCSampler({}, 100) + QMCSampler({}, 128) with pytest.raises(RuntimeError): - QMCSampler([], 100) + QMCSampler([], 128) def test_is_finite(): vary = {'a': cp.Uniform(-5, 3), 'b': cp.Uniform(2, 10)} - sampler = QMCSampler(vary, 100) + sampler = QMCSampler(vary, 128) assert (sampler.is_finite()) def test_sampling(): vary = {'a': cp.Uniform(-5, 0), 'b': cp.Uniform(2, 10)} - sampler = QMCSampler(vary, 100) - assert (sampler.n_samples == 400) + sampler = QMCSampler(vary, 128) + assert (sampler.n_samples == 512) for _ in range(sampler.n_samples): sample = next(sampler) assert (sample['a'] >= -5 and sample['a'] <= 0) @@ -30,8 +30,8 @@ def test_sampling(): def test_resume(): vary = {'a': cp.Uniform(-5, 0), 'b': cp.Uniform(2, 10)} - sampler = QMCSampler(vary, 100, 390) - for _ in range(10): + sampler = QMCSampler(vary, 128, 500) + for _ in range(12): sample = next(sampler) with pytest.raises(StopIteration): next(sampler)