From 829007c6721683741a330965ae7d4d70f1276154 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Tue, 14 Jan 2025 22:00:08 -0800 Subject: [PATCH] Only keep the real part of the energy --- meanas/fdfd/waveguide_2d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meanas/fdfd/waveguide_2d.py b/meanas/fdfd/waveguide_2d.py index 8bc57a1..00d33a0 100644 --- a/meanas/fdfd/waveguide_2d.py +++ b/meanas/fdfd/waveguide_2d.py @@ -425,7 +425,7 @@ def _normalized_fields( Sz_tavg = numpy.real(Sz_a.sum() - Sz_b.sum()) * 0.5 # 0.5 since E, H are assumed to be peak (not RMS) amplitudes assert Sz_tavg > 0, f'Found a mode propagating in the wrong direction! {Sz_tavg=}' - energy = epsilon * e.conj() * e + energy = numpy.real(epsilon * e.conj() * e) norm_amplitude = 1 / numpy.sqrt(Sz_tavg) norm_angle = -numpy.angle(e[energy.argmax()]) # Will randomly add a negative sign when mode is symmetric