check_units_statements function¶
(Shortest import: from brian2.equations.unitcheck import check_units_statements)
- brian2.equations.unitcheck.check_units_statements(code, variables)[source]¶
Check the units for a series of statements. Setting a model variable has to use the correct unit. For newly introduced temporary variables, the unit is determined and used to check the following statements to ensure consistency.
- Parameters
code : str
The statements as a (multi-line) string
variables : dict of
VariableobjectsThe information about all variables used in
code(includingConstantobjects for external variables)
Raises
KeyErrorIn case on of the identifiers cannot be resolved.
DimensionMismatchErrorIf an unit mismatch occurs during the evaluation.