dimensions_and_type_from_string function
(Shortest import: from brian2.equations.equations import dimensions_and_type_from_string)
- brian2.equations.equations.dimensions_and_type_from_string(unit_string)[source]
Returns the physical dimensions that results from evaluating a string like “siemens / metre ** 2”, allowing for the special string “1” to signify dimensionless units, the string “boolean” for a boolean and “integer” for an integer variable.
- Parameters:
unit_string : str
The string that should evaluate to a unit
- Returns:
d, type : (
Dimension
, {FLOAT, INTEGER or BOOL})The resulting physical dimensions and the type of the variable.
Raises
ValueError
If the string cannot be evaluated to a unit.