From 188dcb362face362a8a65dfcc9e568c1547dab07 Mon Sep 17 00:00:00 2001 From: LyceanEM Date: Wed, 15 May 2024 16:03:42 +0100 Subject: [PATCH] Corrected poorly defined scattering for elements=False case. --- lyceanem/models/frequency_domain.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lyceanem/models/frequency_domain.py b/lyceanem/models/frequency_domain.py index c80177e..a17713e 100644 --- a/lyceanem/models/frequency_domain.py +++ b/lyceanem/models/frequency_domain.py @@ -735,9 +735,9 @@ def calculate_scattering( if not elements: # create efiles for model if multiE: - Ex = np.zeros((desired_E_axis.shape[0]), dtype=np.complex64) - Ey = np.zeros((desired_E_axis.shape[0]), dtype=np.complex64) - Ez = np.zeros((desired_E_axis.shape[0]), dtype=np.complex64) + Ex = np.zeros((desired_E_axis.shape[0],num_sinks), dtype=np.complex64) + Ey = np.zeros((desired_E_axis.shape[0],num_sinks), dtype=np.complex64) + Ez = np.zeros((desired_E_axis.shape[0],num_sinks), dtype=np.complex64) for e_inc in range(desired_E_axis.shape[0]): conformal_E_vectors = EM.calculate_conformalVectors( desired_E_axis[e_inc, :], @@ -750,16 +750,16 @@ def calculate_scattering( scatter_map = EM.EMGPUFreqDomain( num_sources, num_sinks, full_index, point_informationv2, wavelength ) - Ex[e_inc] = np.sum(np.dot(np.ones((num_sources)), scatter_map[:, :, 0])) - Ey[e_inc] = np.sum(np.dot(np.ones((num_sources)), scatter_map[:, :, 1])) - Ez[e_inc] = np.sum(np.dot(np.ones((num_sources)), scatter_map[:, :, 2])) + Ex[e_inc] = np.dot(np.ones((num_sources)), scatter_map[:, :, 0]) + Ey[e_inc] = np.dot(np.ones((num_sources)), scatter_map[:, :, 1]) + Ez[e_inc] = np.dot(np.ones((num_sources)), scatter_map[:, :, 2]) else: scatter_map = EM.EMGPUFreqDomain( num_sources, num_sinks, full_index, point_informationv2, wavelength ) - Ex = np.sum(np.dot(np.ones((num_sources)), scatter_map[:, :, 0])) - Ey = np.sum(np.dot(np.ones((num_sources)), scatter_map[:, :, 1])) - Ez = np.sum(np.dot(np.ones((num_sources)), scatter_map[:, :, 2])) + Ex = np.dot(np.ones((num_sources)), scatter_map[:, :, 0]) + Ey = np.dot(np.ones((num_sources)), scatter_map[:, :, 1]) + Ez = np.dot(np.ones((num_sources)), scatter_map[:, :, 2]) # convert to etheta,ephi