@@ -19,6 +19,16 @@ def twiss(
1919 alpha_x : numpy .float64 = 0.0 ,
2020 alpha_y : numpy .float64 = 0.0 ,
2121 alpha_t : numpy .float64 = 0.0 ,
22+ mean_x : numpy .float64 = 0.0 ,
23+ mean_y : numpy .float64 = 0.0 ,
24+ mean_t : numpy .float64 = 0.0 ,
25+ mean_px : numpy .float64 = 0.0 ,
26+ mean_py : numpy .float64 = 0.0 ,
27+ mean_pt : numpy .float64 = 0.0 ,
28+ dispersion_x : numpy .float64 = 0.0 ,
29+ dispersion_y : numpy .float64 = 0.0 ,
30+ dispersion_px : numpy .float64 = 0.0 ,
31+ dispersion_py : numpy .float64 = 0.0 ,
2232):
2333 """
2434 Helper function to convert Courant-Snyder / Twiss input into phase space ellipse input.
@@ -32,6 +42,16 @@ def twiss(
3242 :param alpha_x: Alpha function value () in the x dimension, default is 0.0.
3343 :param alpha_y: Alpha function value in the y dimension, default is 0.0.
3444 :param alpha_t: Alpha function value in the t dimension, default is 0.0.
45+ :param mean_x: offset of the mean (centroid) position in x from that of the reference particle
46+ :param mean_y: offset of the mean (centroid) position in y from that of the reference particle
47+ :param mean_t: offset of the mean (centroid) position in t from that of the reference particle
48+ :param mean_px: offset of the mean (centroid) momentum in x from that of the reference particle
49+ :param mean_py: offset of the mean (centroid) momentum in y from that of the reference particle
50+ :param mean_pt: offset of the mean (centroid) momentum in t from that of the reference particle
51+ :param dispersion_x: dispersion and its derivative in horizontal and vertical directions
52+ :param dispersion_y: dispersion and its derivative in horizontal and vertical directions
53+ :param dispersion_px: dispersion and its derivative in horizontal and vertical directions
54+ :param dispersion_py: dispersion and its derivative in horizontal and vertical directions
3555 :return: A dictionary containing calculated phase space input: 'lambdaX', 'lambdaY', 'lambdaT', 'lambdaPx', 'lambdaPy', 'lambdaPt', 'muxpx', 'muypy', 'mutpt'.
3656 """
3757 import numpy as np
@@ -65,4 +85,14 @@ def twiss(
6585 "muxpx" : alpha_x / np .sqrt (beta_x * gamma_x ),
6686 "muypy" : alpha_y / np .sqrt (beta_y * gamma_y ),
6787 "mutpt" : alpha_t / np .sqrt (beta_t * gamma_t ),
88+ "meanX" : mean_x ,
89+ "meanY" : mean_y ,
90+ "meanT" : mean_t ,
91+ "meanPx" : mean_px ,
92+ "meanPy" : mean_py ,
93+ "meanPt" : mean_pt ,
94+ "dispX" : dispersion_x ,
95+ "dispY" : dispersion_y ,
96+ "dispPx" : dispersion_px ,
97+ "dispPy" : dispersion_py ,
6898 }
0 commit comments