From 09a96856a31141ade71867b9d1ba4151898c3aac Mon Sep 17 00:00:00 2001 From: Gamelin Alexis <gamelin@synchrotron-soleil.fr> Date: Tue, 6 Apr 2021 12:27:40 +0200 Subject: [PATCH] Remove energy_change from Bunch Not needed any more due the SynchrotronRadiation change. --- tracking/particles.py | 25 ------------------------- tracking/rf.py | 6 +----- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/tracking/particles.py b/tracking/particles.py index 0833e8e..80b1e5d 100644 --- a/tracking/particles.py +++ b/tracking/particles.py @@ -86,11 +86,6 @@ class Bunch: coordinates. emit : array of shape (3,) Bunch emittance for each plane [1]. !!! -> Correct for long ? - energy_change : series of shape (alive,) - Store the particle relative energy change in the last turn. Only the - values for alive particles are returned. Used by the - SynchrotronRadiation class to compute radiation damping. To be changed - by Element objects which change the energy, for example RF cavities. Methods ------- @@ -128,8 +123,6 @@ class Bunch: self.current = current if not alive: self.alive = np.zeros((self.mp_number,),dtype=bool) - - self._energy_change = np.zeros((self.mp_number,),dtype=float) def __len__(self): """Return the number of alive particles""" @@ -243,24 +236,6 @@ class Bunch: (self.ring.optics.local_beta * np.mean(self['yp']**2)) return np.array((Jx,Jy)) - @property - def energy_change(self): - """Store the particle relative energy change in the last turn. Used by - the SynchrotronRadiation class to compute radiation damping. To be - changed by Element objects which change the energy, for example RF - cavities.""" - if self.track_alive is True: - return self._energy_change[self.alive] - else: - return self._energy_change - - @energy_change.setter - def energy_change(self, value): - if self.track_alive is True: - self._energy_change[self.alive] = value - else: - self._energy_change = value - def init_gaussian(self, cov=None, mean=None, **kwargs): """ Initialize bunch particles with 6D gaussian phase space. diff --git a/tracking/rf.py b/tracking/rf.py index b956380..b1fc605 100644 --- a/tracking/rf.py +++ b/tracking/rf.py @@ -44,12 +44,8 @@ class RFCavity(Element): ---------- bunch : Bunch or Beam object """ - energy_change = self.Vc / self.ring.E0 * np.cos( + bunch["delta"] += self.Vc / self.ring.E0 * np.cos( self.m * self.ring.omega1 * bunch["tau"] + self.theta ) - bunch["delta"] += energy_change - # energy_change is used by SynchrotronRadiation to compute radiation - # damping - bunch.energy_change += energy_change def value(self, val): return self.Vc / self.ring.E0 * np.cos( -- GitLab