at.lattice.cavity_access#

Access to properties of RF cavities

Functions

frequency_control(func)

Function to be used as decorator for func(ring, *args, **kwargs)

get_rf_frequency(ring, **kwargs)

Return the RF frequency

get_rf_voltage(ring, **kwargs)

Return the total RF voltage (full ring)

set_rf_voltage(ring, voltage, **kwargs)

Set the RF voltage for the full ring

get_rf_timelag(ring, **kwargs)

Return the RF time lag

set_rf_timelag(ring, timelag, **kwargs)

Set the RF time lag

set_cavity(ring[, Voltage, Frequency, ...])

Set the parameters of the RF cavities

Classes

Frf(value)

Enum class for frequency setting

class Frf(value)[source]#

Bases: Enum

Enum class for frequency setting

NOMINAL = 'nominal'#
frequency_control(func)[source]#

Function to be used as decorator for func(ring, *args, **kwargs)

If ring.is_6d is True and dp, dct or df is specified in kwargs, make a copy of ring with a modified RF frequency, remove dp, dct or df from kwargs and call func with the modified ring.

If ring.is_6d is False or no dp, dct or df is specified in kwargs, func is called unchanged.

Examples

@frequency_control
def func(ring, *args, dp=None, dct=None, **kwargs):
    pass
get_rf_frequency(ring, **kwargs)[source]#

Return the RF frequency

Parameters:

ring (Lattice) – Lattice description

Keyword Arguments:
  • cavpts=None – Cavity location. If None, look for ring.cavpts, otherwise take all cavities.

  • array=False

    If False, return the frequency of the selected cavities with the lowest frequency.

    If True, return the frequency of all selected cavities

Returns:

rf_freq – RF frequency

get_rf_timelag(ring, **kwargs)[source]#

Return the RF time lag

Parameters:

ring (Lattice) – Lattice description

Keyword Arguments:
  • cavpts=None – Cavity location. If None, look for ring.cavpts, otherwise take all cavities.

  • array=False

    If False, return the frequency of the selected cavities with the lowest frequency.

    If True, return the frequency of all selected cavities

Returns:

rf_timelag – RF time lag

get_rf_voltage(ring, **kwargs)[source]#

Return the total RF voltage (full ring)

Parameters:

ring (Lattice) – Lattice description

Keyword Arguments:
  • cavpts=None – Cavity location. If None, look for ring.cavpts, otherwise take all cavities.

  • array=False

    If False, return the frequency of the selected cavities with the lowest frequency.

    If True, return the frequency of all selected cavities

Returns:

rf_v – Total RF voltage (full ring)

set_cavity(ring, Voltage=None, Frequency=None, TimeLag=None, cavpts=None, copy=False, array=False)[source]#

Set the parameters of the RF cavities

Parameters:
  • ring (Lattice) – lattice description

  • Frequency (float | None) – RF frequency [Hz]

  • Voltage (float | None) – RF voltage [V]

  • TimeLag (float | None) – RF time shift [-ct]

  • cavpts (Type[Element] | Element | Callable[[Element], bool] | str | None | int | Sequence[int] | bool | Sequence[bool] | RefptsCode) – Cavity location. If None, look for ring.cavpts, or otherwise take all cavities

  • array (bool | None) – If False, the value is applied as described for set_rf_voltage, set_rf_timelag and set_rf_frequency If True, directly apply the value to the selected cavities. The value must be broadcastable to the number of cavities.

  • copy (bool | None) – If True, returns a shallow copy of ring with new cavity elements. Otherwise, modify ring in-place

set_rf_timelag(ring, timelag, **kwargs)[source]#

Set the RF time lag

Parameters:
  • ring (Lattice) – Lattice description

  • timelag (float) – RF time lag

Keyword Arguments:
  • cavpts=None – Cavity location. If None, look for ring.cavpts, otherwise take all cavities.

  • array=False

    If False, return the frequency of the selected cavities with the lowest frequency.

    If True, return the frequency of all selected cavities

  • copy=False – If True, returns a shallow copy of ring with new cavity elements. Otherwise, modify ring in-place.

set_rf_voltage(ring, voltage, **kwargs)[source]#

Set the RF voltage for the full ring

Parameters:
  • ring (Lattice) – Lattice description

  • voltage (float) – Total RF voltage (full ring)

Keyword Arguments:
  • cavpts=None – Cavity location. If None, look for ring.cavpts, otherwise take all cavities.

  • array=False

    If False, return the frequency of the selected cavities with the lowest frequency.

    If True, return the frequency of all selected cavities

  • copy=False – If True, returns a shallow copy of ring with new cavity elements. Otherwise, modify ring in-place.