frombrian2importCodeRunner)
brian2.groups.group.
CodeRunner
(*args, **kw)[source]¶brian2.core.base.BrianObject
CodeObject
every timestep and keeps areference to the Group
. Used in NeuronGroup
for Thresholder
,Resetter
and StateUpdater
.Network.before_run
). If the namespace is already completethis might catch unit mismatches.Group
Template
update_abstract_code
method might generate this code dynamicallybefore every run instead.Quantity
, optionalclock
argument.Clock
, optionaldt
argumentis specified, the defaultclock
will be used.'start'
.True
) by default but should be switched off for stateupdaters (units are already checked for the equations and the generatedabstract code might have already replaced variables with their unit-lessvalues)USES_VARIABLES
statement in the template. This is onlyrarely necessary, an example being a StateMonitor
where thenames of the variables are neither known to the template nor includedin the abstract code statements.CodeObject
class to run code with. If not specified, defaults tothe group
’s codeobj_class
attribute.CodeObject
if there is no abstract code toexecute. Defaults to True
but should be switched off e.g. for aStateUpdater
when there is nothing to do.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. |
before_run
(run_namespace)[source]¶Network.after_run
before the main simulation loop starts.create_code_objects
(run_namespace)[source]¶create_default_code_object
(run_namespace)[source]¶update_abstract_code
(run_namespace)[source]¶before_run
and should update the CodeRunner.abstract_code
attribute.