aboutsummaryrefslogtreecommitdiff
path: root/Examples/Modules/qed/breit_wheeler/check_2d_tau_init.py
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2019-10-10 13:58:31 +0200
committerGravatar Luca Fedeli <luca.fedeli@cea.fr> 2019-10-10 13:58:31 +0200
commit0c11a538def7e66cd6e09c09e206da5a5460f8cc (patch)
treeb2a07af0bf5d86ec3d1bc05a72afa4d88e9e2489 /Examples/Modules/qed/breit_wheeler/check_2d_tau_init.py
parent431818ad7bb72bc5396c7a870024f310de6f055c (diff)
parent96ea487480fc7ce60eb20895ca4cc20cbba5888d (diff)
downloadWarpX-0c11a538def7e66cd6e09c09e206da5a5460f8cc.tar.gz
WarpX-0c11a538def7e66cd6e09c09e206da5a5460f8cc.tar.zst
WarpX-0c11a538def7e66cd6e09c09e206da5a5460f8cc.zip
merging with qed_phys_part_with_lambda
Diffstat (limited to 'Examples/Modules/qed/breit_wheeler/check_2d_tau_init.py')
-rwxr-xr-xExamples/Modules/qed/breit_wheeler/check_2d_tau_init.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Examples/Modules/qed/breit_wheeler/check_2d_tau_init.py b/Examples/Modules/qed/breit_wheeler/check_2d_tau_init.py
new file mode 100755
index 000000000..5677990f8
--- /dev/null
+++ b/Examples/Modules/qed/breit_wheeler/check_2d_tau_init.py
@@ -0,0 +1,30 @@
+#! /usr/bin/env python3
+import yt
+import numpy as np
+import scipy.stats as st
+import sys
+
+# This script checks if photons initialized with Breit Wheeler process enabled
+# do actually have an exponentially distributed optical depth
+
+# Tolerance
+tol = 1e-2
+
+def check():
+ filename = sys.argv[1]
+ data_set = yt.load(filename)
+
+ all_data = data_set.all_data()
+ res_tau = all_data["photons", 'particle_tau']
+
+ loc, scale = st.expon.fit(res_tau)
+
+ # loc should be very close to 0, scale should be very close to 1
+ assert(np.abs(loc - 0) < tol)
+ assert(np.abs(scale - 1) < tol)
+
+def main():
+ check()
+
+if __name__ == "__main__":
+ main() \ No newline at end of file