aboutsummaryrefslogtreecommitdiff
path: root/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2022-01-20 12:34:14 -0800
committerGravatar GitHub <noreply@github.com> 2022-01-20 12:34:14 -0800
commit1087dd1225ee07a80f2abb20ad325604fc8516aa (patch)
tree05caf6d6cdf49126bddf12baf46f10d32635d823 /Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
parentcd3488e0b0547ac9b7fb4d68577ab1269c598fd2 (diff)
downloadWarpX-1087dd1225ee07a80f2abb20ad325604fc8516aa.tar.gz
WarpX-1087dd1225ee07a80f2abb20ad325604fc8516aa.tar.zst
WarpX-1087dd1225ee07a80f2abb20ad325604fc8516aa.zip
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
Diffstat (limited to 'Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py')
-rwxr-xr-xExamples/Tests/restart/PICMI_inputs_runtime_component_analyze.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py b/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
index 1fa8862f0..e3bcab22f 100755
--- a/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
+++ b/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
@@ -111,15 +111,18 @@ 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')
def add_particles():
nps = 10
- 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)