From ce846ad956f809c67c2fdccf3eef633b5c8feef5 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:36:27 +0100 Subject: [PATCH] [mini] Enable offset initialisation of Gaussianprofile (#342) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxence Thévenet --- lasy/profiles/gaussian_profile.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lasy/profiles/gaussian_profile.py b/lasy/profiles/gaussian_profile.py index c428cd62..8c93b5e9 100644 --- a/lasy/profiles/gaussian_profile.py +++ b/lasy/profiles/gaussian_profile.py @@ -54,6 +54,9 @@ class GaussianProfile(Profile): The time at which the laser envelope reaches its maximum amplitude, i.e. :math:`t_{peak}` in the above formula. + x0 , y0 : float (in meter) optional (default: '0') + Transverse centroid for the laser pulse + cep_phase : float (in radian), optional The Carrier Envelope Phase (CEP), i.e. :math:`\phi_{cep}` in the above formula (i.e. the phase of the laser @@ -126,6 +129,8 @@ def __init__( w0, tau, t_peak, + x0=0, + y0=0, cep_phase=0, z_foc=0, phi2=0, @@ -145,6 +150,8 @@ def __init__( self.beta = beta self.zeta = zeta self.stc_theta = stc_theta + self.x0 = x0 + self.y0 = y0 def evaluate(self, x, y, t): """ @@ -197,7 +204,9 @@ def evaluate(self, x, y, t): # 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) + exp_argument = -((x - self.x0) ** 2 + (y - self.y0) ** 2) / ( + self.w0**2 * diffract_factor + ) # Get the profile envelope = ( np.exp(