From 1a92be9dcd152988646b79e19b2df81073cda12e Mon Sep 17 00:00:00 2001
From: Watanyu Foosang <watanyu.f@gmail.com>
Date: Fri, 23 Apr 2021 14:59:47 +0200
Subject: [PATCH] Modify ADTS encapsulation from array to list

---
 tracking/element.py     | 14 +++++---------
 tracking/synchrotron.py |  4 ++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/tracking/element.py b/tracking/element.py
index de37ca8..9f18581 100644
--- a/tracking/element.py
+++ b/tracking/element.py
@@ -155,14 +155,10 @@ class TransverseMap(Element):
         self.phase_advance = self.ring.tune[0:2]*2*np.pi
         
         if self.ring.adts is not None:
-            self.adts_option = True
-            self.adts_poly = np.array([np.poly1d(self.ring.adts[0]),
-                                       np.poly1d(self.ring.adts[1]),
-                                       np.poly1d(self.ring.adts[2]), 
-                                       np.poly1d(self.ring.adts[3])])
-        
-        else:
-            self.adts_option = False
+            self.adts_poly = [np.poly1d(self.ring.adts[0]),
+                              np.poly1d(self.ring.adts[1]),
+                              np.poly1d(self.ring.adts[2]), 
+                              np.poly1d(self.ring.adts[3])]
     
     @Element.parallel    
     def track(self, bunch):
@@ -177,7 +173,7 @@ class TransverseMap(Element):
         """
 
         # Compute phase advance which depends on energy via chromaticity and ADTS
-        if self.adts_option is True:
+        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']))
             
diff --git a/tracking/synchrotron.py b/tracking/synchrotron.py
index 34cca93..d71e78b 100644
--- a/tracking/synchrotron.py
+++ b/tracking/synchrotron.py
@@ -44,8 +44,8 @@ class Synchrotron:
         Horizontal and vertical (non-normalized) chromaticities.
     U0 : float, optional
         Energy loss per turn in [eV].
-    adts : array of shape (4,) or None, optional
-        Array that contains arrays of polynomial's coefficients, in decreasing 
+    adts : list of arrays or None, optional
+        List that contains arrays of polynomial's coefficients, in decreasing 
         powers, used to determine Amplitude-Dependent Tune Shifts (ADTS). 
         The order of the elements strictly needs to be
         [coef_xx, coef_yx, coef_xy, coef_yy], where x and y denote the horizontal
-- 
GitLab