at.lattice.cavity_access#
Access to properties of RF cavities
See Cavity Control for a guide on using these functions.
Functions
|
Function to be used as decorator for |
|
Return the RF frequency |
|
Set the RF frequency |
|
Return the total RF voltage (full ring including periodicity) |
|
Set the RF voltage for the full ring |
|
Return the RF time lag |
|
Set the RF time lag |
|
Set the parameters of the RF cavities |
Classes
|
Enum class for frequency setting |
- class Frf(*values)[source]#
Bases:
Enum
Enum class for frequency setting
- NOMINAL = 'nominal'#
Constant used as a frequency value, standing for the nominal frequency
- frequency_control(func)[source]#
Function to be used as decorator for
func(ring, *args, **kwargs)
If
ring.is_6d
isTrue
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
isFalse
or no dp, dct or df is specified in kwargs, func is called with ring unchanged.Example
>>> @frequency_control ... def func(ring, *args, dp=None, dct=None, df=None, **kwargs): ... pass
- get_rf_frequency(ring, **kwargs)[source]#
Return the RF frequency
- Parameters:
ring (Lattice) – Lattice description
- Keyword Arguments:
cavpts (Refpts | None) – If
None
, look forring.cavpts
, or otherwise take all cavities. The main cavities are those with the lowest frequency among the selected ones.array (bool) –
If
False
, return the frequency of the main cavities (selected cavities with the lowest frequency).If
True
, return the frequency of each selected cavity.
- Returns:
rf_freq – RF frequency [Hz]
- get_rf_timelag(ring, **kwargs)[source]#
Return the RF time lag
- Parameters:
ring (Lattice) – Lattice description
- Keyword Arguments:
cavpts (Refpts | None) – If
None
, look forring.cavpts
, or otherwise take all cavities. The main cavities are those with the lowest frequency among the selected ones.array (bool) –
If
False
, return the timelag of the main cavities (selected cavities with the lowest frequency).If
True
, return the timelag of each selected cavity.
- Returns:
rf_timelag – RF time lag as path lengthening [m]
- get_rf_voltage(ring, **kwargs)[source]#
Return the total RF voltage (full ring including periodicity)
- Parameters:
ring (Lattice) – Lattice description
- Keyword Arguments:
cavpts (Refpts | None) – If
None
, look forring.cavpts
, or otherwise take all cavities. The main cavities are those with the lowest frequency among the selected ones.array (bool) –
If
False
, return the sum of the voltage of the main cavities (selected cavities with the lowest frequency).If
True
, return the voltage of each selected cavity.
- Returns:
rf_v – Total voltage (full ring including periodicity) [V]
- set_cavity(ring, Voltage=None, Frequency=None, TimeLag=None, cavpts=None, copy=False, array=False, **kwargs)[source]#
Set the parameters of the RF cavities
- Parameters:
ring (Lattice) – lattice description
Frequency (float | Frf | None) – RF frequency [Hz]. Use
Frf.NOMINAL
to specify the nominal frequency corresponding to the given off-momentum.Voltage (float | None) – Total RF voltage [V]
TimeLag (float | None) – RF time shift expressed as path lengthening [m]
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 cavitiesarray (bool) –
If
False
, the value is applied as described forset_rf_voltage()
,set_rf_timelag()
andset_rf_frequency()
.If
True
, directly apply the values to the selected cavities. The values must be broadcastable to the number of cavities.copy (bool) – If
True
, returns a shallow copy of ring with new cavity elements. Otherwise (default), modify ring in-place.
- set_rf_frequency(ring, frequency=Frf.NOMINAL, **kwargs)[source]#
Set the RF frequency
- Parameters:
ring (Lattice) – Lattice description
frequency (float | Frf) – RF frequency [Hz]. Use
Frf.NOMINAL
to specify the nominal frequency corresponding to the given off-momentum.
- Keyword Arguments:
df (float | None) – Deviation of RF frequency. Defaults to
None
cavpts (Refpts | None) – If
None
, look forring.cavpts
, or otherwise take all cavities.array (bool) –
If
False
(default), frequency is applied to the selected cavities with the lowest frequency. The frequency of all the other selected cavities is scaled by the same ratio.If
True
, directly apply frequency to the selected cavities. The value must be broadcastable to the number of cavities.copy (bool) – If
True
, returns a shallow copy of ring with new cavity elements. Otherwise (default), modify ring in-place.
- set_rf_timelag(ring, timelag, **kwargs)[source]#
Set the RF time lag
- Parameters:
- Keyword Arguments:
cavpts (Refpts | None) – If
None
, look forring.cavpts
, or otherwise take all cavities.array (bool) –
If
False
(default), timelag is applied to the main cavities. The timelag of the other cavities is shifted by the same amount.If
True
, directly apply timelag to the selected cavities. The value must be broadcastable to the number of cavities.copy (bool) – If
True
, returns a shallow copy of ring with new cavity elements. Otherwise (default), modify ring in-place.
- set_rf_voltage(ring, voltage, **kwargs)[source]#
Set the RF voltage for the full ring
- Parameters:
- Keyword Arguments:
cavpts (Refpts | None) – If
None
, look forring.cavpts
, or otherwise take all cavities.array (bool) –
If
False
(default), the voltage of the main cavities is scaled to achieve the desired voltage. The voltage of the other cavities is scaled by the same ratio.If
True
, directly apply voltage to the selected cavities. The value must be broadcastable to the number of cavities.copy (bool) – If
True
, returns a shallow copy of ring with new cavity elements. Otherwise (default), modify ring in-place.