variable module

Define Variable, which stores an optimisation variable.

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

class Variable(name, element_name, limits, x_0)[source]

Bases: DesignSpaceParameter

A single variable.

It can be a cavity amplitude, absolute phase, relative phase or synchronous phase with an initial value and 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.

  • limits (tuple[float, float]) – Lower and upper bound for the variable. np.nan deactivates a bound.

  • x_0 (float) – Initial value.

x_0: float
classmethod from_floats(name, element_name, x_min, x_max, x_0=nan)[source]

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, default: nan) – Initial value.

Return type:

Self

Returns:

A Variable with limits = (x_min, x_max).

classmethod from_pd_series(name, element_name, pd_series)[source]

Init object from a pd series (file import).

Parameters:
Return type:

Self

__post_init__()[source]

Convert values in deg for output if it is angle.

__init__(name, element_name, limits, x_0)
Parameters:
Return type:

None

_abc_impl = <_abc._abc_data object at 0x7318f8f785c0>