check_code_units function

(Shortest import: from brian2.codegen.codeobject import check_code_units)

brian2.codegen.codeobject.check_code_units(code, group, user_code=None, additional_variables=None, level=0, run_namespace=None)[source]

Check statements for correct units.


code : str

The series of statements to check

group : Group

The context for the code execution

user_code : str, optional

The code that was provided by the user. Used to determine whether to emit warnings and for better error messages. If not specified, assumed to be equal to code.

additional_variables : dict-like, optional

A mapping of names to Variable objects, used in addition to the variables saved in

level : int, optional

How far to go up in the stack to find the calling frame.

run_namespace : dict-like, optional

An additional namespace, as provided to Group.before_run()


If code has unit mismatches