Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 16, 2024
1 parent 4752ad1 commit c218700
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion lasy/profiles/gaussian_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __init__(
zeta=zeta,
stc_theta=stc_theta,
w0=w0,
z_foc=z_foc
z_foc=z_foc,
),
GaussianTransverseProfile(w0, z_foc, wavelength),
)
64 changes: 31 additions & 33 deletions lasy/profiles/longitudinal/gaussian_profile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
from scipy import constants as scc

from .longitudinal_profile import LongitudinalProfile

Expand Down Expand Up @@ -113,42 +112,41 @@ def evaluate(self, t, x, y):
"""
inv_tau2 = self.tau ** (-2)
assert (
x is not None and y is not None
), "transverse points should be specified if spatio-temperal coupling exits"
x is not None and y is not None
), "transverse points should be specified if spatio-temperal coupling exits"
inv_complex_waist_2 = (
1.0
/ (
self.w0**2
* (1.0 + 2.0j * self.z_foc_over_zr / (self.k0 * self.w0**2))
)
if self.beta
else 0
1.0
/ (self.w0**2 * (1.0 + 2.0j * self.z_foc_over_zr / (self.k0 * self.w0**2)))
if self.beta
else 0
)
stretch_factor = (
1 +
4.0
* (self.zeta + self.beta * self.z_foc_over_zr * inv_tau2)
* (self.zeta + self.beta * self.z_foc_over_zr * inv_complex_waist_2)
+ 2.0j
* (self.phi2 - self.beta**2 * self.k0 * self.z_foc_over_zr)
* inv_tau2
1
+ 4.0
* (self.zeta + self.beta * self.z_foc_over_zr * inv_tau2)
* (self.zeta + self.beta * self.z_foc_over_zr * inv_complex_waist_2)
+ 2.0j
* (self.phi2 - self.beta**2 * self.k0 * self.z_foc_over_zr)
* 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_over_zr)
* inv_complex_waist_2
)
** 2
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_over_zr)
* inv_complex_waist_2
)
** 2
)
envelope = np.exp(
-stc_exponent + 1.0j * (self.cep_phase + self.omega0 * self.t_peak)
)
envelope = np.exp(-stc_exponent + 1.0j * (self.cep_phase + self.omega0 * self.t_peak))
return envelope
1 change: 1 addition & 0 deletions lasy/profiles/longitudinal/longitudinal_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, wavelength):
self.lambda0 = wavelength
self.omega0 = 2 * pi * c / self.lambda0
self.k0 = 2.0 * scc.pi / wavelength

def evaluate(self, t):
"""
Return the longitudinal envelope.
Expand Down

0 comments on commit c218700

Please sign in to comment.