From c543868c0b016ecd522537b68a25744978376f21 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Tue, 14 Jan 2025 21:51:32 -0800 Subject: [PATCH] check for sign=0 case --- meanas/fdfd/waveguide_2d.py | 1 + 1 file changed, 1 insertion(+) diff --git a/meanas/fdfd/waveguide_2d.py b/meanas/fdfd/waveguide_2d.py index 8ea4846..f2306c1 100644 --- a/meanas/fdfd/waveguide_2d.py +++ b/meanas/fdfd/waveguide_2d.py @@ -435,6 +435,7 @@ def _normalized_fields( sign = numpy.sign(E_weighted[:, :max(shape[0] // 2, 1), :max(shape[1] // 2, 1)].real.sum()) + assert sign != 0 norm_factor = sign * norm_amplitude * numpy.exp(1j * norm_angle)