Skip to content
Snippets Groups Projects
Commit 82e0eea7 authored by Gamelin Alexis's avatar Gamelin Alexis
Browse files

Correct case when where is no mp in the bin

Correct case when where is no mp in the bin
Remove useless test
parent 9be14b74
No related branches found
No related tags found
No related merge requests found
......@@ -219,13 +219,16 @@ class CavityResonator():
for i, center0 in enumerate(center):
mp_per_bin = profile[i]
if index == self.bunch_index:
ind = (sorted_index == i)
Vgene = self.Vg*np.cos(self.m*self.ring.omega1*bunch["tau"][ind] + self.theta_g)
Vbeam = np.real(self.beam_phasor)
Vtot = Vgene + Vbeam - charge_per_mp*self.loss_factor*mp_per_bin
energy_change[ind] = Vtot / self.ring.E0
if mp_per_bin == 0:
self.phasor_decay(bin_length)
continue
ind = (sorted_index == i)
Vgene = self.Vg*np.cos(self.m*self.ring.omega1*bunch["tau"][ind] + self.theta_g)
Vbeam = np.real(self.beam_phasor)
Vtot = Vgene + Vbeam - charge_per_mp*self.loss_factor*mp_per_bin
energy_change[ind] = Vtot / self.ring.E0
self.phasor_decay(bin_length)
self.beam_phasor -= 2*charge_per_mp*self.loss_factor*mp_per_bin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment