Skip to content
Snippets Groups Projects
Commit 48785e62 authored by Vadim_Migunov's avatar Vadim_Migunov
Browse files

Reviewed PhaseMapperCharge and bug fix in KernelCharge

parent 3e7e1b21
No related branches found
No related tags found
No related merge requests found
......@@ -236,8 +236,10 @@ class KernelCharge(object):
else:
self.dim_pad = tuple(2 ** np.ceil(np.log2(2 * np.array(dim_uv))).astype(int)) # pow(2)
self.dim_fft = (self.dim_pad[0], self.dim_pad[1] // 2 + 1) # last axis is real
self.slice_phase = slice(dim_uv[0] - 1, self.dim_kern[0]) # Shift because kernel center is not at (0, 0)!
self.slice_c = slice(0, dim_uv[0])
self.slice_phase = (slice(dim_uv[0] - 1, self.dim_kern[0]), # Shift because kernel center
slice(dim_uv[1] - 1, self.dim_kern[1])) # is not at (0, 0)!
self.slice_c = (slice(0, dim_uv[0]), # Charge is padded on the far end!
slice(0, dim_uv[1])) # (Phase cutout is shifted as listed above)
# Calculate kernel (single pixel phase):
coeff = C_e * Q_E / (4 * np.pi * EPS_0) # Minus is gone because of negative z-direction
v_dim, u_dim = dim_uv
......
......@@ -452,7 +452,7 @@ class PhaseMapperCharge(PhaseMapper):
assert elecdata.dim[0] == 1, 'Charge distribution must be 2-dimensional!'
assert elecdata.dim[1:3] == self.kernelcharge.dim_uv, 'Dimensions do not match!'
# Process input parameters:
self.c[self.kernelcharge.slice_c] = elecdata.field[0, 0, ...]
self.c[self.kernelcharge.slice_c] = elecdata.field[0, ...]
return PhaseMap(elecdata.a, self._convolve())
def _convolve(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment