create_runner_codeobj function
(Shortest import: from brian2.codegen.codeobject import create_runner_codeobj)
- brian2.codegen.codeobject.create_runner_codeobj(group, code, template_name, run_namespace, user_code=None, variable_indices=None, name=None, check_units=True, needed_variables=None, additional_variables=None, template_kwds=None, override_conditional_write=None, codeobj_class=None)[source]
Create a
CodeObject
for the execution of code in the context of aGroup
.- Parameters:
group :
Group
The group where the code is to be run
code : str or dict of str
The code to be executed.
template_name : str
The name of the template to use for the code.
run_namespace : dict-like
An additional namespace that is used for variable lookup (either an explicitly defined namespace or one taken from the local context).
user_code : str, optional
The code that had been specified by the user before other code was added automatically. If not specified, will be assumed to be identical to
code
.variable_indices : dict-like, optional
A mapping from
Variable
objects to index names (strings). If none is given, uses the corresponding attribute ofgroup
.name : str, optional
A name for this code object, will use
group + '_codeobject*'
if none is given.check_units : bool, optional
Whether to check units in the statement. Defaults to
True
.needed_variables: list of str, optional :
A list of variables that are neither present in the abstract code, nor in the
USES_VARIABLES
statement in the template. This is only rarely necessary, an example being aStateMonitor
where the names of the variables are neither known to the template nor included in the abstract code statements.additional_variables : dict-like, optional
A mapping of names to
Variable
objects, used in addition to the variables saved ingroup
.template_kwds : dict, optional
A dictionary of additional information that is passed to the template.
override_conditional_write: list of str, optional :
A list of variable names which are used as conditions (e.g. for refractoriness) which should be ignored.
codeobj_class : class, optional
The
CodeObject
class to run code with. If not specified, defaults to thegroup
’scodeobj_class
attribute.