parse_expression_dimensions function¶
(Shortest import: from brian2.parsing.expressions import parse_expression_dimensions)
-
brian2.parsing.expressions.
parse_expression_dimensions
(expr, variables, orig_expr=None)[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.