From 1087dd1225ee07a80f2abb20ad325604fc8516aa Mon Sep 17 00:00:00 2001 From: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> Date: Thu, 20 Jan 2022 12:34:14 -0800 Subject: Fix unstable Python_particle_attr_access CI tests (#2766) * explicitly set the numpy random seed in Python_particle_attr_access tests * also shrink boundaries in which particles are injected for good measure * also explicitly set the numpy random seed in Python_restart_runtime_components CI test --- Examples/Tests/ParticleDataPython/PICMI_inputs_2d.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Examples/Tests/ParticleDataPython/PICMI_inputs_2d.py') diff --git a/Examples/Tests/ParticleDataPython/PICMI_inputs_2d.py b/Examples/Tests/ParticleDataPython/PICMI_inputs_2d.py index ff3c0704b..40d0b49ad 100755 --- a/Examples/Tests/ParticleDataPython/PICMI_inputs_2d.py +++ b/Examples/Tests/ParticleDataPython/PICMI_inputs_2d.py @@ -36,7 +36,6 @@ xmax = 0.03 ymin = 0 ymax = 0.03 - ########################## # numerics components ########################## @@ -105,6 +104,9 @@ sim.initialize_warpx() # python particle data access ########################## +# set numpy random seed so that the particle properties generated +# below will be reproducible from run to run +np.random.seed(30025025) sim.extension.add_real_comp('electrons', 'newPid') @@ -113,9 +115,9 @@ my_id = sim.extension.getMyProc() def add_particles(): nps = 10 * (my_id + 1) - x = np.random.rand(nps) * 0.03 + x = np.linspace(0.005, 0.025, nps) y = np.zeros(nps) - z = np.random.random(nps) * 0.03 + z = np.linspace(0.005, 0.025, nps) ux = np.random.normal(loc=0, scale=1e3, size=nps) uy = np.random.normal(loc=0, scale=1e3, size=nps) uz = np.random.normal(loc=0, scale=1e3, size=nps) -- cgit v1.2.3