diff --git a/tracking/wakepotential.py b/tracking/wakepotential.py index 3adee163e811af06a6286e0aee178ecf913c31ef..ee99f0a41478dc80b596694b2c592137fdebc9b7 100644 --- a/tracking/wakepotential.py +++ b/tracking/wakepotential.py @@ -507,12 +507,14 @@ class WakePotential(Element): for wake_type in self.types: tau0, Wp = self.get_wakepotential(bunch, wake_type) profile0 = getattr(self, "profile0_" + wake_type) - factorTD = -1*np.trapz(Wp*profile0, tau0) + factorTD = np.trapz(Wp*profile0, tau0) + if wake_type == "Wlong": + factorTD *= -1 if wake_type == "Wxdip": - factorTD = factorTD / bunch["x"].mean() + factorTD /= bunch["x"].mean() if wake_type == "Wydip": - factorTD = factorTD / bunch["y"].mean() + factorTD /= bunch["y"].mean() Z = getattr(self.wakefield, "Z" + wake_type[1:]) sigma = bunch['tau'].std()