From afa2e9fc3d932aaf9b79caf2ba8441384a024eff Mon Sep 17 00:00:00 2001 From: Gamelin Alexis <gamelin@synchrotron-soleil.fr> Date: Fri, 13 Nov 2020 17:20:58 +0100 Subject: [PATCH] Bugfix : transverse wake potential Fix dipole_moment due to switch to numpy arrays for Bunch.binning --- tracking/wakepotential.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tracking/wakepotential.py b/tracking/wakepotential.py index 4a0c599..41e5644 100644 --- a/tracking/wakepotential.py +++ b/tracking/wakepotential.py @@ -141,9 +141,9 @@ class WakePotential(Element): Dipole moment of the bunch. """ - dipole = np.zeros((self.n_bin,)) - for i in range(self.n_bin): - dipole[i] = bunch[plane][self.sorted_index == self.bins[i]].sum() + dipole = np.zeros((self.n_bin - 1,)) + for i in range(self.n_bin - 1): + dipole[i] = bunch[plane][self.sorted_index == i].sum() dipole = dipole/self.profile dipole[np.isnan(dipole)] = 0 -- GitLab