From 20c9a759226cb825dec0fdff9fafa97f16a2c2c9 Mon Sep 17 00:00:00 2001 From: Gamelin Alexis <alexis.gamelin@synchrotron-soleil.fr> Date: Fri, 10 Sep 2021 14:40:07 +0200 Subject: [PATCH] [Fix] TransverseMap with chromaticity Fix bug with chromaticity where chromaticity was taken as chromaticity * tune. --- tracking/element.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tracking/element.py b/tracking/element.py index 9f18581..d5eacc2 100644 --- a/tracking/element.py +++ b/tracking/element.py @@ -151,9 +151,7 @@ class TransverseMap(Element): self.alpha = self.ring.optics.local_alpha self.beta = self.ring.optics.local_beta self.gamma = self.ring.optics.local_gamma - self.dispersion = self.ring.optics.local_dispersion - self.phase_advance = self.ring.tune[0:2]*2*np.pi - + self.dispersion = self.ring.optics.local_dispersion if self.ring.adts is not None: self.adts_poly = [np.poly1d(self.ring.adts[0]), np.poly1d(self.ring.adts[1]), @@ -173,16 +171,20 @@ class TransverseMap(Element): """ # Compute phase advance which depends on energy via chromaticity and ADTS - if self.ring.adts is not None: - phase_advance_x = self.phase_advance[0]*(1+self.ring.chro[0]*bunch["delta"]+ - self.adts_poly[0](bunch['x'])+self.adts_poly[2](bunch['y'])) - - phase_advance_y = self.phase_advance[1]*(1+self.ring.chro[1]*bunch["delta"]+ - self.adts_poly[1](bunch['x'])+self.adts_poly[3](bunch['y'])) - + if self.ring.adts is None: + phase_advance_x = 2*np.pi * (self.ring.tune[0] + + self.ring.chro[0]*bunch["delta"]) + phase_advance_y = 2*np.pi * (self.ring.tune[1] + + self.ring.chro[1]*bunch["delta"]) else: - phase_advance_x = self.phase_advance[0]*(1+self.ring.chro[0]*bunch["delta"]) - phase_advance_y = self.phase_advance[1]*(1+self.ring.chro[1]*bunch["delta"]) + phase_advance_x = 2*np.pi * (self.ring.tune[0] + + self.ring.chro[0]*bunch["delta"] + + self.adts_poly[0](bunch['x']) + + self.adts_poly[2](bunch['y'])) + phase_advance_y = 2*np.pi * (self.ring.tune[1] + + self.ring.chro[1]*bunch["delta"] + + self.adts_poly[1](bunch['x']) + + self.adts_poly[3](bunch['y'])) # 6x6 matrix corresponding to (x, xp, delta, y, yp, delta) matrix = np.zeros((6,6,len(bunch))) -- GitLab