CodeRunner class¶
(Shortest import: from brian2 import CodeRunner)
-
class
brian2.groups.group.
CodeRunner
(group, template, code='', user_code=None, dt=None, clock=None, when='start', order=0, name='coderunner*', check_units=True, template_kwds=None, needed_variables=None, override_conditional_write=None, codeobj_class=None, generate_empty_code=True)[source]¶ Bases:
brian2.core.base.BrianObject
A “code runner” that runs a
CodeObject
every timestep and keeps a reference to theGroup
. Used inNeuronGroup
forThresholder
,Resetter
andStateUpdater
.On creation, we try to run the before_run method with an empty additional namespace (see
Network.before_run
). If the namespace is already complete this might catch unit mismatches.Methods
before_run
(run_namespace)Optional method to prepare the object before a run. create_code_objects
(run_namespace)create_default_code_object
(run_namespace)update_abstract_code
(run_namespace)Update the abstract code for the code object. Details
-
before_run
(run_namespace)[source]¶ Optional method to prepare the object before a run.
Called by
Network.after_run
before the main simulation loop starts.
-
update_abstract_code
(run_namespace)[source]¶ Update the abstract code for the code object. Will be called in
before_run
and should update theCodeRunner.abstract_code
attribute.Does nothing by default.
-