zero k=0 values

This commit is contained in:
Jan Petykiewicz 2020-06-11 19:29:25 -07:00
parent fa3f8db267
commit 0e04f5ca77

View File

@ -188,6 +188,11 @@ def far_to_nearfield(E_far: fdfield_t,
sin_th[numpy.logical_and(kx == 0, ky == 0)] = 0 sin_th[numpy.logical_and(kx == 0, ky == 0)] = 0
cos_th[numpy.logical_and(kx == 0, ky == 0)] = 1 cos_th[numpy.logical_and(kx == 0, ky == 0)] = 1
theta = numpy.arctan2(ky, kx)
phi = numpy.arccos(cos_phi)
theta[numpy.logical_and(kx == 0, ky == 0)] = 0
phi[numpy.logical_and(kx == 0, ky == 0)] = 0
# Zero fields beyond valid (phi, theta) # Zero fields beyond valid (phi, theta)
invalid_ind = kxy2 >= k * k invalid_ind = kxy2 >= k * k
theta[invalid_ind] = 0 theta[invalid_ind] = 0