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/RigidInjection/analysis_rigid_injection_LabFrame.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/RigidInjection/analysis_rigid_injection_LabFrame.py')
-rwxr-xr-x | Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py index 6977f6ff6..380212adb 100755 --- a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py +++ b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py @@ -68,9 +68,14 @@ if ( error_no_rigid < 0.05): # Theoretical beam width after propagation if rigid ON wth = np.sqrt( w0**2 + (z-z0)**2*theta0**2 ) -error = np.abs((w-wth)/wth) +error_rel = np.abs((w-wth)/wth) +tolerance_rel = 0.05 + # Print error and assert small error print("Beam position: " + str(z)) print("Beam width : " + str(w)) -print("error: " + str(error)) -assert( error < 0.05 ) + +print("error_rel : " + str(error_rel)) +print("tolerance_rel: " + str(tolerance_rel)) + +assert( error_rel < tolerance_rel ) |