aboutsummaryrefslogtreecommitdiff
path: root/Examples/Modules/resampling/analysis_leveling_thinning.py
diff options
context:
space:
mode:
authorGravatar NeilZaim <49716072+NeilZaim@users.noreply.github.com> 2021-03-02 02:06:35 +0100
committerGravatar GitHub <noreply@github.com> 2021-03-01 17:06:35 -0800
commit0531485b04eac9cbe82e7ee79f78fb268ba253f8 (patch)
treec89265015214722b889ba9cffcd3c1260673e284 /Examples/Modules/resampling/analysis_leveling_thinning.py
parentfcf78519af9d02991d1b2d99179466ef2bd5383e (diff)
downloadWarpX-0531485b04eac9cbe82e7ee79f78fb268ba253f8.tar.gz
WarpX-0531485b04eac9cbe82e7ee79f78fb268ba253f8.tar.zst
WarpX-0531485b04eac9cbe82e7ee79f78fb268ba253f8.zip
Add CI coverage for the plotfile particle filters (#1645)
* Add CI coverage for the plotfile particle filter function * Minor fix in analysis script * Test all 3 particle filters in 2D/3D/RZ * Dirty trick to deal with same ID from multiple MPI ranks + enforce 100 characters per line rule * Fix CI when running on a single MPI rank * Add new module to avoid duplicate code
Diffstat (limited to 'Examples/Modules/resampling/analysis_leveling_thinning.py')
-rwxr-xr-xExamples/Modules/resampling/analysis_leveling_thinning.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Examples/Modules/resampling/analysis_leveling_thinning.py b/Examples/Modules/resampling/analysis_leveling_thinning.py
index dc96b0138..a9e8f380d 100755
--- a/Examples/Modules/resampling/analysis_leveling_thinning.py
+++ b/Examples/Modules/resampling/analysis_leveling_thinning.py
@@ -55,7 +55,7 @@ numparts_final = w.shape[0]
expected_numparts_final = numparts_init/t_r**2
error = np.abs(numparts_final - expected_numparts_final)
std_numparts_final = np.sqrt(numparts_init/t_r**2*(1.-1./t_r**2))
-# 5 sigma test that has an intrisic probability to fail of 1 over ~2 millions
+# 5 sigma test that has an intrinsic probability to fail of 1 over ~2 millions
print("difference between expected and actual final number of particles (1st species): " + str(error))
print("tolerance: " + str(5*std_numparts_final))
assert(error<5*std_numparts_final)
@@ -89,7 +89,7 @@ expected_mean_initial_weight = 2.*np.sqrt(2.)
error = np.abs(mean_initial_weight - expected_mean_initial_weight)
expected_std_initial_weight = 1./np.sqrt(2.)
std_mean_initial_weight = expected_std_initial_weight/np.sqrt(numparts_init)
-# 5 sigma test that has an intrisic probability to fail of 1 over ~2 millions
+# 5 sigma test that has an intrinsic probability to fail of 1 over ~2 millions
print("difference between expected and actual mean initial weight (2nd species): " + str(error))
print("tolerance: " + str(5*std_mean_initial_weight))
assert(error<5*std_mean_initial_weight)
@@ -99,7 +99,7 @@ variance_initial_weight = np.var(w0)
expected_variance_initial_weight = 0.5
error = np.abs(variance_initial_weight - expected_variance_initial_weight)
std_variance_initial_weight = expected_variance_initial_weight*np.sqrt(2./numparts_init)
-# 5 sigma test that has an intrisic probability to fail of 1 over ~2 millions
+# 5 sigma test that has an intrinsic probability to fail of 1 over ~2 millions
print("difference between expected and actual variance of initial weight (2nd species): " + str(error))
print("tolerance: " + str(5*std_variance_initial_weight))
@@ -122,7 +122,7 @@ std_numparts_leveled = np.sqrt(expected_numparts_leveled - numparts_init/np.sqrt
(2.*expected_mean_initial_weight**2+1.)*(1.-erf(expected_mean_initial_weight* \
(t_r-1.)))-0.5*np.exp(-(expected_mean_initial_weight*(t_r-1.))**2* \
(expected_mean_initial_weight*(t_r+1.)))))
-# 5 sigma test that has an intrisic probability to fail of 1 over ~2 millions
+# 5 sigma test that has an intrinsic probability to fail of 1 over ~2 millions
print("difference between expected and actual number of leveled particles (2nd species): " + str(error))
print("tolerance: " + str(5*std_numparts_leveled))