parse_expression_unit function¶
(Shortest import: from brian2.parsing.expressions import parse_expression_unit)
-
brian2.parsing.expressions.
parse_expression_unit
(expr, variables)[source]¶ Returns the unit value of an expression, and checks its validity
Parameters: expr : str
The expression to check.
variables : dict
Dictionary of all variables used in the
expr
(includingConstant
objects for external variables)Returns: unit : Quantity
The output unit of the expression
Raises
SyntaxError
- If the expression cannot be parsed, or if it uses
a**b
forb
anything other than a constant number. DimensionMismatchError
- If any part of the expression is dimensionally inconsistent.