NeuronGroup class

(Shortest import: from brian2 import NeuronGroup)

class brian2.groups.neurongroup.NeuronGroup(N, model, method=('linear', 'euler', 'milstein'), threshold=None, reset=None, refractory=False, 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.

Parameters:

N : int

Number of neurons in the group.

model : (str, Equations)

The differential equations defining the group

method : (str, function), optional

The numerical integration method. Either a string with the name of a registered method (e.g. “euler”) or a function that receives an Equations object and returns the corresponding abstract code. If no method is specified, a suitable method will be chosen automatically.

threshold : str, optional

The condition which produces spikes. Should be a single line boolean expression.

reset : str, optional

The (possibly multi-line) string with the code to execute on reset.

refractory : {str, Quantity}, optional

Either the length of the refractory period (e.g. 2*ms), a string expression that evaluates to the length of the refractory period after each spike (e.g. '(1 + rand())*ms'), or a string expression evaluating to a boolean value, given the condition under which the neuron stays refractory after a spike (e.g. 'v > -20*mV')

namespace: dict, optional :

A dictionary mapping variable/function names to the respective objects. If no namespace is given, the “implicit” namespace, consisting of the local and global namespace surrounding the creation of the class, is used.

dtype : (dtype, dict), optional

The numpy.dtype that will be used to store the values, or a dictionary specifying the type for variable names. If a value is not provided for a variable (or no value is provided at all), the preference setting core.default_float_dtype is used.

codeobj_class : class, optional

The CodeObject class to run code with.

dt : Quantity, optional

The time step to be used for the simulation. Cannot be combined with the clock argument.

clock : Clock, optional

The update clock to be used. If neither a clock, nor the dt argument is specified, the defaultclock will be used.

order : int, optional

The priority of of this group for operations occurring at the same time step and in the same scheduling slot. Defaults to 0.

name : str, optional

A unique name for the group, otherwise use neurongroup_0, etc.

Notes

NeuronGroup contains a StateUpdater, Thresholder and Resetter, and these are run at the ‘groups’, ‘thresholds’ and ‘resets’ slots (i.e. the values of their when attribute take these values). The order attribute will be passed down to the contained objects but can be set individually by setting the order attribute of the state_updater, thresholder and resetter attributes, respectively.

Attributes

_refractory The refractory condition or timespan
method_choice The state update method selected by the user
namespace The group-specific namespace
reset The reset statement(s)
resetter Resets neurons which have spiked (spikes)
spikes The spikes returned by the most recent thresholding operation.
state_updater Performs numerical integration step
threshold The threshold condition
thresholder Performs thresholding step, sets the value of spikes

Methods

before_run([run_namespace, level])
state(name[, use_units, level])

Details

_refractory

The refractory condition or timespan

method_choice

The state update method selected by the user

namespace

The group-specific namespace

reset

The reset statement(s)

resetter

Resets neurons which have spiked (spikes)

spikes[source]

The spikes returned by the most recent thresholding operation.

state_updater

Performs numerical integration step

threshold

The threshold condition

thresholder

Performs thresholding step, sets the value of spikes

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