From acca4f62c13b75128c356ef44acb342c03b0a938 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:55:44 +0100 Subject: [PATCH] Enable initialisation and estimation of optional spatio-temperal coupling parameters to gaussian profile (#307) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxence Thevenet --- docs/source/tutorials/axiparabola.ipynb | 2 +- lasy/profiles/gaussian_profile.py | 118 ++++++++- .../profiles/longitudinal/gaussian_profile.py | 5 +- lasy/profiles/profile.py | 1 + lasy/utils/laser_utils.py | 226 ++++++++++++++++++ tests/test_STC.py | 111 +++++++++ tests/test_axiparabola.py | 2 +- tests/test_gaussian_propagator.py | 2 +- tests/test_laser_utils.py | 4 +- tests/test_t2z2t.py | 14 +- 10 files changed, 458 insertions(+), 27 deletions(-) create mode 100644 tests/test_STC.py diff --git a/docs/source/tutorials/axiparabola.ipynb b/docs/source/tutorials/axiparabola.ipynb index 0b345265..9a36cf11 100644 --- a/docs/source/tutorials/axiparabola.ipynb +++ b/docs/source/tutorials/axiparabola.ipynb @@ -40,7 +40,7 @@ "outputs": [], "source": [ "from lasy.laser import Laser\n", - "from lasy.profiles.gaussian_profile import CombinedLongitudinalTransverseProfile\n", + "from lasy.profiles.combined_profile import CombinedLongitudinalTransverseProfile\n", "from lasy.profiles.longitudinal import GaussianLongitudinalProfile\n", "from lasy.profiles.transverse import SuperGaussianTransverseProfile\n", "\n", diff --git a/lasy/profiles/gaussian_profile.py b/lasy/profiles/gaussian_profile.py index 1105d2a2..c428cd62 100644 --- a/lasy/profiles/gaussian_profile.py +++ b/lasy/profiles/gaussian_profile.py @@ -1,9 +1,9 @@ -from . import CombinedLongitudinalTransverseProfile -from .longitudinal import GaussianLongitudinalProfile -from .transverse import GaussianTransverseProfile +import numpy as np +from .profile import Profile -class GaussianProfile(CombinedLongitudinalTransverseProfile): + +class GaussianProfile(Profile): r""" Class for the analytic profile of a Gaussian laser pulse. @@ -21,6 +21,7 @@ class GaussianProfile(CombinedLongitudinalTransverseProfile): :math:`\boldsymbol{x}_\perp` is the transverse coordinate (orthogonal to the propagation direction). The other parameters in this formula are defined below. + This profile also supports some chirp parameters that are omitted in the expression above for clarity. Parameters ---------- @@ -61,6 +62,20 @@ class GaussianProfile(CombinedLongitudinalTransverseProfile): z_foc : float (in meter), optional Position of the focal plane. (The laser pulse is initialized at `z=0`.) + phi2 : float (in second^2), optional (default: '0') + The group-delay dispersion defined as :math:`\phi^{(2)} = \frac{dt_0}{d\omega}`. Here :math:`t_0` is the temporal position of this frequency component. + + beta : float (in second), optional (default: '0') + The angular dispersion defined as :math:`\beta = \frac{d\theta_0}{d\omega}`. Here :math:`\theta_0` is the propagation angle of this frequency component. + + zeta : float (in meter * second), optional (default: '0') + A spatial chirp defined as :math:`\zeta = \frac{dx_0}{d\omega}`. Here :math:`x_0` is the transverse beam center position of this frequency component. + The definitions of beta, phi2, and zeta are taken from [S. Akturk et al., Optics Express 12, 4399 (2004)]. + + stc_theta : float (in radian), optional (default: '0') + Transverse direction along which there are chirps and spatio-temporal couplings. + A value of 0 corresponds to the x-axis. + Examples -------- >>> import matplotlib.pyplot as plt @@ -104,12 +119,93 @@ class GaussianProfile(CombinedLongitudinalTransverseProfile): """ def __init__( - self, wavelength, pol, laser_energy, w0, tau, t_peak, cep_phase=0, z_foc=0 + self, + wavelength, + pol, + laser_energy, + w0, + tau, + t_peak, + cep_phase=0, + z_foc=0, + phi2=0, + beta=0, + zeta=0, + stc_theta=0, ): - super().__init__( - wavelength, - pol, - laser_energy, - GaussianLongitudinalProfile(wavelength, tau, t_peak, cep_phase), - GaussianTransverseProfile(w0, z_foc, wavelength), + super().__init__(wavelength, pol) + self.laser_energy = laser_energy + self.w0 = w0 + self.tau = tau + self.t_peak = t_peak + self.cep_phase = cep_phase + self.z_foc = z_foc + self.z_foc_over_zr = z_foc * wavelength / (np.pi * w0**2) + self.phi2 = phi2 + self.beta = beta + self.zeta = zeta + self.stc_theta = stc_theta + + def evaluate(self, x, y, t): + """ + Return the longitudinal envelope. + + Parameters + ---------- + t : ndarrays of floats + Define longitudinal points on which to evaluate the envelope + + x,y : ndarrays of floats + Define transverse points on which to evaluate the envelope + + Returns + ------- + envelope : ndarray of complex numbers + Contains the value of the longitudinal envelope at the + specified points. This array has the same shape as the array t. + """ + inv_tau2 = self.tau ** (-2) + inv_complex_waist_2 = 1.0 / ( + self.w0**2 * (1.0 + 2.0j * self.z_foc / (self.k0 * self.w0**2)) ) + stretch_factor = ( + 1 + + 4.0 + * (-self.zeta + self.beta * self.z_foc) + * inv_tau2 + * (-self.zeta + self.beta * self.z_foc) + * inv_complex_waist_2 + + 2.0j * (self.phi2 - self.beta**2 * self.k0 * self.z_foc) * inv_tau2 + ) + stc_exponent = ( + 1.0 + / stretch_factor + * inv_tau2 + * ( + t + - self.t_peak + - self.beta + * self.k0 + * (x * np.cos(self.stc_theta) + y * np.sin(self.stc_theta)) + - 2.0j + * (x * np.cos(self.stc_theta) + y * np.sin(self.stc_theta)) + * (-self.zeta - self.beta * self.z_foc) + * inv_complex_waist_2 + ) + ** 2 + ) + # Term for wavefront curvature + Gouy phase + diffract_factor = 1.0 - 1j * self.z_foc_over_zr + # Calculate the argument of the complex exponential + exp_argument = -(x**2 + y**2) / (self.w0**2 * diffract_factor) + # Get the profile + envelope = ( + np.exp( + -stc_exponent + + exp_argument + + 1.0j * (self.cep_phase + self.omega0 * self.t_peak) + ) + / diffract_factor + ) + + return envelope diff --git a/lasy/profiles/longitudinal/gaussian_profile.py b/lasy/profiles/longitudinal/gaussian_profile.py index 3d52131b..226c68c5 100644 --- a/lasy/profiles/longitudinal/gaussian_profile.py +++ b/lasy/profiles/longitudinal/gaussian_profile.py @@ -31,7 +31,7 @@ class GaussianLongitudinalProfile(LongitudinalProfile): cep_phase : float (in radian), optional The Carrier Enveloppe Phase (CEP), i.e. :math:`\phi_{cep}` in the above formula (i.e. the phase of the laser - oscillation, at the time where the laser envelope is maximum) + oscillation, at the time where the laser envelope is maximum). """ def __init__(self, wavelength, tau, t_peak, cep_phase=0): @@ -47,7 +47,7 @@ def evaluate(self, t): Parameters ---------- t : ndarrays of floats - Define points on which to evaluate the envelope + Define longitudinal points on which to evaluate the envelope Returns ------- @@ -59,5 +59,4 @@ def evaluate(self, t): -((t - self.t_peak) ** 2) / self.tau**2 + 1.0j * (self.cep_phase + self.omega0 * self.t_peak) ) - return envelope diff --git a/lasy/profiles/profile.py b/lasy/profiles/profile.py index 6266b1d8..f8d28bac 100644 --- a/lasy/profiles/profile.py +++ b/lasy/profiles/profile.py @@ -38,6 +38,7 @@ def __init__(self, wavelength, pol): self.pol = np.array([pol[0] / norm_pol, pol[1] / norm_pol]) self.lambda0 = wavelength self.omega0 = 2 * np.pi * c / self.lambda0 + self.k0 = 2.0 * np.pi / wavelength def evaluate(self, x, y, t): """ diff --git a/lasy/utils/laser_utils.py b/lasy/utils/laser_utils.py index daf5ccd7..55be1d3c 100644 --- a/lasy/utils/laser_utils.py +++ b/lasy/utils/laser_utils.py @@ -877,3 +877,229 @@ def import_from_z(dim, grid, omega0, field_z, z_axis, z0=0.0, t0=0.0, backend="N field = np.moveaxis(prop.z2t(transform_data, t_axis, z0=z0, t0=t0), 0, -1) field *= np.exp(1j * (z0 / c + t_axis) * omega0) grid.set_temporal_field(field) + + +def get_w0(grid, dim): + r""" + Calculate the laser waist. + + Parameters + ---------- + dim : string + Dimensionality of the array. Options are: + - 'xyt': The laser pulse is represented on a 3D grid: + Cartesian (x,y) transversely, and temporal (t) longitudinally. + - 'rt' : The laser pulse is represented on a 2D grid: + Cylindrical (r) transversely, and temporal (t) longitudinally. + + grid : a Grid object. + It contains an ndarray (V/m) with the value of the envelope field and the associated metadata that defines the points at which the laser is defined. + + Return + ---------- + sigma : Standard deviation of a**2 in m + """ + field = grid.get_temporal_field() + if dim == "xyt": + Nx, Ny, Nt = field.shape + A2 = (np.abs(field[Nx // 2 - 1, :, :]) ** 2).sum(-1) + ax = grid.axes[1] + else: + A2 = (np.abs(field[0, :, :]) ** 2).sum(-1) + ax = grid.axes[0] + if ax[0] > 0: + A2 = np.r_[A2[::-1], A2] + ax = np.r_[-ax[::-1], ax] + else: + A2 = np.r_[A2[::-1][:-1], A2] + ax = np.r_[-ax[::-1][:-1], ax] + + sigma = 2 * np.sqrt(np.average(ax**2, weights=A2)) + + return sigma + + +def get_phi2(dim, grid): + r""" + Calculate the group-delay dispersion of the laser. + + Parameters + ---------- + dim : string + Dimensionality of the array. Options are: + - 'xyt': The laser pulse is represented on a 3D grid: + Cartesian (x,y) transversely, and temporal (t) longitudinally. + - 'rt' : The laser pulse is represented on a 2D grid: + Cylindrical (r) transversely, and temporal (t) longitudinally. + + grid : a Grid object. + It contains an ndarray (V/m) with the value of the envelope field and the associated metadata that defines the points at which the laser is defined. + + Returns + ------- + phi2 : Group-delay dispersion in :math:`\Phi^{(2)} = \frac{d\omega_0}{dt}` (second^-2) + varphi2 : Group-delay dispersion in :math:`\varphi^{(2)}=\frac{dt_0}{d\omega}` (second^2) + """ + tau = 2 * get_duration(grid, dim) + env = grid.get_temporal_field() + env_abs2 = np.abs(env**2) + # Calculate group-delayed dispersion + phi_envelop = np.unwrap(np.angle(env), axis=2) + pphi_pt = np.gradient(phi_envelop, grid.dx[-1], axis=2) + pphi_pt2 = np.gradient(pphi_pt, grid.dx[-1], axis=2) + phi2 = np.average(pphi_pt2, weights=env_abs2) + varphi2 = np.max(np.roots([4 * phi2, -4, tau**4 * phi2])) + return phi2, varphi2 + + +def get_zeta(dim, grid, k0): + r""" + Calculate the spatial chirp of the laser. + + Parameters + ---------- + dim : string + Dimensionality of the array. Options are: + - 'xyt': The laser pulse is represented on a 3D grid: + Cartesian (x,y) transversely, and temporal (t) longitudinally. + - 'rt' : The laser pulse is represented on a 2D grid: + Cylindrical (r) transversely, and temporal (t) longitudinally. + + grid : a Grid object. + It contains an ndarray (V/m) with the value of the envelope field and the associated metadata that defines the points at which the laser is defined. + + Return + ---------- + zeta_x, zeta_y : Spatial chirp in :math:`\zeta=\frac{dx_0}{d\omega}` (meter * second) + nu_x, nu_y: Spatial chirp in :math:`\nu=\frac{d\omega_0}{dx}` (meter^-1 * second^-1) + """ + assert dim == "xyt", "No spatial chirp for axis-symmetric dimension." + w0 = get_w0(grid, dim) + tau = 2 * get_duration(grid, dim) + env_spec = grid.get_spectral_field() + env_spec_abs2 = np.abs(env_spec**2) + # Get the spectral axis + dt = grid.dx[-1] + Nt = grid.shape[-1] + omega = 2 * np.pi * np.fft.fftfreq(Nt, dt) + k0 * c + # Calculate dx0 and dy0 in (x,y,omega) space + weight_x_3d = np.transpose(env_spec_abs2, (2, 1, 0)) + weight_y_3d = np.transpose(env_spec_abs2, (2, 0, 1)) + xda = np.sum(grid.axes[0] * weight_x_3d, axis=2) / np.sum(weight_x_3d, axis=2) + yda = np.sum(grid.axes[1] * weight_y_3d, axis=2) / np.sum(weight_y_3d, axis=2) + # Calculate spatial chirp zeta + derivative_x_zeta = np.gradient(xda, omega, axis=0) + derivative_y_zeta = np.gradient(yda, omega, axis=0) + weight_x_2d = np.mean(env_spec_abs2, axis=0) + weight_y_2d = np.mean(env_spec_abs2, axis=1) + zeta_x = np.average(derivative_x_zeta.T, weights=weight_x_2d) + zeta_y = np.average(derivative_y_zeta.T, weights=weight_y_2d) + nu_x = 4 * zeta_x / (w0**2 * tau**2 + 4 * zeta_x**2) + nu_y = 4 * zeta_y / (w0**2 * tau**2 + 4 * zeta_y**2) + return [zeta_x, zeta_y], [nu_x, nu_y] + + +def get_beta(dim, grid, k0): + r""" + Calculate the angular dispersion of the laser. + + Parameters + ---------- + dim : string + Dimensionality of the array. Options are: + - 'xyt': The laser pulse is represented on a 3D grid: + Cartesian (x,y) transversely, and temporal (t) longitudinally. + - 'rt' : The laser pulse is represented on a 2D grid: + Cylindrical (r) transversely, and temporal (t) longitudinally. + + grid : a Grid object. + It contains an ndarray (V/m) with + the value of the envelope field and the associated metadata that defines the points at which the laser is defined. + + Return + ---------- + beta_x, beta_y : Angular dispersion in :math:` \beta = \frac{d\theta_0}{d\omega}` (second) + """ + assert dim == "xyt", "No angular chirp for axis-symmetric dimension." + env_spec = grid.get_spectral_field() + env_spec_abs2 = np.abs(env_spec**2) + # Get the spectral axis + dt = grid.dx[-1] + Nt = grid.shape[-1] + omega = 2 * np.pi * np.fft.fftfreq(Nt, dt) + k0 * c + # Calculate angular dispersion beta + phi_envelop_abs = np.unwrap( + np.array(np.arctan2(env_spec.imag, env_spec.real)), axis=2 + ) + angle_x = np.gradient(phi_envelop_abs, grid.dx[1], axis=1) / k0 + angle_y = np.gradient(phi_envelop_abs, grid.dx[0], axis=0) / k0 + derivative_x_beta = np.gradient(angle_y, omega, axis=2) + derivative_y_beta = np.gradient(angle_x, omega, axis=2) + beta_x = np.average(derivative_x_beta, weights=env_spec_abs2) + beta_y = np.average(derivative_y_beta, weights=env_spec_abs2) + return [beta_x, beta_y] + + +def get_pft(dim, grid): + r""" + Calculate the pulse front tilt (PFT) of the laser. + + Parameters + ---------- + dim : string + Dimensionality of the array. Options are: + - 'xyt': The laser pulse is represented on a 3D grid: + Cartesian (x,y) transversely, and temporal (t) longitudinally. + - 'rt' : The laser pulse is represented on a 2D grid: + Cylindrical (r) transversely, and temporal (t) longitudinally. + + grid : a Grid object. + It contains an ndarray (V/m) with + the value of the envelope field and the associated metadata + that defines the points at which the laser is defined. + + Return + ---------- + pft_x, pft_y : Pulse front tilt in :math:`p=\frac{dt_0}{dx}` (second * meter^-1). + """ + assert dim == "xyt", "No pulse front tilt for cylindrical symmetry." + env = grid.get_temporal_field() + env_abs2 = np.abs(env**2) + weight_xy_2d = np.mean(env_abs2, axis=2) + z_centroids = np.sum(grid.axes[2] * env_abs2, axis=2) / np.sum(env_abs2, axis=2) + derivative_x_pft = np.gradient(z_centroids, axis=0) / grid.dx[0] + derivative_y_pft = np.gradient(z_centroids, axis=1) / grid.dx[1] + pft_x = np.average(derivative_x_pft, weights=weight_xy_2d) + pft_y = np.average(derivative_y_pft, weights=weight_xy_2d) + return [pft_x, pft_y] + + +def get_propation_angle(dim, grid, k0): + r""" + Calculate the propagating angle of the laser. + + Parameters + ---------- + dim : string + Dimensionality of the array. Options are: + - 'xyt': The laser pulse is represented on a 3D grid: + Cartesian (x,y) transversely, and temporal (t) longitudinally. + - 'rt' : The laser pulse is represented on a 2D grid: + Cylindrical (r) transversely, and temporal (t) longitudinally. + + grid : a Grid object. + It contains an ndarray (V/m) with the value of the envelope field and the associated metadata that defines the points at which the laser is defined. + + Return + ---------- + angle_x, angle_y : Propagating angle in :math:`p = \frac{k_x}{k_z}` or :math:`p = \frac{k_y}{k_z}` (in radians). + """ + assert dim == "xyt", "Propagation is always on-axis for axis-symmetric dimension." + env = grid.get_temporal_field() + env_abs2 = np.abs(env**2) + phi_envelop_abs = np.unwrap(np.angle(env), axis=2) + pphi_px = np.gradient(phi_envelop_abs, grid.dx[1], axis=1) + pphi_py = np.gradient(phi_envelop_abs, grid.dx[0], axis=0) + angle_x = np.average(pphi_px, weights=env_abs2) / k0 + angle_y = np.average(pphi_py, weights=env_abs2) / k0 + return [angle_x, angle_y] diff --git a/tests/test_STC.py b/tests/test_STC.py new file mode 100644 index 00000000..0159bc52 --- /dev/null +++ b/tests/test_STC.py @@ -0,0 +1,111 @@ +""" +Test the implementation of spatio-temporal coupling (STC). + +This test verifies the correct implementation of initialization and diagnostics for spatio-temporal coupling in Gaussian lasers. It does so by creating a Gaussian pulse at focus and calculating the STC factors using the implemented functions in `laser.utils`. + +Additionally, the correctness is validated by comparing the Gaussian profile with a combined Gaussian profile without STC out of focus. +""" + +import numpy as np +import scipy.constants as scc + +from lasy.laser import Laser +from lasy.profiles.combined_profile import CombinedLongitudinalTransverseProfile +from lasy.profiles.gaussian_profile import GaussianProfile +from lasy.profiles.longitudinal import GaussianLongitudinalProfile +from lasy.profiles.transverse import GaussianTransverseProfile +from lasy.utils.laser_utils import get_beta, get_phi2, get_zeta + +wavelength = 0.6e-6 # m +pol = (1, 0) +laser_energy = 1.0 # J +w0 = 5e-6 # m +tau = 5e-14 # s +t_peak = 0.0 # s +beta = 3e-18 # s +zeta = 2.4e-22 # m * s +phi2 = 2.4e-24 # s ^ 2 +stc_theta = scc.pi / 2 # rad +z_r = (np.pi * w0**2) / wavelength +z_foc = 3 * z_r + +# Create STC profile. +STCprofile = GaussianProfile( + wavelength=wavelength, + pol=pol, + laser_energy=laser_energy, + w0=w0, + tau=tau, + t_peak=t_peak, + beta=beta, + zeta=zeta, + phi2=phi2, + stc_theta=stc_theta, +) + +# Create laser with given profile in `xyt` geometry. +laser_3d = Laser( + dim="xyt", + lo=(-10e-6, -10e-6, -10e-14), + hi=(10e-6, 10e-6, +10e-14), + npoints=(100, 100, 200), + profile=STCprofile, +) + +# Create laser out of focus with given profile in `rt` geometry by combined and gaussian profile. +long_profile = GaussianLongitudinalProfile(wavelength, tau, t_peak) +trans_profile = GaussianTransverseProfile(w0, wavelength, z_foc) + +combined_profile = CombinedLongitudinalTransverseProfile( + wavelength, pol, laser_energy, long_profile, trans_profile +) + +gaussian_profile = GaussianProfile( + wavelength=wavelength, + pol=pol, + laser_energy=laser_energy, + w0=w0, + tau=tau, + t_peak=t_peak, + z_foc=z_foc, +) + +laser_2d_combined = Laser( + dim="rt", + lo=(0e-6, -10e-14), + hi=(50e-6, +10e-14), + npoints=(60, 200), + profile=combined_profile, +) + +laser_2d_gaussian = Laser( + dim="rt", + lo=(0e-6, -10e-14), + hi=(50e-6, +10e-14), + npoints=(60, 200), + profile=gaussian_profile, +) + +# calculate the error of gaussian profile +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)) + / 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) +[zeta_x, zeta_y], [nu_x, nu_y] = get_zeta( + 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) + +assert (err_real + err_imag) < 1e-6 +np.testing.assert_approx_equal(phi2_3d, phi2, significant=2) +np.testing.assert_approx_equal(zeta_y, zeta, significant=2) +np.testing.assert_approx_equal(beta_y, beta, significant=2) diff --git a/tests/test_axiparabola.py b/tests/test_axiparabola.py index 28095665..26891e4e 100644 --- a/tests/test_axiparabola.py +++ b/tests/test_axiparabola.py @@ -10,7 +10,7 @@ from lasy.laser import Laser from lasy.optical_elements import Axiparabola -from lasy.profiles.gaussian_profile import CombinedLongitudinalTransverseProfile +from lasy.profiles.combined_profile import CombinedLongitudinalTransverseProfile from lasy.profiles.longitudinal import GaussianLongitudinalProfile from lasy.profiles.transverse import SuperGaussianTransverseProfile diff --git a/tests/test_gaussian_propagator.py b/tests/test_gaussian_propagator.py index e669eff6..d0c945e8 100644 --- a/tests/test_gaussian_propagator.py +++ b/tests/test_gaussian_propagator.py @@ -47,7 +47,7 @@ def check_gaussian_propagation( laser, propagation_distance=100e-6, propagation_step=10e-6 ): # Do the propagation and check evolution of waist with theory - w0 = laser.profile.trans_profile.w0 + w0 = laser.profile.w0 L_R = np.pi * w0**2 / laser.profile.lambda0 propagated_distance = 0.0 diff --git a/tests/test_laser_utils.py b/tests/test_laser_utils.py index e50ad317..0fbe926a 100644 --- a/tests/test_laser_utils.py +++ b/tests/test_laser_utils.py @@ -45,9 +45,7 @@ def test_laser_analysis_utils(): # Check that laser duration agrees with the given one. tau_rms = get_duration(laser.grid, dim) - np.testing.assert_approx_equal( - 2 * tau_rms, laser.profile.long_profile.tau, significant=3 - ) + np.testing.assert_approx_equal(2 * tau_rms, laser.profile.tau, significant=3) if __name__ == "__main__": diff --git a/tests/test_t2z2t.py b/tests/test_t2z2t.py index 4ad2c7f1..4fed7908 100644 --- a/tests/test_t2z2t.py +++ b/tests/test_t2z2t.py @@ -24,9 +24,9 @@ def gaussian(): def get_laser_z_analytic(profile, z_axis, r_axis): - w0 = profile.trans_profile.w0 - tau = profile.long_profile.tau - omega0 = profile.long_profile.omega0 + w0 = profile.w0 + tau = profile.tau + omega0 = profile.omega0 k0 = omega0 / c lambda0 = 2 * np.pi / k0 @@ -68,8 +68,8 @@ def check_correctness(laser_t_in, laser_t_out, laser_z_analytic, z_axis): def test_RT_case(gaussian): dim = "rt" - w0 = gaussian.trans_profile.w0 - tau = gaussian.long_profile.tau + w0 = gaussian.w0 + tau = gaussian.tau lo = (0, -3.5 * tau) hi = (5 * w0, 3.5 * tau) npoints = (128, 65) @@ -91,8 +91,8 @@ def test_RT_case(gaussian): def test_3D_case(gaussian): # - 3D case dim = "xyt" - w0 = gaussian.trans_profile.w0 - tau = gaussian.long_profile.tau + w0 = gaussian.w0 + tau = gaussian.tau lo = (-5 * w0, -5 * w0, -3.5 * tau) hi = (5 * w0, 5 * w0, 3.5 * tau) npoints = (160, 164, 65)