decompose#
- VariableManager.decompose(variable)[source]#
Decompose a variable string to a floating with its unit.
- Parameters:
- variable
str
- variable
- Returns:
tuple
The float value of the variable and the units exposed as a string.
Examples
>>> hfss = Hfss() >>> print(hfss.variable_manager.decompose("5mm")) >>> (5.0, 'mm') >>> hfss["v1"] = "3N" >>> print(hfss.variable_manager.decompose("v1")) >>> (3.0, 'N') >>> hfss["v2"] = "2*v1" >>> print(hfss.variable_manager.decompose("v2")) >>> (6.0, 'N')