Track Methods

Utility functions for creating transfer maps for the elements.

track_methods.base_rmatrix(length: Tensor, k1: Tensor, hx: Tensor, tilt: Tensor | None = None, energy: Tensor | None = None) Tensor

Create a universal transfer matrix for a beamline element.

Parameters:
  • length – Length of the element in m.

  • k1 – Quadrupole strength in 1/m**2.

  • hx – Curvature (1/radius) of the element in 1/m**2.

  • tilt – Roation of the element relative to the longitudinal axis in rad.

  • energy – Beam energy in eV.

Returns:

Transfer matrix for the element.

track_methods.misalignment_matrix(misalignment: Tensor) tuple[Tensor, Tensor]

Shift the beam for tracking beam through misaligned elements

track_methods.rotation_matrix(angle: Tensor) Tensor

Rotate the transfer map in x-y plane

Parameters:

angle – Rotation angle in rad, for example angle = np.pi/2 for vertical = dipole.

Returns:

Rotation matrix to be multiplied to the element’s transfer matrix.