diff --git a/Examples/Tests/embedded_boundary_removal_depth/analysis.py b/Examples/Tests/embedded_boundary_removal_depth/analysis.py index 8a12562fd52..0f970f7dfb2 100755 --- a/Examples/Tests/embedded_boundary_removal_depth/analysis.py +++ b/Examples/Tests/embedded_boundary_removal_depth/analysis.py @@ -13,7 +13,7 @@ import tqdm from openpmd_viewer import OpenPMDTimeSeries -#yt.funcs.mylog.setLevel(0) +# yt.funcs.mylog.setLevel(0) sys.path.insert(1, "../../../../warpx/Regression/Checksum/") import checksumAPI @@ -23,6 +23,7 @@ checksumAPI.evaluate_checksum(test_name, filename, output_format="openpmd") print(os.getcwd()) + def get_avg_divE(ts, start_avg_iter, end_avg_iter, ar_size): avg_divE = np.zeros((ar_size, ar_size)) for iteration in tqdm.tqdm(ts.iterations[start_avg_iter:end_avg_iter]): @@ -46,6 +47,7 @@ def plot(array, vmax=1e-9): ax.set_ylabel("z (m)") ax.set_title("Averaged divE") + ts = OpenPMDTimeSeries("./diags/diag1/") ar_size = 32 @@ -58,10 +60,12 @@ def plot(array, vmax=1e-9): tolerance = 1e-9 + def check_tolerance(array, tolerance): assert np.all( array <= tolerance ), f"Test did not pass: one or more elements exceed the tolerance of {tolerance}." print("All elements of are within the tolerance.") + check_tolerance(divE_avg, tolerance)