cavity_settings_factory module

Create CavitySettings from various contexts.

class CavitySettingsFactory(freq_bunch_mhz)[source]

Bases: object

Base class to create CavitySettings objects.

Parameters:

freq_bunch_mhz (float)

__init__(freq_bunch_mhz)[source]

Instantiate factory, with attributes common to all cavities.

Parameters:

freq_bunch_mhz (float)

from_line_in_dat_file(line, set_sync_phase=False)[source]

Create the cavity settings as read in the DAT file.

Parameters:
Return type:

CavitySettings

from_optimisation_algorithm(base_settings, var, reference, status)[source]

Create the cavity settings to try during/at the end of an optimization.

Parameters:
  • base_settings (Sequence[CavitySettings]) – Nominal cavity settings, serving as a “base” for creating the new CavitySettings.

  • var (ndarray) – Holds amplitudes in the first half, phases in the second half.

  • reference (Literal['phi_0_abs', 'phi_0_rel', 'phi_s']) – Nature of the phase to use as reference for the optimization.

  • status (Literal['compensate (in progress)', 'compensate (not ok)', 'compensate (ok)', 'failed', 'nominal', 'rephased (in progress)', 'rephased (ok)']) – Status of the cavities.

Return type:

list[CavitySettings]

_reference(absolute_phase_flag, set_sync_phase)[source]

Determine which phase will be the reference one.

Parameters:
  • absolute_phase_flag (bool)

  • set_sync_phase (bool)

Return type:

Literal['phi_0_abs', 'phi_0_rel', 'phi_s']