From c1a3690dfbee79913d419c56d888516b0a7117d6 Mon Sep 17 00:00:00 2001 From: Gamelin Alexis <gamelin@synchrotron-soleil.fr> Date: Fri, 23 Apr 2021 14:08:03 +0200 Subject: [PATCH] Optimise beam phasor init in non parallel case --- tracking/rf.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tracking/rf.py b/tracking/rf.py index 9fb4755..8b553c5 100644 --- a/tracking/rf.py +++ b/tracking/rf.py @@ -299,8 +299,18 @@ class CavityResonator(): bin_length = center[1]-center[0] charge_per_mp = beam.mpi.charge_per_mp_all[j] else: - # get bunch profile for current bunch - (bins, sorted_index, profile, center) = bunch.binning() + if i == 0: + # get bunch profile for current bunch + (bins, sorted_index, profile, center) = bunch.binning() + if j == 0: + self.profile_save = np.zeros((len(beam),len(profile),)) + self.center_save = np.zeros((len(beam),len(center),)) + self.profile_save[j,:] = profile + self.center_save[j,:] = center + else: + profile = self.profile_save[j,:] + center = self.center_save[j,:] + bin_length = center[1]-center[0] charge_per_mp = bunch.charge_per_mp -- GitLab