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 :
Dimension
The expected physical dimensions for the
expression
.variables : dict
Dictionary of all variables (including external constants) used in the
expression
.
Raises
KeyError
In case on of the identifiers cannot be resolved.
DimensionMismatchError
If an unit mismatch occurs during the evaluation.