Skip to content

Commit 1b5b91f

Browse files
committed
Update description
1 parent 1e7852d commit 1b5b91f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

openpmd_viewer/addons/pic/lpa_diagnostics.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,18 @@ def get_laser_spectral_intensity(self, t=None, iteration=None, pol=None, m='all'
805805
plot=False, **kw ):
806806
"""
807807
Calculate the spectral intensity of the laser pulse, defined as:
808-
$$ I(k) = \epsilon_0 \int d\boldsymbol{x}_\perp | \hat{E}(\boldsymbol{x}_\perp, k) |^2$$
808+
$$ I(k) = 2\epsilon_0 \int d\boldsymbol{x}_\perp | \hat{E}(\boldsymbol{x}_\perp, k) |^2$$
809809
with
810810
$$ \hat{E}(\boldsymbol{x}_\perp, k) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} E(\boldsymbol{x}_\perp, z) \exp(-i k z) dz $$
811811
812-
The electromagetic energy associated with the electric field can be obtained by:
812+
The electromagetic energy associated with the laser pulse can be obtained by:
813+
$$ \mathcal{E}_E = \epsilon_0 \int_0^{\infty} I(k) dk$$
814+
which corresponds to the folowing code:
813815
816+
.. code-block:: python
814817
815-
TODO: Add option to return as a function of lambda
818+
I, info = ts.get_laser_spectral_intensity(iteration=iteration, pol='y')
819+
energy = I.sum() * info.dk
816820
817821
Parameters
818822
----------
@@ -853,7 +857,7 @@ def get_laser_spectral_intensity(self, t=None, iteration=None, pol=None, m='all'
853857
fft_field = np.fft.fft(field, axis=inverted_axes_dict['z']) * info.dz/np.sqrt(2*np.pi)
854858

855859
# Compute spectral intensity by squaring the FFT and integrating over the transverse plane
856-
spectral_intensity = const.epsilon_0 * np.abs(fft_field)**2
860+
spectral_intensity = 2*const.epsilon_0 * np.abs(fft_field)**2
857861
geometry = self.fields_metadata['E']['geometry']
858862
if geometry == '3dcartesian':
859863
spectral_intensity = np.sum(spectral_intensity,

0 commit comments

Comments
 (0)