BeamState Class
Beam parameter control and output
Abstracted FLAME beam state class.
- class flame_utils.core.state.BeamState(s=None, **kws)[source]
Bases:
object
FLAME beam state, from which simulated results could be retrieved.
Class attributes of reference beam parameter:
float: longitudinally propagating position, [m]
float: speed in the unit of light velocity in vacuum of reference charge state, Lorentz beta, [1]
float: multiplication of beta and gamma of reference charge state, [1]
float: relativistic energy of reference charge state, Lorentz gamma, [1]
float: kinetic energy of reference charge state, [eV/u]
float: rest energy of reference charge state, [eV/u]
int: macro particle number of reference charge state, [1]
float: total energy of reference charge state, [eV/u], i.e. \(W = E_s + E_k\).
float: reference charge to mass ratio, e.g.
float: absolute synchrotron phase of reference charge state, [rad]
float: wave-vector in cavities with different beta values of reference charge state, [rad]
float: magnetic rigidity of reference charge state, [Tm]
Class attributes of actual beam parameter:
Array: speed in the unit of light velocity in vacuum of all charge states, Lorentz beta, [1]
Array: multiplication of beta and gamma of all charge states, [1]
Array: relativistic energy of all charge states, Lorentz gamma, [1]
Array: kinetic energy of all charge states, [eV/u]
Array: rest energy of all charge states, [eV/u]
Array: macro particle number of all charge states
Array: total energy of all charge states, [eV/u], i.e. \(W = E_s + E_k\).
Array: all charge to mass ratios
Array: absolute synchrotron phase of all charge states, [rad]
Array: wave-vector in cavities with different beta values of all charge states, [rad]
float: magnetic rigidity of reference charge state, [Tm]
Array: centroid for all charge states, array of
[x, x', y, y', phi, dEk, 1]
Array: rms beam envelope, part of statistical results from
moment1
.Array: weight average of centroid for all charge states, array of
[x, x', y, y', phi, dEk, 1]
, with the units of[mm, rad, mm, rad, rad, MeV/u, 1]
.Array: covariance matrices of all charge states, for each charge state, the covariance matrix could be written as:
Array: averaged covariance matrices of all charge states
float: weight average of all charge states for \(x\), [mm]
float: general rms beam envelope for \(x\), [mm]
float: weight average of all charge states for \(x'\), [rad]
float: general rms beam envelope for \(x'\), [rad]
float: weight average of all charge states for \(y\), [mm]
float: general rms beam envelope for \(y\), [mm]
float: weight average of all charge states for \(y'\), [rad]
float: general rms beam envelope for \(y'\), [rad]
float: weight average of all charge states for \(\phi\), [rad]
float: general rms beam envelope for \(\phi\), [rad]
float: weight average of all charge states for \(\delta E_k\), [MeV/u]
float: general rms beam envelope for \(\delta E_k\), [MeV/u]
Array: x centroid for all charge states, [mm]
Array: general rms beam envelope for \(x\) of all charge states, [mm]
Array: x centroid divergence for all charge states, [rad]
Array: general rms beam envelope for \(x'\) of all charge states, [rad]
Array: y centroid for all charge states, [mm]
Array: general rms beam envelope for \(y\) of all charge states, [mm]
Array: y centroid divergence for all charge states, [rad]
Array: general rms beam envelope for \(y'\) of all charge states, [rad]
Array: longitudinal beam length, measured in RF frequency for all charge states, [rad]
Array: general rms beam envelope for \(\phi\) of all charge states, [rad]
Array: kinetic energy deviation w.r.t.
Array: general rms beam envelope for \(\delta E_k\) of all charge states, [MeV/u]
float: weight average of geometrical x emittance, [mm-mrad]
float: weight average of normalized x emittance, [mm-mrad]
float: weight average of geometrical y emittance, [mm-mrad]
float: weight average of normalized y emittance, [mm-mrad]
float: weight average of geometrical z emittance, [rad-MeV/u]
float: weight average of normalized z emittance, [rad-MeV/u]
Array: geometrical x emittance of all charge states, [mm-mrad]
Array: normalized x emittance of all charge states, [mm-mrad]
Array: geometrical y emittance of all charge states, [mm-mrad]
Array: normalized y emittance of all charge states, [mm-mrad]
Array: geometrical z emittance of all charge states, [rad-MeV/u]
Array: normalized z emittance of all charge states, [rad-MeV/u]
float: weight average of twiss beta x, [m/rad]
float: weight average of twiss alpha x, [1]
float: weight average of twiss gamma x, [rad/m]
float: weight average of twiss beta y, [m/rad]
float: weight average of twiss alpha y, [1]
float: weight average of twiss gamma y, [rad/m]
float: weight average of twiss beta z, [rad/MeV/u]
float: weight average of twiss alpha z, [1]
float: weight average of twiss gamma z, [MeV/u/rad]
Array: twiss beta x of all charge states, [m/rad]
Array: twiss alpha x of all charge states, [1]
Array: twiss gamma x of all charge states, [rad/m]
Array: twiss beta y of all charge states, [m/rad]
Array: twiss alpha y of all charge states, [1]
Array: twiss gamma y of all charge states, [rad/m]
Array: twiss beta z of all charge states, [rad/MeV/u]
Array: twiss alpha z of all charge states, [1]
Array: twiss gamma z of all charge states, [MeV/u/rad]
float: weight average of normalized x-y coupling term, [1]
float: weight average of normalized xp-y coupling term, [1]
float: weight average of normalized x-yp coupling term, [1]
float: weight average of normalized xp-yp coupling term, [1]
Array: normalized x-y coupling term of all charge states, [1]
Array: normalized xp-y coupling term of all charge states, [1]
Array: normalized x-yp coupling term of all charge states, [1]
Array: normalized xp-yp coupling term of all charge states, [1]
float: Last RF cavity's driven phase, [deg]
Array: Transfer matrix of the last element
Configuration methods
clone
()Return a copy of Beamstate object.
set_twiss
(coor[, alpha, beta, rmssize, ...])Set moment1 matrix by using Twiss parameter.
get_twiss
(coor[, cs])Get twiss parameters of moment1 matrix
set_couple
(coor1, coor2[, value, cs])Set normalized coupling term of moment1 matrix
get_couple
(coor1, coor2[, cs])Get normalized coupling term of moment1 matrix
- Parameters
- s :
FLAME state object Created by allocState()
- bmstate :
BeamState object, priority: high
- machine :
FLAME machine object, priority: middle
- latfile :
FLAME lattice file name, priority: low
Notes
If more than one keyword parameters are provided, the selection policy follows the priority from high to low.
If only
s
is assigned with all-zeros states (usually created byallocState({})
method), then please note that this state can only propagate from the first element, i.e.SOURCE
(from_element
parameter ofrun()
orpropagate()
should be 0), or errors happen; the better initialization should be passing one of keyword parameters ofmachine
andlatfile
to initialize the state to be significant for thepropagate()
method.These attributes are only valid for the case of
sim_type
being defined asMomentMatrix
, which is de facto the exclusive option used at FRIB.If the attribute is an array, new array value should be assigned instead of by element indexing way, e.g.
>>> bs = BeamState(s) >>> print(bs.moment0) array([[ -7.88600000e-04], [ 1.08371000e-05], [ 1.33734000e-02], [ 6.67853000e-06], [ -1.84773000e-04], [ 3.09995000e-04], [ 1.00000000e+00]]) >>> # the right way to just change the first element of the array >>> m_tmp = bs.moment0 >>> m_tmp[0] = 0 >>> bs.moment0 = m_tmp >>> print(bs.moment0) array([[ 0.00000000e+00], [ 1.08371000e-05], [ 1.33734000e-02], [ 6.67853000e-06], [ -1.84773000e-04], [ 3.09995000e-04], [ 1.00000000e+00]]) >>> # while this way does not work: ms.moment0[0] = 0
- property state
flame._internal.State: FLAME state object, also could be initialized with BeamState object
- property pos
float: longitudinally propagating position, [m]
- property ref_beta
float: speed in the unit of light velocity in vacuum of reference charge state, Lorentz beta, [1]
- property ref_bg
float: multiplication of beta and gamma of reference charge state, [1]
- property ref_gamma
float: relativistic energy of reference charge state, Lorentz gamma, [1]
- property ref_IonEk
float: kinetic energy of reference charge state, [eV/u]
- property ref_IonEs
float: rest energy of reference charge state, [eV/u]
- property ref_IonQ
int: macro particle number of reference charge state, [1]
- property ref_IonW
float: total energy of reference charge state, [eV/u], i.e. \(W = E_s + E_k\)
- property ref_IonZ
float: reference charge to mass ratio, e.g. \(^{33^{+}}_{238}U: Q(33)/A(238)\), [Q/A]
- property ref_phis
float: absolute synchrotron phase of reference charge state, [rad]
- property ref_SampleIonK
float: wave-vector in cavities with different beta values of reference charge state, [rad]
- property ref_SampleFreq
float: sampling frequency of reference charge state, [Hz]
- property ref_Brho
float: magnetic rigidity of reference charge state, [Tm]
- property beta
Array: speed in the unit of light velocity in vacuum of all charge states, Lorentz beta, [1]
- property bg
Array: multiplication of beta and gamma of all charge states, [1]
- property gamma
Array: relativistic energy of all charge states, Lorentz gamma, [1]
- property IonEk
Array: kinetic energy of all charge states, [eV/u]
- property IonEs
Array: rest energy of all charge states, [eV/u]
- property IonQ
Array: macro particle number of all charge states
Notes
This is what
NCharge
means in the FLAME lattice file.
- property IonW
Array: total energy of all charge states, [eV/u], i.e. \(W = E_s + E_k\)
- property IonZ
Array: all charge to mass ratios
Notes
This is what
IonChargeStates
means in the FLAME lattice file.
- property phis
Array: absolute synchrotron phase of all charge states, [rad]
- property SampleIonK
Array: wave-vector in cavities with different beta values of all charge states, [rad]
- property SampleFreq
Array: sampling frequency of all charge states, [Hz]
- property Brho
float: magnetic rigidity of reference charge state, [Tm]
- property moment0_env
Array: weight average of centroid for all charge states, array of
[x, x', y, y', phi, dEk, 1]
, with the units of[mm, rad, mm, rad, rad, MeV/u, 1]
.Notes
The physics meanings for each column are:
x
: x position in transverse plane;x'
: x divergence;y
: y position in transverse plane;y'
: y divergence;phi
: longitudinal beam length, measured in RF frequency;dEk
: kinetic energy deviation w.r.t. reference charge state;1
: should be always 1, for the convenience of handling corrector (i.e.orbtrim
element)
- property moment0_rms
Array: rms beam envelope, part of statistical results from
moment1
.See also
moment1
covariance matrices of all charge states
Notes
The square of
moment0_rms
should be equal to the diagonal elements ofmoment1
.
- property moment0
Array: centroid for all charge states, array of
[x, x', y, y', phi, dEk, 1]
- property moment1
Array: covariance matrices of all charge states, for each charge state, the covariance matrix could be written as:
\[\begin{split}\begin{array}{ccccccc} \color{red}{\left<x \cdot x\right>} & \left<x \cdot x'\right> & \left<x \cdot y\right> & \left<x \cdot y'\right> & \left<x \cdot \phi\right> & \left<x \cdot \delta E_k\right> & 0 \\ \left<x'\cdot x\right> & \color{red}{\left<x'\cdot x'\right>} & \left<x'\cdot y\right> & \left<x'\cdot y'\right> & \left<x'\cdot \phi\right> & \left<x'\cdot \delta E_k\right> & 0 \\ \left<y \cdot x\right> & \left<y \cdot x'\right> & \color{red}{\left<y \cdot y\right>} & \left<y \cdot y'\right> & \left<y \cdot \phi\right> & \left<y \cdot \delta E_k\right> & 0 \\ \left<y'\cdot x\right> & \left<y'\cdot x'\right> & \left<y'\cdot y\right> & \color{red}{\left<y'\cdot y'\right>} & \left<y'\cdot \phi\right> & \left<y'\cdot \delta E_k\right> & 0 \\ \left<\phi \cdot x\right> & \left<\phi \cdot x'\right> & \left<\phi \cdot y\right> & \left<\phi \cdot y'\right> & \color{red}{\left<\phi \cdot \phi\right>} & \left<\phi \cdot \delta E_k\right> & 0 \\ \left<\delta E_k \cdot x\right> & \left<\delta E_k \cdot x'\right> & \left<\delta E_k \cdot y\right> & \left<\delta E_k \cdot y'\right> & \left<\delta E_k \cdot \phi\right> & \color{red}{\left<\delta E_k \cdot \delta E_k\right>} & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{array}\end{split}\]
- property moment1_env
Array: averaged covariance matrices of all charge states
- property x0
Array: x centroid for all charge states, [mm]
- property xp0
Array: x centroid divergence for all charge states, [rad]
- property y0
Array: y centroid for all charge states, [mm]
- property yp0
Array: y centroid divergence for all charge states, [rad]
- property phi0
Array: longitudinal beam length, measured in RF frequency for all charge states, [rad]
- property dEk0
Array: kinetic energy deviation w.r.t. reference charge state, for all charge states, [MeV/u]
- property x0_env
float: weight average of all charge states for \(x\), [mm]
- property xp0_env
float: weight average of all charge states for \(x'\), [rad]
- property y0_env
float: weight average of all charge states for \(y\), [mm]
- property yp0_env
float: weight average of all charge states for \(y'\), [rad]
- property phi0_env
float: weight average of all charge states for \(\phi\), [rad]
- property dEk0_env
float: weight average of all charge states for \(\delta E_k\), [MeV/u]
- property xrms_all
Array: general rms beam envelope for \(x\) of all charge states, [mm]
- property xprms_all
Array: general rms beam envelope for \(x'\) of all charge states, [rad]
- property yrms_all
Array: general rms beam envelope for \(y\) of all charge states, [mm]
- property yprms_all
Array: general rms beam envelope for \(y'\) of all charge states, [rad]
- property phirms_all
Array: general rms beam envelope for \(\phi\) of all charge states, [rad]
- property dEkrms_all
Array: general rms beam envelope for \(\delta E_k\) of all charge states, [MeV/u]
- property x0_rms
float: general rms beam envelope for \(x\), [mm]
- property xp0_rms
float: general rms beam envelope for \(x'\), [rad]
- property y0_rms
float: general rms beam envelope for \(y\), [mm]
- property yp0_rms
float: general rms beam envelope for \(y'\), [rad]
- property phi0_rms
float: general rms beam envelope for \(\phi\), [rad]
- property dEk0_rms
float: general rms beam envelope for \(\delta E_k\), [MeV/u]
- property last_caviphi0
float: Last RF cavity’s driven phase, [deg]
- property transfer_matrix
Array: Transfer matrix of the last element
- property xemittance
float: weight average of geometrical x emittance, [mm-mrad]
- property yemittance
float: weight average of geometrical y emittance, [mm-mrad]
- property zemittance
float: weight average of geometrical z emittance, [rad-MeV/u]
- property xemittance_all
Array: geometrical x emittance of all charge states, [mm-mrad]
- property yemittance_all
Array: geometrical y emittance of all charge states, [mm-mrad]
- property zemittance_all
Array: geometrical z emittance of all charge states, [rad-MeV/u]
- property xnemittance
float: weight average of normalized x emittance, [mm-mrad]
- property ynemittance
float: weight average of normalized y emittance, [mm-mrad]
- property znemittance
float: weight average of normalized z emittance, [rad-MeV/u]
- property xnemittance_all
Array: normalized x emittance of all charge states, [mm-mrad]
- property ynemittance_all
Array: normalized y emittance of all charge states, [mm-mrad]
- property znemittance_all
Array: normalized z emittance of all charge states, [rad-MeV/u]
- property xtwiss_beta
float: weight average of twiss beta x, [m/rad]
- property ytwiss_beta
float: weight average of twiss beta y, [m/rad]
- property ztwiss_beta
float: weight average of twiss beta z, [rad/MeV/u]
- property xtwiss_beta_all
Array: twiss beta x of all charge states, [m/rad]
- property ytwiss_beta_all
Array: twiss beta y of all charge states, [m/rad]
- property ztwiss_beta_all
Array: twiss beta z of all charge states, [rad/MeV/u]
- property xtwiss_alpha
float: weight average of twiss alpha x, [1]
- property beammatrix
Array: averaged covariance matrices of all charge states
- property beammatrix_all
Array: covariance matrices of all charge states, for each charge state, the covariance matrix could be written as:
\[\begin{split}\begin{array}{ccccccc} \color{red}{\left<x \cdot x\right>} & \left<x \cdot x'\right> & \left<x \cdot y\right> & \left<x \cdot y'\right> & \left<x \cdot \phi\right> & \left<x \cdot \delta E_k\right> & 0 \\ \left<x'\cdot x\right> & \color{red}{\left<x'\cdot x'\right>} & \left<x'\cdot y\right> & \left<x'\cdot y'\right> & \left<x'\cdot \phi\right> & \left<x'\cdot \delta E_k\right> & 0 \\ \left<y \cdot x\right> & \left<y \cdot x'\right> & \color{red}{\left<y \cdot y\right>} & \left<y \cdot y'\right> & \left<y \cdot \phi\right> & \left<y \cdot \delta E_k\right> & 0 \\ \left<y'\cdot x\right> & \left<y'\cdot x'\right> & \left<y'\cdot y\right> & \color{red}{\left<y'\cdot y'\right>} & \left<y'\cdot \phi\right> & \left<y'\cdot \delta E_k\right> & 0 \\ \left<\phi \cdot x\right> & \left<\phi \cdot x'\right> & \left<\phi \cdot y\right> & \left<\phi \cdot y'\right> & \color{red}{\left<\phi \cdot \phi\right>} & \left<\phi \cdot \delta E_k\right> & 0 \\ \left<\delta E_k \cdot x\right> & \left<\delta E_k \cdot x'\right> & \left<\delta E_k \cdot y\right> & \left<\delta E_k \cdot y'\right> & \left<\delta E_k \cdot \phi\right> & \color{red}{\left<\delta E_k \cdot \delta E_k\right>} & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{array}\end{split}\]
- property cenvector
Array: weight average of centroid for all charge states, array of
[x, x', y, y', phi, dEk, 1]
, with the units of[mm, rad, mm, rad, rad, MeV/u, 1]
.Notes
The physics meanings for each column are:
x
: x position in transverse plane;x'
: x divergence;y
: y position in transverse plane;y'
: y divergence;phi
: longitudinal beam length, measured in RF frequency;dEk
: kinetic energy deviation w.r.t. reference charge state;1
: should be always 1, for the convenience of handling corrector (i.e.orbtrim
element)
- property cenvector_all
Array: centroid for all charge states, array of
[x, x', y, y', phi, dEk, 1]
- property cxpy
float: weight average of normalized xp-y coupling term, [1]
- property cxpy_all
Array: normalized xp-y coupling term of all charge states, [1]
- property cxpyp
float: weight average of normalized xp-yp coupling term, [1]
- property cxpyp_all
Array: normalized xp-yp coupling term of all charge states, [1]
- property cxy
float: weight average of normalized x-y coupling term, [1]
- property cxy_all
Array: normalized x-y coupling term of all charge states, [1]
- property cxyp
float: weight average of normalized x-yp coupling term, [1]
- property cxyp_all
Array: normalized x-yp coupling term of all charge states, [1]
- property dEkcen
float: weight average of all charge states for \(\delta E_k\), [MeV/u]
- property dEkcen_all
Array: kinetic energy deviation w.r.t. reference charge state, for all charge states, [MeV/u]
- property dEkrms
float: general rms beam envelope for \(\delta E_k\), [MeV/u]
- property phicen
float: weight average of all charge states for \(\phi\), [rad]
- property phicen_all
Array: longitudinal beam length, measured in RF frequency for all charge states, [rad]
- property phirms
float: general rms beam envelope for \(\phi\), [rad]
- property rmsvector
Array: rms beam envelope, part of statistical results from
moment1
.See also
moment1
covariance matrices of all charge states
Notes
The square of
moment0_rms
should be equal to the diagonal elements ofmoment1
.
- property transmat
Array: Transfer matrix of the last element
- property xcen
float: weight average of all charge states for \(x\), [mm]
- property xcen_all
Array: x centroid for all charge states, [mm]
- property xeps
float: weight average of geometrical x emittance, [mm-mrad]
- property xeps_all
Array: geometrical x emittance of all charge states, [mm-mrad]
- property xepsn
float: weight average of normalized x emittance, [mm-mrad]
- property xepsn_all
Array: normalized x emittance of all charge states, [mm-mrad]
- property xpcen
float: weight average of all charge states for \(x'\), [rad]
- property xpcen_all
Array: x centroid divergence for all charge states, [rad]
- property xprms
float: general rms beam envelope for \(x'\), [rad]
- property xrms
float: general rms beam envelope for \(x\), [mm]
- property xtwsa
float: weight average of twiss alpha x, [1]
- property xtwsa_all
Array: twiss alpha x of all charge states, [1]
- property xtwsb
float: weight average of twiss beta x, [m/rad]
- property xtwsb_all
Array: twiss beta x of all charge states, [m/rad]
- property xtwsg
float: weight average of twiss gamma x, [rad/m]
- property xtwsg_all
Array: twiss gamma x of all charge states, [rad/m]
- property ycen
float: weight average of all charge states for \(y\), [mm]
- property ycen_all
Array: y centroid for all charge states, [mm]
- property yeps
float: weight average of geometrical y emittance, [mm-mrad]
- property yeps_all
Array: geometrical y emittance of all charge states, [mm-mrad]
- property yepsn
float: weight average of normalized y emittance, [mm-mrad]
- property yepsn_all
Array: normalized y emittance of all charge states, [mm-mrad]
- property ypcen
float: weight average of all charge states for \(y'\), [rad]
- property ypcen_all
Array: y centroid divergence for all charge states, [rad]
- property yprms
float: general rms beam envelope for \(y'\), [rad]
- property yrms
float: general rms beam envelope for \(y\), [mm]
- property ytwiss_alpha
float: weight average of twiss alpha y, [1]
- property ytwsa
float: weight average of twiss alpha y, [1]
- property ytwsa_all
Array: twiss alpha y of all charge states, [1]
- property ytwsb
float: weight average of twiss beta y, [m/rad]
- property ytwsb_all
Array: twiss beta y of all charge states, [m/rad]
- property ytwsg
float: weight average of twiss gamma y, [rad/m]
- property ytwsg_all
Array: twiss gamma y of all charge states, [rad/m]
- property zcen
float: weight average of all charge states for \(\phi\), [rad]
- property zcen_all
Array: longitudinal beam length, measured in RF frequency for all charge states, [rad]
- property zeps
float: weight average of geometrical z emittance, [rad-MeV/u]
- property zeps_all
Array: geometrical z emittance of all charge states, [rad-MeV/u]
- property zepsn
float: weight average of normalized z emittance, [rad-MeV/u]
- property zepsn_all
Array: normalized z emittance of all charge states, [rad-MeV/u]
- property zpcen
float: weight average of all charge states for \(\delta E_k\), [MeV/u]
- property zpcen_all
Array: kinetic energy deviation w.r.t. reference charge state, for all charge states, [MeV/u]
- property zprms
float: general rms beam envelope for \(\delta E_k\), [MeV/u]
- property zprms_all
Array: general rms beam envelope for \(\delta E_k\) of all charge states, [MeV/u]
- property zrms
float: general rms beam envelope for \(\phi\), [rad]
- property zrms_all
Array: general rms beam envelope for \(\phi\) of all charge states, [rad]
- property ztwsa
float: weight average of twiss alpha z, [1]
- property ztwsa_all
Array: twiss alpha z of all charge states, [1]
- property ztwsb
float: weight average of twiss beta z, [rad/MeV/u]
- property ztwsb_all
Array: twiss beta z of all charge states, [rad/MeV/u]
- property ztwsg
float: weight average of twiss gamma z, [MeV/u/rad]
- property ztwsg_all
Array: twiss gamma z of all charge states, [MeV/u/rad]
- property ztwiss_alpha
float: weight average of twiss alpha z, [1]
- property xtwiss_alpha_all
Array: twiss alpha x of all charge states, [1]
- property ytwiss_alpha_all
Array: twiss alpha y of all charge states, [1]
- property ztwiss_alpha_all
Array: twiss alpha z of all charge states, [1]
- property xtwiss_gamma
float: weight average of twiss gamma x, [rad/m]
- property ytwiss_gamma
float: weight average of twiss gamma y, [rad/m]
- property ztwiss_gamma
float: weight average of twiss gamma z, [MeV/u/rad]
- property xtwiss_gamma_all
Array: twiss gamma x of all charge states, [rad/m]
- property ytwiss_gamma_all
Array: twiss gamma y of all charge states, [rad/m]
- property ztwiss_gamma_all
Array: twiss gamma z of all charge states, [MeV/u/rad]
- property couple_xy
float: weight average of normalized x-y coupling term, [1]
- property couple_xpy
float: weight average of normalized xp-y coupling term, [1]
- property couple_xyp
float: weight average of normalized x-yp coupling term, [1]
- property couple_xpyp
float: weight average of normalized xp-yp coupling term, [1]
- property couple_xy_all
Array: normalized x-y coupling term of all charge states, [1]
- property couple_xpy_all
Array: normalized xp-y coupling term of all charge states, [1]
- property couple_xyp_all
Array: normalized x-yp coupling term of all charge states, [1]
- property couple_xpyp_all
Array: normalized xp-yp coupling term of all charge states, [1]
- set_twiss(coor, alpha=None, beta=None, rmssize=None, emittance=None, nemittance=None, cs=0)[source]
Set moment1 matrix by using Twiss parameter.
- Parameters
- coorstr
Coordinate of the twiss parameter, ‘x’, ‘y’, or ‘z’.
- alphafloat
Twiss alpha, [1].
- betafloat
Twiss beta, [m/rad] for ‘x’ and ‘y’, [rad/MeV/u] for ‘z’.
- rmssizefloat
RMS size of the real space, [mm] of ‘x’ and ‘y’, [rad] for ‘z’.
- emittancefloat
Geometrical (Unnormalized) emittance, [mm-mrad] for ‘x’ and ‘y’, [rad-MeV/u] for ‘z’.
- nemittancefloat
Normalized emittance, [mm-mrad] for ‘x’ and ‘y’, [rad-MeV/u] for ‘z’.
- csint
Index of the charge state to set parameter.
Notes
‘nemittance’ is ignored if both ‘emittance’ and ‘nemittance’ are input.
- get_twiss(coor, cs=0)[source]
Get twiss parameters of moment1 matrix
- Parameters
- coorstr
Coordinate of the twiss parameter, ‘x’, ‘y’, or ‘z’.
- csint
Index of the charge state (-1 for weight average of all charge states).
- Returns
- twissarray
Twiss [alpha, beta, gamma] of the beam.
- get_couple(coor1, coor2, cs=0)[source]
Get normalized coupling term of moment1 matrix
- Parameters
- coor1str
First coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- coor2str
Second coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- csint
Index of the charge state (-1 for weight average of all charge states).
- Returns
- termfloat
Normalized coupling term of
coor1
andcoor2
ofcs
-th charge state.
- set_couple(coor1, coor2, value=0.0, cs=0)[source]
Set normalized coupling term of moment1 matrix
- Parameters
- coor1str
First coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- coor2str
Second coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- valuefloat
Normalized coupling term, (-1 ~ +1) [1].
- csint
Index of the charge state.
- flame_utils.core.state.generate_source(state, sconf=None)[source]
Generate/Update FLAME source element from FLAME beam state object.
- Parameters
- state :
BeamState object, (also accept FLAME internal State object).
- sconfdict
Configuration of source element, if None, generate new one from state.
- Returns
- retdict
FLAME source element configuration.
See also
get_element
Get element from FLAME machine or lattice.
Notes
All zeros state may not produce reasonable result, for this case, the recommended way is to create a BeamState object with latfile or machine keyword parameter, e.g. s = BeamState(s0, machine=m), then use s as the input of generate_source.
- flame_utils.core.state.get_brho(k, z)[source]
Get magnetic rigidity
- Parameters
- kfloat
Kinetic energy [eV/u]
- zfloat
Charge to mass ratio, Q/A [1].
- Returns
- brhofloat
Magnetic rigidity [Tm].
- flame_utils.core.state.get_couple(matrix, coor1, coor2)[source]
Get normalized coupling term of moment1 matrix
- Parameters
- matrixArray
Covariance matrix of the beam.
- coor1str
First Coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- coor2str
Second Coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- Returns
- termfloat
Normalized coupling term of
coor1
andcoor2
ofcs
-th charge state.
- flame_utils.core.state.set_couple(matrix, coor1, coor2, value=0.0)[source]
Set normalized coupling term of moment1 matrix
- Parameters
- matrixArray
Covariance matrix of the beam.
- coor1str
First Coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- coor2str
Second Coordinate of the coupling term, ‘x’, xp, ‘y’, ‘yp’, ‘z’, or ‘zp’.
- valuefloat
Normalized coupling term, (-1 ~ +1) [1].
- flame_utils.core.state.twiss_to_matrix(coor, alpha, beta, emittance, matrix=None)[source]
Set covariance matrix by using Twiss parameter.
- Parameters
- coorstr
Coordinate of the twiss parameter, ‘x’, ‘y’, or ‘z’.
- alphafloat
Twiss alpha, [1].
- betafloat
Twiss beta, [m/rad] for ‘x’ and ‘y’, [rad/MeV/u] for ‘z’.
- emittancefloat
Geometrical (Unnormalized) emittance, [mm-mrad] for ‘x’ and ‘y’, [rad-MeV/u] for ‘z’.
- matrixArray
Original covariance matrix of the beam