Fix wgmode expansion

This commit is contained in:
Jan Petykiewicz 2019-08-07 01:00:57 -07:00
parent 3429120993
commit 2c91ea249f

View File

@ -436,16 +436,15 @@ def expand_wgmode_e(E: field_t,
phase_E = numpy.exp(iphi * r_E).reshape(a_shape) phase_E = numpy.exp(iphi * r_E).reshape(a_shape)
# Expand our slice to the entire grid using the phase factors # Expand our slice to the entire grid using the phase factors
Ee = numpy.zeros_like(E) E_expanded = numpy.zeros_like(E)
slices_exp = list(slices) slices_exp = list(slices)
slices_exp[axis] = slice(E.shape[axis + 1]) slices_exp[axis] = slice(E.shape[axis + 1])
slices_exp = (slice(None), *slices_exp) slices_exp = (slice(None), *slices_exp)
slices_in = tuple(slice(None), *slices) slices_in = (slice(None), *slices)
Ee[slices_exp] = phase_E * numpy.array(E)[slices_in] E_expanded[slices_exp] = phase_E * numpy.array(E)[slices_in]
return E_expanded
return Ee