Fix wgmode expansion
This commit is contained in:
parent
3429120993
commit
2c91ea249f
@ -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
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user