ArrayVariable class

(Shortest import: from brian2.core.variables import ArrayVariable)

class brian2.core.variables.ArrayVariable(name, unit, owner, size, device, dtype=None, constant=False, scalar=False, read_only=False, dynamic=False, unique=False)[source]

Bases: brian2.core.variables.Variable

An object providing information about a model variable stored in an array (for example, all state variables). Most of the time Variables.add_array should be used instead of instantiating this class directly.

Parameters:

name : ‘str’

The name of the variable. Note that this refers to the original name in the owning group. The same variable may be known under other names in other groups (e.g. the variable v of a NeuronGroup is known as v_post in a Synapse connecting to the group).

unit : Unit

The unit of the variable

owner : Nameable

The object that “owns” this variable, e.g. the NeuronGroup or Synapses object that declares the variable in its model equations.

size : int

The size of the array

device : Device

The device responsible for the memory access.

dtype : dtype, optional

The dtype used for storing the variable. If none is given, defaults to core.default_float_dtype.

constant : bool, optional

Whether the variable’s value is constant during a run. Defaults to False.

scalar : bool, optional

Whether this array is a 1-element array that should be treated like a scalar (e.g. for a single delay value across synapses). Defaults to False.

read_only : bool, optional

Whether this is a read-only variable, i.e. a variable that is set internally and cannot be changed by the user. Defaults to False.

unique : bool, optional

Whether the values in this array are all unique. This information is only important for variables used as indices and does not have to reflect the actual contents of the array but only the possibility of non-uniqueness (e.g. synaptic indices are always unique but the corresponding pre- and post-synaptic indices are not). Defaults to False.

Attributes

conditional_write Another variable, on which the write is conditioned (e.g.
device The Device responsible for memory access.
size The size of this variable.
unique Wether all values in this arrays are necessarily unique (only relevant for index variables).

Methods

get_addressable_value(name, group)
get_addressable_value_with_unit(name, group)
get_len()
get_value()
set_conditional_write(var)
set_value(value)

Details

conditional_write

Another variable, on which the write is conditioned (e.g. a variable denoting the absence of refractoriness)

device

The Device responsible for memory access.

size

The size of this variable.

unique

Wether all values in this arrays are necessarily unique (only relevant for index variables).

get_addressable_value(name, group)[source]
get_addressable_value_with_unit(name, group)[source]
get_len()[source]
get_value()[source]
set_conditional_write(var)[source]
set_value(value)[source]