Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EZoni committed Nov 12, 2024
1 parent 6cd93a0 commit 08d8d0a
Show file tree
Hide file tree
Showing 28 changed files with 72 additions and 148 deletions.
32 changes: 16 additions & 16 deletions Examples/Physics_applications/plasma_acceleration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ add_warpx_test(
1 # dims
2 # nprocs
inputs_test_1d_plasma_acceleration_picmi.py # inputs
analysis_default_regression.py # analysis
diags/diag1001000 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1001000 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -16,8 +16,8 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_plasma_acceleration_boosted # inputs
analysis_default_regression.py # analysis
diags/diag1000020 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000020 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -26,8 +26,8 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_plasma_acceleration_mr # inputs
analysis_default_regression.py # analysis
diags/diag1000400 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000400 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -36,8 +36,8 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_plasma_acceleration_mr_momentum_conserving # inputs
analysis_default_regression.py # analysis
diags/diag1000400 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000400 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -46,8 +46,8 @@ add_warpx_test(
3 # dims
2 # nprocs
inputs_test_3d_plasma_acceleration_boosted # inputs
analysis_default_regression.py # analysis
diags/diag1000005 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000005 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -56,8 +56,8 @@ add_warpx_test(
3 # dims
2 # nprocs
inputs_test_3d_plasma_acceleration_boosted_hybrid # inputs
analysis_default_regression.py # analysis
diags/diag1000025 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000025 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -66,8 +66,8 @@ add_warpx_test(
3 # dims
2 # nprocs
inputs_test_3d_plasma_acceleration_mr_picmi.py # inputs
analysis_default_regression.py # analysis
diags/diag1000002 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000002 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -76,7 +76,7 @@ add_warpx_test(
3 # dims
2 # nprocs
inputs_test_3d_plasma_acceleration_picmi.py # inputs
analysis_default_regression.py # analysis
diags/diag1000010 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000010 --plotfile" # checksum
OFF # dependency
)
4 changes: 2 additions & 2 deletions Examples/Physics_applications/plasma_mirror/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_plasma_mirror # inputs
analysis_default_regression.py # analysis
diags/diag1000020 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000020 --plotfile" # checksum
OFF # dependency
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ add_warpx_test(
RZ # dims
2 # nprocs
inputs_test_rz_spacecraft_charging_picmi.py # inputs
analysis.py # analysis
diags/diag1/ # output
"analysis.py diags/diag1/" # analysis
"analysis_default_regression.py --path diags/diag1/ --openpmd" # checksum
OFF # dependency
)
endif()
10 changes: 0 additions & 10 deletions Examples/Physics_applications/spacecraft_charging/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
by the following exponential function: phi(t)=v0(1-exp(-t/tau))
"""

import os
import sys

import matplotlib.pyplot as plt
Expand All @@ -22,8 +21,6 @@
from scipy.optimize import curve_fit

yt.funcs.mylog.setLevel(0)
sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

filename = sys.argv[1]
ts = OpenPMDTimeSeries(filename)
Expand Down Expand Up @@ -74,10 +71,3 @@ def func(x, v0, tau):
assert (diff_v0 < tolerance_v0) and (
diff_tau < tolerance_tau
), "Test spacecraft_charging did not pass"

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
output_format="openpmd",
)
12 changes: 6 additions & 6 deletions Examples/Physics_applications/uniform_plasma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_uniform_plasma # inputs
analysis_default_regression.py # analysis
diags/diag1000010 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000010 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -16,8 +16,8 @@ add_warpx_test(
3 # dims
2 # nprocs
inputs_test_3d_uniform_plasma # inputs
analysis_default_regression.py # analysis
diags/diag1000010 # output
OFF # analysis
"analysis_default_regression.py --path diags/diag1000010 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -26,7 +26,7 @@ add_warpx_test(
3 # dims
2 # nprocs
inputs_test_3d_uniform_plasma_restart # inputs
analysis_default_restart.py # analysis
diags/diag1000010 # output
"analysis_default_restart.py diags/diag1000010" # analysis
"analysis_default_regression.py --path diags/diag1000010 --plotfile --rtol 1e-12" # checksum
test_3d_uniform_plasma # dependency
)
8 changes: 4 additions & 4 deletions Examples/Tests/rigid_injection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_rigid_injection_btd # inputs
analysis_rigid_injection_btd.py # analysis
diags/diag1000001 # output
"analysis_rigid_injection_btd.py diags/diag1000001" # analysis
"analysis_default_regression.py --path diags/diag1000001 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -16,7 +16,7 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_rigid_injection_lab # inputs
analysis_rigid_injection_lab.py # analysis
diags/diag1000289 # output
"analysis_rigid_injection_lab.py diags/diag1000289" # analysis
"analysis_default_regression.py --path diags/diag1000289 --plotfile" # checksum
OFF # dependency
)
10 changes: 0 additions & 10 deletions Examples/Tests/rigid_injection/analysis_rigid_injection_btd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
frame, i.e., on the back-transformed diagnostics.
"""

import os
import sys

import numpy as np
Expand All @@ -29,9 +28,6 @@

yt.funcs.mylog.setLevel(0)

sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

filename = sys.argv[1]

# Tolerances to check consistency between plotfile BTD and openPMD BTD
Expand Down Expand Up @@ -80,9 +76,3 @@
print(f"error = {err}")
print(f"tolerance = {tol}")
assert err < tol

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@
with the gaussian_beam injection style.
"""

import os
import sys

import numpy as np
import yt

yt.funcs.mylog.setLevel(0)
sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

filename = sys.argv[1]

Expand Down Expand Up @@ -101,9 +98,3 @@ def remove_rigid_lines(plotfile, nlines_if_rigid):
center = ad_start["beam", "particle_center"]
assert np.array_equal(z, orig_z)
assert np.array_equal(1 * (np.abs(x) < 5.0e-7), center)

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
8 changes: 4 additions & 4 deletions Examples/Tests/scraping/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ if(WarpX_EB)
RZ # dims
2 # nprocs
inputs_test_rz_scraping # inputs
analysis_rz.py # analysis
diags/diag1000037 # output
"analysis_rz.py diags/diag1000037" # analysis
"analysis_default_regression.py --path diags/diag1000037 --plotfile --skip-particles" # checksum
OFF # dependency
)
endif()
Expand All @@ -19,8 +19,8 @@ if(WarpX_EB)
RZ # dims
2 # nprocs
inputs_test_rz_scraping_filter # inputs
analysis_rz_filter.py # analysis
diags/diag1000037 # output
"analysis_rz_filter.py diags/diag1000037" # analysis
OFF # checksum
OFF # dependency
)
endif()
1 change: 1 addition & 0 deletions Examples/Tests/scraping/analysis_default_regression.py
11 changes: 0 additions & 11 deletions Examples/Tests/scraping/analysis_rz.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@
# tolerance: 0
# Possible running time: < 1 s

import os
import sys

import numpy as np
import yt
from openpmd_viewer import OpenPMDTimeSeries

sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

tolerance = 0

fn = sys.argv[1]
Expand Down Expand Up @@ -82,10 +78,3 @@ def n_scraped_particles(iteration):
assert np.all(
np.sort(id_initial) == np.sort(id_final)
) # Sort because particles may not be in the same order

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
do_particles=False,
)
16 changes: 8 additions & 8 deletions Examples/Tests/silver_mueller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ add_warpx_test(
1 # dims
2 # nprocs
inputs_test_1d_silver_mueller # inputs
analysis.py # analysis
diags/diag1000500 # output
"analysis.py diags/diag1000500" # analysis
"analysis_default_regression.py --path diags/diag1000500 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -16,8 +16,8 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_silver_mueller_x # inputs
analysis.py # analysis
diags/diag1000500 # output
"analysis.py diags/diag1000500" # analysis
"analysis_default_regression.py --path diags/diag1000500 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -26,8 +26,8 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_silver_mueller_z # inputs
analysis.py # analysis
diags/diag1000500 # output
"analysis.py diags/diag1000500" # analysis
"analysis_default_regression.py --path diags/diag1000500 --plotfile" # checksum
OFF # dependency
)

Expand All @@ -36,7 +36,7 @@ add_warpx_test(
RZ # dims
2 # nprocs
inputs_test_rz_silver_mueller_z # inputs
analysis.py # analysis
diags/diag1000500 # output
"analysis.py diags/diag1000500" # analysis
"analysis_default_regression.py --path diags/diag1000500 --plotfile" # checksum
OFF # dependency
)
9 changes: 0 additions & 9 deletions Examples/Tests/silver_mueller/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@
test check that the reflected field at the boundary is negligible.
"""

import os
import re
import sys

import numpy as np
import yt

yt.funcs.mylog.setLevel(0)
sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

filename = sys.argv[1]

Expand Down Expand Up @@ -50,9 +47,3 @@
assert np.all(abs(Ex) < max_reflection_amplitude)
assert np.all(abs(Ey) < max_reflection_amplitude)
assert np.all(abs(Ez) < max_reflection_amplitude)

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
4 changes: 2 additions & 2 deletions Examples/Tests/single_particle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ add_warpx_test(
2 # dims
2 # nprocs
inputs_test_2d_bilinear_filter # inputs
analysis.py # analysis
diags/diag1000001 # output
"analysis.py diags/diag1000001" # analysis
"analysis_default_regression.py --path diags/diag1000001 --plotfile" # checksum
OFF # dependency
)
Loading

0 comments on commit 08d8d0a

Please sign in to comment.