-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d470732
commit 71d0e5b
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from __future__ import annotations | ||
|
||
import numpy | ||
import numpy as np | ||
|
||
__all__ = ["np", "twiss"] | ||
|
||
def twiss( | ||
beta_x: numpy.float64, | ||
beta_y: numpy.float64, | ||
beta_t: numpy.float64, | ||
emitt_x: numpy.float64, | ||
emitt_y: numpy.float64, | ||
emitt_t: numpy.float64, | ||
alpha_x: numpy.float64 = 0.0, | ||
alpha_y: numpy.float64 = 0.0, | ||
alpha_t: numpy.float64 = 0.0, | ||
): | ||
""" | ||
Helper function to convert Courant-Snyder / Twiss input into phase space ellipse input. | ||
:param beta_x: Beta function value (unit: meter) in the x dimension, must be a non-zero positive value. | ||
:param beta_y: Beta function value (unit: meter) in the y dimension, must be a non-zero positive value. | ||
:param beta_t: Beta function value (unit: meter) in the t dimension (arrival time differences multiplied by light speed), must be a non-zero positive value. | ||
:param emitt_x: Emittance value (unit: meter times radian) in the x dimension, must be a non-zero positive value. | ||
:param emitt_y: Emittance value (unit: meter times radian) in the y dimension, must be a non-zero positive value. | ||
:param emitt_t: Emittance value (unit: meter times radian) in the t dimension (arrival time differences multiplied by light speed), must be a non-zero positive value. | ||
:param alpha_x: Alpha function value () in the x dimension, default is 0.0. | ||
:param alpha_y: Alpha function value in the y dimension, default is 0.0. | ||
:param alpha_t: Alpha function value in the t dimension, default is 0.0. | ||
:return: A dictionary containing calculated phase space input: 'lambdaX', 'lambdaY', 'lambdaT', 'lambdaPx', 'lambdaPy', 'lambdaPt', 'muxpx', 'muypy', 'mutpt'. | ||
""" |