optimisation.design_space.variable module

Define Variable, which stores an optimisation variable.

It keeps it’s name, bounds, initial value, etc.

IMPLEMENTED_VARIABLES = ('k_e', 'phi_0_abs', 'phi_0_rel', 'phi_s')
class Variable(name: str, element_name: str, limits: tuple[float, float], x_0: float)

Bases: DesignSpaceParameter

A single variable.

It can be a cavity amplitude, absolute phase, relative phase or synchronous phase with an initial value and limits.

name

Name of the parameter. Must be compatible with the SimulationOutput.get() method, and be in IMPLEMENTED_VARIABLES.

Type:

str

element_name

Name of the element concerned by the parameter.

Type:

str

limits

Lower and upper bound for the variable. np.nan deactivates a bound.

Type:

tuple[float, float]

x_0

Initial value.

Type:

float

__init__(name: str, element_name: str, limits: tuple[float, float], x_0: float) None
__post_init__()

Convert values in deg for output if it is angle.

_abc_impl = <_abc._abc_data object>
classmethod from_floats(name: str, element_name: str, x_min: float, x_max: float, x_0: float = nan) Self

Initialize object with x_min, x_max instead of limits.

Parameters:
  • name (str) – Name of the parameter. Must be compatible with the SimulationOutput.get() method, and be in IMPLEMENTED_VARIABLES.

  • element_name (str) – Name of the element concerned by the parameter.

  • x_min (float) – Lower limit. np.nan to deactivate lower bound.

  • x_max (float) – Upper limit. np.nan to deactivate lower bound.

  • x_0 (float) – Initial value.

Returns:

A Variable with limits = (x_min, x_max).

Return type:

Self

classmethod from_pd_series(name: str, element_name: str, pd_series: Series) Self

Init object from a pd series (file import).

x_0: float