Parameter Groups
AlignmentParams
Beamlines.AlignmentParams — Type
AlignmentParamsDescribe the alignment of the element with respect to the nominal position. Rotations are applied in order: tilt, x_rot, y_rot.
Properties
x_offset: Offset along x-axis [m]y_offset: Offset along y-axis [m]z_offset: Offset along z-axis [m]x_rot: Rotation around the x-axis [rad]y_rot: Rotation around the y-axis [rad]tilt: Rotation around the z-axis [rad]
ApertureParams
Beamlines.ApertureParams — Type
ApertureParamsDescribe a mechanical aperture.
Properties
x1_limit: Left x-axis aperture edge [m]x2_limit: Right x-axis aperture edge [m]y1_limit: Lower y-axis aperture edge [m]y2_limit: Upper y-axis aperture edge [m]aperture_shape: Shape of the aperture, seeApertureShapeaperture_at: Longitudinal aperture location(s), seeApertureAtaperture_shifts_with_body:trueif the aperture position moves with element alignment,falseotherwise. Default istrue
BMultipoleParams
Beamlines.BMultipoleParams — Type
BMultipoleParamsDefines magnetic (B) multipoles for an element.
A given multipole can be set using any of the following:
KnX: Order X normal strength in [1/m^(X+1)] (normalized, nonintegrated)KsX: Order X skew strength in [1/m^(X+1)] (normalized, nonintegrated)BnX: Order X normal strength in [T/m^X] (unnormalized, nonintegrated)BsX: Order X skew strength in [T/m^X] (unnormalized, nonintegrated)KnXL: Order X normal strength in [1/m^X] (normalized, integrated)KsXL: Order X skew strength in [1/m^X] (normalized, integrated)BnXL: Order X normal strength in [T/m^(X-1)] (unnormalized, integrated)BsXL: Order X skew strength in [T/m^(X-1)] (unnormalized, integrated)tiltX: Tilt to only order X multipole
The solenoidal multipole can be set using any of the above with X = sol and omitting the n/s, e.g. Ksol, Bsol, KsolL, BsolL.
The last set for a given multipole defines if both the normal and skew strengths for a given multipole order are normalized and integrated. E.g.
ele = LatElement(Kn1=0.1, Ks1=0.2, L=0.4) # Order 1 is normalized, nonintegrated
ele.Kn1L = 0.3 # Order 1 independent variables are now normalized, integrated
ele.Ks1L == 0.2*0.4 # true
ele.Bn1 = 0.5 # Order 1 independent variables are now unnormalized, nonintegrated
ele.Bs1 == 0.2*0.5/0.3 # true, set so that (Bs1/Bn1)_new = (Ks1L/Kn1L)_oldBeamlineParams
Beamlines.BeamlineParams — Type
BeamlineParamsDefines information for LatElements that are in a Beamline.
Properties
beamline:Beamlinethat thisLatElementis inbeamline_index: Index of thelinearray of theBeamlinethat this element is ats: Longitudinal position from the start of theBeamlineat the entrance of the element [m]s_downstream: Longitudinal position from the start of theBeamlineat the exit of the element [m]line: A read-only array ofLatElementsin the beamline, in ordercontext:Contextstruct containing control variables associated with the beamline. If in aBranch, this is shared by the wholeBranch(andLattice, if any), and setting it sets it for all of thembranch:Branchthat the beamline is placed in, if anybranch_index: Index of the beamline in theBranch, if in aBranch
BendParams
Beamlines.BendParams — Type
BendParamsDefines a curvature in the reference coordinate system throught the element, as well as the edge angles of the element at the entrance and exit of the element. Does not specify any magnetic field.
Properties
g_ref: Coordinate system curvature [1 / m]tilt_ref: Tilt angle applied before the curvature, and undone after [rad]e1: Edge angle of the entrance of the element w.r.t. the entering coordinate system [rad]e2: Edge angle of the exit of the element w.r.t. the exit coordinate system [rad]edge1_int: Pole face field integral at the entrance [m]edge2_int: Pole face field integral at the exit [m]
EMultipoleParams
Beamlines.EMultipoleParams — Type
EMultipoleParamsDefines electric (E) multipoles for an element.
A given multipole can be set using any of the following:
EnX: Order X normal strength in [V/m^(X+1)] (nonintegrated)EsX: Order X skew strength in [V/m^(X+1)] (nonintegrated)EnXL: Order X normal strength in [V/m^X] (integrated)EsXL: Order X skew strength in [V/m^X] (integrated)etiltX: Tilt to only order X multipole
FourPotentialParams
Beamlines.FourPotentialParams — Type
FourPotentialParamsDefines the electromagnetic four-potential of an element as a function four_potential(x, y, s, t, p=nothing) where p is a tuple of parameters that may be used inside the function.
Properties:
four_potential: Function with arguments(x, y, s, t, p=nothing)that returns a two component
tuple (C, D) with both C and D being themselves tuples:⠀ C = (ϕ, Ax, Ay, As)⠀ D = (∂ϕ/∂x, ∂ϕ/∂y, ∂ϕ/∂s, ∂ϕ/∂t, ⠀ ∂Ax/∂x, ∂Ax/∂y, ∂Ax/∂s, ∂Ax/∂t, ⠀ ∂Ay/∂x, ∂Ay/∂y, ∂Ay/∂s, ∂Ay/∂t, ⠀ ∂As/∂x, ∂As/∂y, ∂As/∂s, ∂As/∂t)
- four_potential_params: Tuple of parameters passed to the four_potential function. Default is nothing
four_potential_normalized: Iftrue, then potential/derivatives returned are normalized byp_over_q_ref; default isfalse.
IBSParams
Beamlines.IBSParams — Type
IBSParamsDefines intra-beam scattering modelling.
Properties
ibs_model: AIBSModelthat specifies which intra-beam scattering model is used
IgnoreParams
Beamlines.IgnoreParams — Type
IgnoreParamsHolds a list of parameter groups of a LatElement to be ignored, which allows parameter groups to be switched off without removing them from the element. Beamlines itself only stores the list: what ignoring a parameter group means is up to downstream code, such as tracking.
ele = Quadrupole(L=0.5, Kn1=0.3, x_offset=1e-3)
ele.ignore_params = [AlignmentParams] # Ignore the AlignmentParams
ele.ignore_params = [AlignmentParams, BMultipoleParams] # Also ignore the BMultipoleParams
ele.ignore_params = [] # Ignore nothingignore_params can also be set as a keyword argument, e.g. Quadrupole(L=0.5, Kn1=0.3, ignore_params=[BMultipoleParams]). The value must be a vector, even for a single parameter group, e.g. ele.ignore_params = [AlignmentParams].
Properties
ignore_params: List of parameter groups of the element to be ignored, e.g.[BMultipoleParams]
InitialBeamlineParams
Beamlines.InitialBeamlineParams — Type
InitialBeamlineParamsDefines the reference species and energy of the beamline. These parameters may be "set" in the first element of the beamline or at the Beamline level, and retrieved at any element in the beamline. If the reference species or energy is not set, then it will inherit that quantity from an upstream beamline if in a Branch.
Properties
species_ref: Reference species of the beamlineE_ref: Total reference energy [eV]pc_ref: Reference momentum [eV/c]p_over_q_ref: A signed reference magnetic rigidity [T * m]dE_ref: Change in total reference energy w.r.t. the directly-upstream beamline [eV]dpc_ref: Change in reference momentum w.r.t. the directly-upstream beamline [eV/c]dp_over_q_ref: Change in signed reference magnetic rigidty w.r.t. the directly-upstream beamline [T * m]
MapParams
Beamlines.MapParams — Type
MapParamsDefines any arbitrary function to transport particle coordinates' and optionally spin quaternions. This could be a matrix, a neural network, a phase trombone, etc.
The input for the transport_map must be (v, q, p=nothing), where v is a tuple of the input phase space coordinates (x, px, y, py, z, pz) and q is nothing is there is no spin tracking, else q is a tuple of the input quaternion (q0, q1, q2, q3). p may be a tuple of parameters that can be used inside of the transport_map. This might be neural network weights, for example, or perhaps phase evolutions for a phase trombone.
For GPU compatibility, it is necessary that your function transport_map is GPU compatible: there should be no type instabilities. You should also try to make your transport_map be branchless, so both the CPU and GPU can vectorize it.
transport_map_params should contain the tuple that is passed into p at the time of tracking.
Properties:
transport_map: Arbitrary function that transports particles' coordinatesv, and optionally spin quaternionsq. Must have the signature<your map name>(v, q, p=nothing)and returns the output as a tuple(v, q)transport_map_params: Parameters of the transport map that will be inputted as thepvariable intransport_map
Example
using StaticArrays
random_matrix = @SMatrix rand(6,6) # use StaticArrays for GPU compatibility
function matrix(v, q::Nothing, p) # `q::Nothing` -> no spin tracking
# Vectorizable matrix multiplication by `p`:
vx = sum(p[1,:] .* v)
vpx = sum(p[2,:] .* v)
vy = sum(p[3,:] .* v)
vpy = sum(p[4,:] .* v)
vz = sum(p[5,:] .* v)
vpz = sum(p[6,:] .* v)
return ((vx, vpx, vy, vpy, vz, vpz), q)
end
m = LatElement(transport_map=matrix, transport_map_params=random_matrix)MetaParams
Beamlines.MetaParams — Type
MetaParamsDefines extra String properties that may be useful for pattern matching or storing extra information about a given element.
Properties
alias: Alternate name for the element as a stringlabel: A label stringdescription: A descriptive string
PatchParams
Beamlines.PatchParams — Type
PatchParamsDefines properties for patches, which change the reference coordinate system. Rotations are applied in order: dz_rot, dx_rot, dy_rot.
Properties
dt: Reference time shift [s]dx: New coordinate system offset in the x-direction [m]dy: New coordinate system offset in the y-direction [m]dz: New coordinate system offset in the z-direction [m]dx_rot: Rotation of coordinate system around the initial x-axis [rad]dy_rot: Rotation of coordinate system around the initial y-axis [rad]dz_rot: Rotation of coordinate system around the initial z-axis [rad]
RFParams
Beamlines.RFParams — Type
RFParamsDefines parameters generally associated with radiofrequency (RF) cavities. The frequency of the oscillating electromagnetic field may be optionally specified using the property rf_frequency or harmon; whichever of these is set last will be the independent variable.
Properties
rf_frequency: Frequency of the oscillating electromagnetic field [Hz]harmon: Harmonic number of the oscillating electromagnetic field w.r.t. the length of the entire containingBeamline[1]phi0: Phase offset of the oscillating field w.r.t.zero_phase[rad]zero_phase: APhaseRefthat specifies whatphi0should mean, seePhaseReftraveling_wave:trueif traveling wave,falseif standing waveis_crabcavity:trueif this is a crab cavity,falseotherwise
UniversalParams
Beamlines.UniversalParams — Type
UniversalParamsDescribes the kind, name, length, and tracking method for a LatElement.
Properties
kind: String specifing the "kind", of an element, e.g. "Quadrupole"name: The name of an element as a stringL: Length of the element [m]fringe_at: AFringethat specifies which, if any, element ends should include fringe field modelling. Default isFringe.BothEndsn_steps: Number of integrator steps to take per element slice, default is 1ds_step: Length of each integrator step to take per element slice, such thatn_steps = ceil(L / n_slices / ds_step)n_slices: Number of slices to split the element into in tracking, typically so that collective effects can be applied multiple times in an element. If no collective effects are included, then prefer to varyn_steps/ds_stepinstead for performance.tracking_method: Tracking method for the elementrad_damping:trueif the deterministic effect of synchrotron radiation is included,falseotherwise. Defaults tofalserad_fluctuations:trueif the stochastic radiation kicks are included,falseotherwise. Defaults tofalse