Skip to content
Snippets Groups Projects
Commit 272b5f7f authored by Alexis GAMELIN's avatar Alexis GAMELIN
Browse files

[Fix] Bunch.emit

Calculation was wrong for off center beams.
parent 5f94402c
No related branches found
No related tags found
No related merge requests found
......@@ -235,12 +235,13 @@ class Bunch:
"""
Return the bunch emittance for each plane.
"""
emitX = (np.mean(self['x']**2)*np.mean(self['xp']**2) -
np.mean(self['x']*self['xp'])**2)**(0.5)
emitY = (np.mean(self['y']**2)*np.mean(self['yp']**2) -
np.mean(self['y']*self['yp'])**2)**(0.5)
emitS = (np.mean(self['tau']**2)*np.mean(self['delta']**2) -
np.mean(self['tau']*self['delta'])**2)**(0.5)
cor = np.squeeze([[self[name] - self[name].mean()] for name in self])
emitX = np.sqrt(np.mean(cor[0]**2)*np.mean(cor[1]**2) -
np.mean(cor[0]*cor[1])**2)
emitY = np.sqrt(np.mean(cor[2]**2)*np.mean(cor[3]**2) -
np.mean(cor[2]*cor[3])**2)
emitS = np.sqrt(np.mean(cor[4]**2)*np.mean(cor[5]**2) -
np.mean(cor[4]*cor[5])**2)
return np.array([emitX, emitY, emitS])
@property
......
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