Skip to content

Commit

Permalink
cancel the if condition for longitudinal profile
Browse files Browse the repository at this point in the history
  • Loading branch information
huixingjian committed Oct 16, 2024
1 parent 4608356 commit 4752ad1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
4 changes: 2 additions & 2 deletions lasy/profiles/gaussian_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ def __init__(
beta=beta,
phi2=phi2,
zeta=zeta,
stc_theta=0,
stc_theta=stc_theta,
w0=w0,
z_foc=z_foc,
z_foc=z_foc
),
GaussianTransverseProfile(w0, z_foc, wavelength),
)
34 changes: 11 additions & 23 deletions lasy/profiles/longitudinal/gaussian_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(
phi2=0,
zeta=0,
stc_theta=0,
w0=None,
w0=0,
z_foc=0,
):
super().__init__(wavelength)
Expand All @@ -85,11 +85,6 @@ def __init__(
self.zeta = zeta
self.w0 = w0
self.stc_theta = stc_theta
self.k0 = 2.0 * scc.pi / wavelength
if beta:
assert (
w0 is not None and z_foc is not None
), "Both w0 and z_foc should be specified if angular dispersion beta is not 0"
if z_foc == 0:
self.z_foc_over_zr = 0
else:
Expand All @@ -98,7 +93,7 @@ def __init__(
), "You need to pass the wavelength, when `z_foc` is non-zero."
self.z_foc_over_zr = z_foc * wavelength / (np.pi * w0**2)

def evaluate(self, t, x=None, y=None):
def evaluate(self, t, x, y):
"""
Return the longitudinal envelope.
Expand All @@ -116,30 +111,29 @@ def evaluate(self, t, x=None, y=None):
Contains the value of the longitudinal envelope at the
specified points. This array has the same shape as the array t.
"""
stretch_factor = 1.0
inv_tau2 = self.tau ** (-2)
if self.phi2 or self.zeta or self.beta:
assert (
assert (
x is not None and y is not None
), "transverse points should be specified if spatio-temperal coupling exits"
inv_complex_waist_2 = (
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
)
stretch_factor += (
)
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
)
stc_exponent = (
)
stc_exponent = (
1.0
/ stretch_factor
* inv_tau2
Expand All @@ -155,12 +149,6 @@ def evaluate(self, t, x=None, y=None):
* inv_complex_waist_2
)
** 2
)
envelope = np.exp(-stc_exponent)
else:
envelope = np.exp(
-((t - self.t_peak) ** 2) / self.tau**2
+ 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
2 changes: 1 addition & 1 deletion lasy/profiles/longitudinal/longitudinal_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LongitudinalProfile(object):
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 4752ad1

Please sign in to comment.