at.physics.matrix#

transfer matrix related functions

A collection of functions to compute 4x4 and 6x6 transfer matrices

Functions

find_m44(ring[, dp, refpts, dct, df, orbit, ...])

One turn 4x4 transfer matrix

find_m66(ring[, refpts, orbit, keep_lattice])

One-turn 6x6 transfer matrix

find_elem_m66(elem[, orbit])

Single element 6x6 transfer matrix

gen_m66_elem(ring, o4b, o4e)

Converts a ring to a linear 6x6 matrix

find_elem_m66(elem, orbit=None, **kwargs)[source]#

Single element 6x6 transfer matrix

Numerically finds the 6x6 transfer matrix of a single element

Parameters:
  • elem (Element) – AT element

  • orbit (ndarray | None) – Closed orbit at the entrance of the element, default: 0.0

Keyword Arguments:
  • XYStep (float) – Step size. Default: DConstant.XYStep

  • particle (Particle) – circulating particle. Default: lattice.particle if existing, otherwise Particle('relativistic')

  • energy (float) – lattice energy. Default 0.

Returns:

m66 – 6x6 transfer matrix

find_m44(ring, dp=None, refpts=None, dct=None, df=None, orbit=None, keep_lattice=False, **kwargs)[source]#

One turn 4x4 transfer matrix

find_m44() finds the 4x4 transfer matrix of an accelerator lattice by differentiation of trajectories near the closed orbit.

Important

find_m44() assumes constant momentum deviation. The PassMethod used for any element SHOULD NOT:

  1. change the longitudinal momentum dP (cavities , magnets with radiation, …)

  2. have any time dependence (localized impedance, fast kickers, …)

Unless an input orbit is introduced, find_m44() assumes that the lattice is a ring and first finds the closed orbit.

Parameters:
  • ring (Lattice) – Lattice description (radiation must be OFF)

  • dp (float | None) – Momentum deviation.

  • refpts (Type[Element] | Element | Callable[[Element], bool] | str | None | int | Sequence[int] | bool | Sequence[bool] | RefptsCode) – Observation points

  • dct (float | None) – Path lengthening.

  • df (float | None) – Deviation of RF frequency.

  • orbit (ndarray | None) – Avoids looking for initial the closed orbit if it is already known ((6,) array).

  • keep_lattice (bool) – Assume no lattice change since the previous tracking. Default: False

Keyword Arguments:
  • full (bool) – If True, matrices are full 1-turn matrices at the entrance of each element indexed by refpts. If False (Default), matrices are between the entrance of the first element and the entrance of the selected element

  • XYStep (float) – Step size. Default: DConstant.XYStep

Returns:
  • m44 – full one-turn matrix at the entrance of the first element

  • ms – 4x4 transfer matrices between the entrance of the first element and each element indexed by refpts: (Nrefs, 4, 4) array

find_m66(ring, refpts=None, orbit=None, keep_lattice=False, **kwargs)[source]#

One-turn 6x6 transfer matrix

find_m66() finds the 6x6 transfer matrix of an accelerator lattice by differentiation of trajectories near the closed orbit.

find_m66() uses find_orbit6() to search for the closed orbit in 6-D. In order for this to work the ring MUST have a Cavity element

Parameters:
Keyword Arguments:
Returns:
  • m66 – full one-turn matrix at the entrance of the first element

  • ms – 6x6 transfer matrices between the entrance of the first element and each element indexed by refpts: (Nrefs, 6, 6) array

gen_m66_elem(ring, o4b, o4e)[source]#

Converts a ring to a linear 6x6 matrix

Parameters:
Returns:

m66 – 6x6 transfer matrix