at.lattice.elements.basic_elements#

Basic Element classes

Classes

Marker(family_name, **kwargs)

Marker element

Monitor(family_name, **kwargs)

Monitor element

BeamMoments(family_name, **kwargs)

Element to compute bunches mean and std

SliceMoments(family_name, nslice, **kwargs)

Element computing the mean and std of slices

Aperture(family_name, limits, **kwargs)

Transverse aperture element

LongtAperture(family_name, limits, **kwargs)

Longitudinal aperture element

LongElement(family_name, length, *args, **kwargs)

Base class for long elements

Drift(family_name, length, **kwargs)

Drift space element

Collimator(family_name, length, limits, **kwargs)

Collimator element

RFCavity(family_name, length, voltage, ...)

RF cavity element

M66(family_name[, m66])

Linear (6, 6) transfer matrix

SimpleQuantDiff(family_name[, betax, betay, ...])

Linear tracking element for a simplified quantum diffusion, radiation damping and energy loss.

SimpleRadiation(family_name[, taux, tauy, ...])

Simple radiation damping and energy loss

QuantumDiffusion(family_name, lmatp, **kwargs)

Quantum diffusion element

EnergyLoss(family_name, energy_loss, **kwargs)

Energy loss element

class Aperture(family_name, limits, **kwargs)[source]#

Bases: Element

Transverse aperture element

Parameters:
  • family_name – Name of the element

  • limits – (4,) array of physical aperture: [xmin, xmax, ymin, ymax]

Default PassMethod: AperturePass

class BeamMoments(family_name, **kwargs)[source]#

Bases: Element

Element to compute bunches mean and std

Parameters:

family_name (str) – Name of the element

Default PassMethod: BeamMomentsPass

set_buffers(nturns, nbunch)[source]#
property means#

Beam 6d centre of mass

property stds#

Beam 6d standard deviation

class Collimator(family_name, length, limits, **kwargs)[source]#

Bases: Drift

Collimator element

Parameters:
  • family_name (str) – Name of the element

  • length (float) – Element length [m]

  • limits – (4,) array of physical aperture: [xmin, xmax, zmin, zmax] [m]

Default PassMethod: DriftPass

class Drift(family_name, length, **kwargs)[source]#

Bases: LongElement

Drift space element

Parameters:
  • family_name (str) – Name of the element

  • length (float) – Element length [m]

Default PassMethod: DriftPass

insert(insert_list)[source]#

insert elements inside a drift

Parameters:

insert_list (Iterable[tuple[float, Element | None]]) –

iterable, each item of insert_list is itself an iterable with 2 objects:

  1. the location where the centre of the element will be inserted, given as a fraction of the Drift length.

  2. an element to be inserted at that location. If None, the drift will be divided but no element will be inserted.

Returns:

elem_list – a list of elements.

Drifts with negative lengths may be generated if necessary.

Examples

>>> Drift("dr", 2.0).insert(((0.25, None), (0.75, None)))
[Drift('dr', 0.5), Drift('dr', 1.0), Drift('dr', 0.5)]
>>> Drift("dr", 2.0).insert(((0.0, Marker("m1")), (0.5, Marker("m2"))))
[Marker('m1'), Drift('dr', 1.0), Marker('m2'), Drift('dr', 1.0)]
>>> Drift("dr", 2.0).insert(((0.5, Quadrupole("qp", 0.4, 0.0)),))
[Drift('dr', 0.8), Quadrupole('qp', 0.4), Drift('dr', 0.8)]
class EnergyLoss(family_name, energy_loss, **kwargs)[source]#

Bases: _DictLongtMotion, Element

Energy loss element

The EnergyLoss element is taken into account in radiation_parameters(): it adds damping by contributing to the \(I_2\) integral, thus reducing the equilibrium emittance. But it does not generate any diffusion. This makes sense only if the losses summarised in the element occur in non-dispersive locations.

It is a single thin, straight non-focusing radiative element that does not contribute to the diffusion. It’s typical usage is to model the energy loss and contribution to the damping times from a thin wiggler located in a non dispersive region. More complex cases with focusing and / or diffusion are not correctly handled by this element.

Parameters:
  • family_name (str) – Name of the element

  • energy_loss (float) – Energy loss [eV]

default_pass = {False: 'IdentityPass', True: 'EnergyLossRadPass'}#
class LongElement(family_name, length, *args, **kwargs)[source]#

Bases: Element

Base class for long elements

Parameters:
  • family_name (str) – Name of the element

  • length (float) – Element length [m]

Other arguments and keywords are given to the base class

divide(frac)[source]#

split the element in len(frac) pieces whose length is frac[i]*self.Length

Parameters:

frac – length of each slice expressed as a fraction of the initial length. sum(frac) may differ from 1.

Returns:

elem_list – a list of elements equivalent to the original.

Example

>>> Drift("dr", 0.5).divide([0.2, 0.6, 0.2])
[Drift('dr', 0.1), Drift('dr', 0.3), Drift('dr', 0.1)]
is_compatible(other)[source]#

