diff options
author | 2020-05-01 08:39:45 -0700 | |
---|---|---|
committer | 2020-05-01 08:39:45 -0700 | |
commit | f8941d7e4d1a2e8388360a22e1cbf1ef7bcf2cb3 (patch) | |
tree | 572927655309cec48803999ba640918413a77292 /Examples/Modules/qed/quantum_synchrotron/analysis_2d_tau_init.py | |
parent | 639cf17fda1d048602c675c5b1808893bd29d73e (diff) | |
download | WarpX-f8941d7e4d1a2e8388360a22e1cbf1ef7bcf2cb3.tar.gz WarpX-f8941d7e4d1a2e8388360a22e1cbf1ef7bcf2cb3.tar.zst WarpX-f8941d7e4d1a2e8388360a22e1cbf1ef7bcf2cb3.zip |
Most fun PR ever: print error and tolerance before ASSERT in CI (#967)
* always print error and tolerance before ASSERT in CI tests
* eol
* fix typos
* more typo
* typo
Diffstat (limited to 'Examples/Modules/qed/quantum_synchrotron/analysis_2d_tau_init.py')
-rwxr-xr-x | Examples/Modules/qed/quantum_synchrotron/analysis_2d_tau_init.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/Examples/Modules/qed/quantum_synchrotron/analysis_2d_tau_init.py b/Examples/Modules/qed/quantum_synchrotron/analysis_2d_tau_init.py index bdbcf78f3..9ad2b754c 100755 --- a/Examples/Modules/qed/quantum_synchrotron/analysis_2d_tau_init.py +++ b/Examples/Modules/qed/quantum_synchrotron/analysis_2d_tau_init.py @@ -16,7 +16,8 @@ import sys # do actually have an exponentially distributed optical depth # Tolerance -tol = 1e-2 +tolerance_rel = 1e-2 +print("tolerance_rel: " + str(tolerance_rel)) def check(): filename = sys.argv[1] @@ -30,10 +31,21 @@ def check(): loc_pos, scale_pos = st.expon.fit(res_pos_tau) # loc should be very close to 0, scale should be very close to 1 - assert(np.abs(loc_ele - 0) < tol) - assert(np.abs(loc_pos - 0) < tol) - assert(np.abs(scale_ele - 1) < tol) - assert(np.abs(scale_pos - 1) < tol) + error_rel = np.abs(loc_ele - 0) + print("error_rel loc_ele: " + str(error_rel)) + assert( error_rel < tolerance_rel ) + + error_rel = np.abs(loc_pos - 0) + print("error_rel loc_pos: " + str(error_rel)) + assert( error_rel < tolerance_rel ) + + error_rel = np.abs(scale_ele - 1) + print("error_rel scale_ele: " + str(error_rel)) + assert( error_rel < tolerance_rel ) + + error_rel = np.abs(scale_pos - 1) + print("error_rel scale_pos: " + str(error_rel)) + assert( error_rel < tolerance_rel ) def main(): check() |