@@ -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\b oldsymbol{x}_\perp | \hat{E}(\b oldsymbol{x}_\perp, k) |^2$$
808+ $$ I(k) = 2 \epsilon_0 \int d\b oldsymbol{x}_\perp | \hat{E}(\b oldsymbol{x}_\perp, k) |^2$$
809809 with
810810 $$ \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 $$
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