diff --git a/tracking/wakepotential.py b/tracking/wakepotential.py index 4a0c599d1cd9824fb566bbcf3eed8a068f01e324..41e56449b480b26fc80fe781e50a62762e04a558 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