NeuronGroup class

(Shortest import: from brian2 import NeuronGroup)

class brian2.groups.neurongroup.NeuronGroup(N, model, method=('exact', 'euler', 'heun'), method_options=None, threshold=None, reset=None, refractory=False, events=None, namespace=None, dtype=None, dt=None, clock=None, order=0, name='neurongroup*', codeobj_class=None)[source]

Bases: brian2.groups.group.Group, brian2.core.spikesource.SpikeSource

A group of neurons.

Attributes

_refractory The refractory condition or timespan
event_codes Code that is triggered on events (e.g.
events Events supported by this group
method_choice The state update method selected by the user
resetter Reset neurons which have spiked (or perform arbitrary actions for user-defined events)
spikes The spikes returned by the most recent thresholding operation.
state_updater Performs numerical integration step
subexpression_updater Update the “constant over a time step” subexpressions
thresholder Checks the spike threshold (or abitrary user-defined events)
user_equations The original equations as specified by the user (i.e.

Methods

before_run([run_namespace]) Optional method to prepare the object before a run.
run_on_event(event, code[, when, order]) Run code triggered by a custom-defined event (see NeuronGroup documentation for the specification of events).The created Resetter object will be automatically added to the group, it therefore does not need to be added to the network manually.
set_event_schedule(event[, when, order]) Change the scheduling slot for checking the condition of an event.
state(name[, use_units, level]) Return the state variable in a way that properly supports indexing in the context of this group

Details

_refractory

The refractory condition or timespan

event_codes

Code that is triggered on events (e.g. reset)

events

Events supported by this group

method_choice

The state update method selected by the user

resetter

Reset neurons which have spiked (or perform arbitrary actions for user-defined events)

spikes

The spikes returned by the most recent thresholding operation.

state_updater

Performs numerical integration step

subexpression_updater

Update the “constant over a time step” subexpressions

thresholder

Checks the spike threshold (or abitrary user-defined events)

user_equations

The original equations as specified by the user (i.e. without the multiplied int(not_refractory) term for equations marked as (unless refractory))

before_run(run_namespace=None)[source]

Optional method to prepare the object before a run.

Called by Network.after_run before the main simulation loop starts.

run_on_event(event, code, when='after_resets', order=None)[source]

Run code triggered by a custom-defined event (see NeuronGroup documentation for the specification of events).The created Resetter object will be automatically added to the group, it therefore does not need to be added to the network manually. However, a reference to the object will be returned, which can be used to later remove it from the group or to set it to inactive.

set_event_schedule(event, when='after_thresholds', order=None)[source]

Change the scheduling slot for checking the condition of an event.

state(name, use_units=True, level=0)[source]

Return the state variable in a way that properly supports indexing in the context of this group