check_dimensions function¶
(Shortest import: from brian2.equations.unitcheck import check_dimensions)
-
brian2.equations.unitcheck.check_dimensions(expression, dimensions, variables)[source]¶ Compares the physical dimensions of an expression to expected dimensions in a given namespace.
- Parameters
expression : str
The expression to evaluate.
dimensions :
DimensionThe expected physical dimensions for the
expression.variables : dict
Dictionary of all variables (including external constants) used in the
expression.
Raises
KeyErrorIn case on of the identifiers cannot be resolved.
DimensionMismatchErrorIf an unit mismatch occurs during the evaluation.