From d433e6aca65a2c8594f62ddb3ff980fc21a7a033 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:21:58 +0100 Subject: [PATCH] Update test_STC.py --- tests/test_STC.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_STC.py b/tests/test_STC.py index 9249322c..cc18f173 100644 --- a/tests/test_STC.py +++ b/tests/test_STC.py @@ -82,7 +82,8 @@ ) env_combined = laser_2d_combined.grid.get_temporal_field() env_gaussian = laser_2d_gaussian.grid.get_temporal_field() -err_real = np.average(np.array(env_combined.real) - np.array(env_gaussian.real)) +err_real = np.average((np.array(env_combined.real) - np.array(env_gaussian.real))/(np.array(env_combined.real)) +err_imag = np.average(np.array(env_combined.imag) - np.array(env_gaussian.imag)/(np.array(env_combined.imag)) Phi2_3d, phi2_3d = get_phi2(laser_3d.dim, laser_3d.grid) @@ -90,7 +91,7 @@ laser_3d.dim, laser_3d.grid, 2.0 * np.pi / 0.6e-6 ) [beta_x, beta_y] = get_beta(laser_3d.dim, laser_3d.grid, 2.0 * np.pi / 0.6e-6) -np.testing.assert_approx_equal(err_real, 1e-3, significant=1) +assert (err_real+err_imag)<1e-6 np.testing.assert_approx_equal(phi2_3d, 2.4e-24, significant=2) np.testing.assert_approx_equal(zeta_y, 2.4e-22, significant=2) np.testing.assert_approx_equal(beta_y, 3e-18, significant=2)