design_space_parameter module

Create a base class for Variable and Constraint.

class DesignSpaceParameter(name, element_name, limits)[source]

Bases: ABC

Hold a single variable or constraint.

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

  • 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.

name: str
element_name: str
limits: tuple[float, 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 or IMPLEMENTED_CONSTRAINTS.

  • 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)

Return type:

Self

Returns:

A DesignSpaceParameter 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.

property x_min: float

Return lower variable/constraint bound.

property x_max: float

Return upper variable/constraint bound.

change_limits(x_min=None, x_max=None)[source]

Change the limits after creation of the object.

Parameters:
Return type:

None

property _fmt_x_min: float

Lower limit in deg if it is has 'phi' in it’s name.

property _fmt_x_max: float

Lower limit in deg if it is has 'phi' in it’s name.

property _fmt_x_0: float

Initial value but with a better output.

__str__()[source]

Output parameter name and limits.

Return type:

str

classmethod str_header()[source]

Give information on what __str__() is about.

Return type:

str

to_dict(*to_get, missing_value=None, prepend_parameter_name=False)[source]

Convert important data to dict to convert it later in pandas df.

Parameters:
  • to_get (str)

  • missing_value (float | None, default: None)

  • prepend_parameter_name (bool, default: False)

Return type:

dict[str, float | None | tuple[float, float] | str]

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

None

_abc_impl = <_abc._abc_data object at 0x7318f949d640>