optimisation.design_space.helper module

Set initial values/limits in DesignSpaceFactory.

Todo

check docstrings ref [1]

_get_maximum_k_e_of_section(section_idx: int, reference_elements: list[Element]) float

Get the maximum k_e of section.

k_e_limits(reference_element: Element, max_decrease_k_e_in_percent: float, max_increase_k_e_in_percent: float, maximum_k_e_is_calculated_wrt_maximum_k_e_of_section: bool = False, reference_elements: list[Element] | None = None, **kwargs) tuple[float, float]

Get classic limits for k_e.

Parameters:
  • reference_element (Element) – The nominal element.

  • max_decrease_in_percent (float) – Allowed decrease in percent with respect to the nominal k_e.

  • max_increase_in_percent (float) – Allowed increase in percent with respect to the nominal k_e.

  • maximum_k_e_is_calculated_wrt_maximum_k_e_of_section (bool, optional) – Use this flag to compute allowed increase of k_e with respect to the maximum k_e of the section, instead of the k_e of the nominal cavity. This is what we used in `[1]`_. The default is False.

  • reference_elements (list[Element] | None) – List of the nominal elements. Must be provided if maximum_k_e_is_calculated_wrt_maximum_k_e_of_section is True.

Returns:

  • tuple[float, float] – Lower and upper bounds for k_e.

  • # .. _[1] (doi.org/10.18429/JACoW-LINAC2022-TUPORI04)

  • # A. Plaçais and F. Bouly, “Cavity Failure Compensation Strategies in

  • # Superconducting Linacs,” in Proceedings of LINAC2022, 2022, pp. 552–555.

phi_0_limits(**kwargs) tuple[float, float]

Return classic limits for the absolute or relative rf phase.

Returns:

Always \((-2\pi, 2\pi)\).

Return type:

tuple[float, float]

phi_s_limits(reference_element: Element, max_increase_sync_phase_in_percent: float, max_absolute_sync_phase_in_deg: float = 0.0, min_absolute_sync_phase_in_deg: float = -90.0, **kwargs) tuple[float, float]

Return classic limits for the synchronous phase.

Minimum is min_absolute_sync_phase_in_deg, which is -90 degrees by default. Maximum is nominal synchronous phase + max_increase_in_percent, or max_absolute_sync_phase_in_deg which is 0 degrees by default.

Parameters:
  • reference_element (Element) – Element in its nominal tuning.

  • max_increase_in_percent (float) – Maximum increase of the synchronous phase in percent.

  • max_absolute_sync_phase_in_deg (float, optional) – Maximum absolute synchronous phase in radians. The default is 0.

  • min_absolute_sync_phase_in_deg (float, optional) – Minimum absolute synchronous phase in radians. The default is \(-\pi / 2\).

Returns:

Lower and upper limits for the synchronous phase.

Return type:

tuple[float, float]

same_value_as_nominal(variable: str, reference_element: Element, **kwargs) float

Return variable value in reference_element.

This is generally a good initial value for optimisation.