Skip to content

Commit

Permalink
More checksums updates
Browse files Browse the repository at this point in the history
  • Loading branch information
EZoni committed Oct 1, 2024
1 parent 512b968 commit 40dc47f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
yt.funcs.mylog.setLevel(50)

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

# this will be the name of the plot file
fn = sys.argv[1]
Expand Down Expand Up @@ -59,5 +59,8 @@
# Test uniformity up to 0.5% relative variation
assert rho_slice.std() < 0.005 * abs(rho_slice.mean())

test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, fn)
# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
13 changes: 8 additions & 5 deletions Examples/Physics_applications/spacecraft_charging/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@

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

# Open plotfile specified in command line
filename = sys.argv[1]
test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename, output_format="openpmd")

ts = OpenPMDTimeSeries(filename)
dt = 1.27e-8
t = []
Expand Down Expand Up @@ -78,3 +74,10 @@ 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",
)
9 changes: 6 additions & 3 deletions Examples/Tests/accelerator_lattice/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

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

filename = sys.argv[1]
ds = yt.load(filename)
Expand Down Expand Up @@ -131,5 +131,8 @@ def applylens(x0, vx0, vz0, gamma, lens_length, lens_strength):
"error in x particle velocity"
)

test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename)
# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
9 changes: 6 additions & 3 deletions Examples/Tests/boosted_diags/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
yt.funcs.mylog.setLevel(0)

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

filename = sys.argv[1]

Expand Down Expand Up @@ -56,5 +56,8 @@
(w,) = ts.get_particle(["w"], species="beam", iteration=3)
assert (400 < len(w)) & (len(w) < 600)

test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename)
# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
9 changes: 6 additions & 3 deletions Examples/Tests/boundaries/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

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

# The min and max size of the box along the three axis.
dmin = -1.0
Expand Down Expand Up @@ -111,5 +111,8 @@ def do_periodic(x):
np.abs((zz - zza) / zz) < 1.0e-15
), "Periodic particle position not correct"

test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename)
# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
10 changes: 6 additions & 4 deletions Examples/Tests/btd_rz/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from scipy.optimize import curve_fit

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


def gaussian_laser(z, a0, z0_phase, z0_prop, ctau, lambda0):
Expand Down Expand Up @@ -58,6 +58,8 @@ def fit_function(z, z0_phase):
## Check that the a0 agrees within 5% of the predicted value
assert np.allclose(Ex, Ex_fit, atol=0.18 * Ex.max())

# Checksum regression analysis
test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, plotfile)
# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)

0 comments on commit 40dc47f

Please sign in to comment.