at.physics.energy_loss#

Functions

get_energy_loss(ring[, method])

Computes the energy loss per turn

set_cavity_phase(ring, *[, method, refpts, ...])

Adjust the TimeLag attribute of RF cavities based on frequency, voltage and energy loss per turn, so that the synchronous phase is zero.

get_timelag_fromU0(ring, *[, method, ...])

Get the TimeLag attribute of RF cavities based on frequency, voltage and energy loss per turn, so that the synchronous phase is zero.

Classes

ELossMethod(*values)

methods for the computation of energy losses

class ELossMethod(*values)[source]#

Bases: Enum

methods for the computation of energy losses

INTEGRAL = 1#

The losses are obtained from \(E_{loss}=C_\gamma/2\pi . E^4 . I_2\). Takes into account bending magnets and wigglers.

TRACKING = 2#

The losses are obtained by tracking without cavities. Needs radiation ON, takes into account all radiating elements

get_energy_loss(ring, method=ELossMethod.INTEGRAL)[source]#

Computes the energy loss per turn

Parameters:
Returns:

eloss (float) – Energy loss per turn [eV]

get_timelag_fromU0(ring, *, method=ELossMethod.TRACKING, cavpts=None, divider=4, ts_tol=None)[source]#

Get the TimeLag attribute of RF cavities based on frequency, voltage and energy loss per turn, so that the synchronous phase is zero. Used in set_cavity_phase()

Parameters:
  • ring (Lattice) – Lattice description

  • method (ELossMethod | None) – Method for energy loss computation. See ELossMethod.

  • cavpts (Type[Element] | Element | Callable[[Element], bool] | str | None | int | Sequence[int] | bool | Sequence[bool] | RefptsCode) – Cavity location. If None, use all cavities. This allows to ignore harmonic cavities.

  • divider (int | None) – number of segments to search for ts

  • ts_tol (float | None) – relative tolerance for ts calculation, default is 1.0-9 If the search fails to find the synchronous phase the tolerance can be increased using the keyword argument or by setting at.DConstant.TStol

Returns:
  • timelag (float) – (ncav,) array of Timelag values

  • ts (float) – Time difference with the present value

set_cavity_phase(ring, *, method=ELossMethod.TRACKING, refpts=None, cavpts=None, copy=False)[source]#

Adjust the TimeLag attribute of RF cavities based on frequency, voltage and energy loss per turn, so that the synchronous phase is zero. An error occurs if all cavities do not have the same frequency.

Warning

This function changes the time reference, this should be avoided

Parameters: