From b4d6b9b18c3b1674a671ead5dac119dcaf3fe6d8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:49:17 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_laser_utils.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/test_laser_utils.py b/tests/test_laser_utils.py index d4b4242c..3148293a 100644 --- a/tests/test_laser_utils.py +++ b/tests/test_laser_utils.py @@ -23,6 +23,7 @@ def get_gaussian_profile(): return profile + def get_spatial_chirp_profile(): # Cases with Gaussian laser wavelength = 0.8e-6 @@ -32,11 +33,12 @@ def get_spatial_chirp_profile(): tau = 30.0e-15 # s w0 = 5.0e-6 # m a = 0.0 - b = tau*w0/2 # m.s + b = tau * w0 / 2 # m.s profile = GaussianProfile(wavelength, pol, laser_energy, w0, tau, t_peak, a, b) return profile + def get_angular_dispersion_profile(): # Cases with Gaussian laser wavelength = 0.8e-6 @@ -45,11 +47,12 @@ def get_angular_dispersion_profile(): t_peak = 0.0e-15 # s tau = 30.0e-15 # s w0 = 5.0e-6 # m - a = tau/w0 # s/m + a = tau / w0 # s/m profile = GaussianProfile(wavelength, pol, laser_energy, w0, tau, t_peak, a) return profile + def get_gaussian_laser(dim): # - Cylindrical case if dim == "rt": @@ -62,6 +65,7 @@ def get_gaussian_laser(dim): npoints = (100, 100, 200) return Laser(dim, lo, hi, npoints, get_gaussian_profile()) + def get_spatial_chirp_laser(dim): # - Cylindrical case if dim == "rt": @@ -74,6 +78,7 @@ def get_spatial_chirp_laser(dim): npoints = (200, 200, 300) return Laser(dim, lo, hi, npoints, get_spatial_chirp_profile()) + def get_angular_dispersion_laser(dim): # - Cylindrical case if dim == "rt": @@ -86,6 +91,7 @@ def get_angular_dispersion_laser(dim): npoints = (100, 100, 300) return Laser(dim, lo, hi, npoints, get_angular_dispersion_profile()) + def test_laser_analysis_utils(): """Test the different laser analysis utilities in both geometries.""" for dim in ["xyt", "rt"]: @@ -111,14 +117,15 @@ def test_laser_analysis_utils(): laser_sc = get_spatial_chirp_laser(dim) # Check that laser central time agrees with the given one with angular dispersion omega, freq_sc_rms = get_frequency(laser_sc.grid, dim) - omega0 = 2*np.pi*c/laser_sc.wavelength + omega0 = 2 * np.pi * c / laser_sc.wavelength # freq_sc_expected = 0.0 # np.testing.assert_approx_equal(freq_sc_rms, freq_sc_expected, significant=3) - + laser_ad = get_angular_dispersion_laser(dim) # Check that laser central time agrees with the given one with angular dispersion t_peak_ad_rms = get_t_peak(laser_ad.grid, dim) # np.testing.assert_approx_equal(t_peak_ad_rms, laser_ad.profile.a*laser_ad.profile.w0, significant=3) + if __name__ == "__main__": test_laser_analysis_utils()