@@ -855,14 +855,18 @@ def get_laser_spectral_intensity(self, t=None, iteration=None, pol=None, m='all'
855855 plot = False , ** kw ):
856856 """
857857 Calculate the spectral intensity of the laser pulse, defined as:
858- $$ I(k) = \epsilon_0 \int d\b oldsymbol{x}_\perp | \hat{E}(\b oldsymbol{x}_\perp, k) |^2$$
858+ $$ I(k) = 2 \epsilon_0 \int d\b oldsymbol{x}_\perp | \hat{E}(\b oldsymbol{x}_\perp, k) |^2$$
859859 with
860860 $$ \hat{E}(\b oldsymbol{x}_\perp, k) = \f rac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} E(\b oldsymbol{x}_\perp, z) \exp(-i k z) dz $$
861861
862- The electromagetic energy associated with the electric field can be obtained by:
862+ The electromagetic energy associated with the laser pulse can be obtained by:
863+ $$ \mathcal{E}_E = \epsilon_0 \int_0^{\infty} I(k) dk$$
864+ which corresponds to the folowing code:
863865
866+ .. code-block:: python
864867
865- TODO: Add option to return as a function of lambda
868+ I, info = ts.get_laser_spectral_intensity(iteration=iteration, pol='y')
869+ energy = I.sum() * info.dk
866870
867871 Parameters
868872 ----------
@@ -903,7 +907,7 @@ def get_laser_spectral_intensity(self, t=None, iteration=None, pol=None, m='all'
903907 fft_field = np .fft .fft (field , axis = inverted_axes_dict ['z' ]) * info .dz / np .sqrt (2 * np .pi )
904908
905909 # Compute spectral intensity by squaring the FFT and integrating over the transverse plane
906- spectral_intensity = const .epsilon_0 * np .abs (fft_field )** 2
910+ spectral_intensity = 2 * const .epsilon_0 * np .abs (fft_field )** 2
907911 geometry = self .fields_metadata ['E' ]['geometry' ]
908912 if geometry == '3dcartesian' :
909913 spectral_intensity = np .sum (spectral_intensity ,
0 commit comments