Checks if another Element can be merged

merge(other)[source]#

Merge another element

class LongtAperture(family_name, limits, **kwargs)[source]#

Bases: Element

Longitudinal aperture element

Parameters:
  • family_name – Name of the element

  • limits – (4,) array of physical aperture: [dpmin, dpmax, ctmin, ctmax]

Default PassMethod: LongtAperturePass

class M66(family_name, m66=None, **kwargs)[source]#

Bases: Element

Linear (6, 6) transfer matrix

Parameters:
  • family_name (str) – Name of the element

  • m66 – Transfer matrix. Default: Identity matrix

Default PassMethod: Matrix66Pass

class Marker(family_name, **kwargs)[source]#

Bases: Element

Marker element

Parameters:

family_name (str) – Name of the element

All keywords will be set as attributes of the element

class Monitor(family_name, **kwargs)[source]#

Bases: Element

Monitor element

Parameters:

family_name (str) – Name of the element

All keywords will be set as attributes of the element

class QuantumDiffusion(family_name, lmatp, **kwargs)[source]#

Bases: _DictLongtMotion, Element

Quantum diffusion element

Parameters:
  • family_name (str) – Name of the element

  • lmatp (np.ndarray) – Diffusion matrix for generation (see gen_quantdiff_elem())

Default PassMethod: QuantDiffPass

default_pass = {False: 'IdentityPass', True: 'QuantDiffPass'}#
class RFCavity(family_name, length, voltage, frequency, harmonic_number, energy, **kwargs)[source]#

Bases: LongtMotion, LongElement

RF cavity element

Parameters:
  • family_name (str) – Name of the element

  • length (float) – Element length [m]

  • voltage (float) – RF voltage [V]

  • frequency (float) – RF frequency [Hz]

  • harmonic_number (int)

  • energy (float) – ring energy [eV]

Keyword Arguments:

TimeLag=0 – Cavity time lag

Default PassMethod: RFCavityPass

is_compatible(other)[source]#

Checks if another Element can be merged

merge(other)[source]#

Merge another element

set_longt_motion(enable, new_pass=None, **kwargs)[source]#

Enable/Disable longitudinal motion

Parameters:
  • enableTrue: for enabling, False for disabling

  • new_pass

    New PassMethod:

    • None: makes no change,

    • 'auto': Uses the default conversion,

    • Anything else is used as the new PassMethod.

  • copy – If True, returns a modified copy of the element, otherwise modifies the element in-place

default_pass = {False: 'DriftPass', True: 'RFCavityPass'}#
class SimpleQuantDiff(family_name, betax=1.0, betay=1.0, emitx=0.0, emity=0.0, espread=0.0, taux=0.0, tauy=0.0, tauz=0.0, **kwargs)[source]#

Bases: _DictLongtMotion, Element

Linear tracking element for a simplified quantum diffusion, radiation damping and energy loss.

Note: The damping times are needed to compute the correct kick for the emittance. Radiation damping is NOT applied.

Parameters:
  • family_name (str) – Name of the element

  • betax (float) – Horizontal beta function at element [m]

  • betay (float) – Vertical beta function at element [m]

  • emitx (float) – Horizontal equilibrium emittance [m.rad]

  • emity (float) – Vertical equilibrium emittance [m.rad]

  • espread (float) – Equilibrium energy spread

  • taux (float) – Horizontal damping time [turns]

  • tauy (float) – Vertical damping time [turns]

  • tauz (float) – Longitudinal damping time [turns]

Default PassMethod: SimpleQuantDiffPass

default_pass = {False: 'IdentityPass', True: 'SimpleQuantDiffPass'}#
class SimpleRadiation(family_name, taux=0.0, tauy=0.0, tauz=0.0, U0=0.0, **kwargs)[source]#

Bases: _DictLongtMotion, Radiative, Element

Simple radiation damping and energy loss

Parameters:
  • family_name (str) – Name of the element

  • taux (float) – Horizontal damping time [turns]

  • tauy (float) – Vertical damping time [turns]

  • tauz (float) – Longitudinal damping time [turns]

  • U0 (float) – Energy loss per turn [eV]

Default PassMethod: SimpleRadiationRadPass

default_pass = {False: 'IdentityPass', True: 'SimpleRadiationRadPass'}#
class SliceMoments(family_name, nslice, **kwargs)[source]#

Bases: Element

Element computing the mean and std of slices

Parameters:
  • family_name (str) – Name of the element

  • nslice (int) – Number of slices

Keyword Arguments:
  • startturn – Start turn of the acquisition (Default 0)

  • endturn – End turn of the acquisition (Default 1)

Default PassMethod: SliceMomentsPass

set_buffers(nturns, nbunch)[source]#
property endturn#

End turn of the acquisition

property means#

Slices x,y,dp centre of mass

property spos#

Slices s position

property startturn#

Start turn of the acquisition

property stds#

Slices x,y,dp standard deviation

property weights#

Slices weights in mA if beam current >0, otherwise fraction of total number of particles in the bunch