diff --git a/mbtrack2/tracking/particles.py b/mbtrack2/tracking/particles.py index 9dfd6910fb1baa41950d9dea10eaf7b4b3063740..1220a2422e1ae28b1a83f8ab77f59cd501937831 100644 --- a/mbtrack2/tracking/particles.py +++ b/mbtrack2/tracking/particles.py @@ -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