ArrayVariable class

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

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

Bases: 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.

Attributes

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).

Methods

get_addressable_value(name, group)

Get the value (without units) of this variable in a form that can be indexed in the context of a group.

get_addressable_value_with_unit(name, group)

Get the value (with units) of this variable in a form that can be indexed in the context of a group.

get_len()

Get the length of the value associated with the variable or 0 for a scalar variable.

get_value()

Return the value associated with the variable (without units).

item()

set_conditional_write(var)

set_value(value)

Set the value associated with the variable.

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 the value (without units) of this variable in a form that can be indexed in the context of a group. For example, if a postsynaptic variable x is accessed in a synapse S as S.x_post, the synaptic indexing scheme can be used.

get_addressable_value_with_unit(name, group)[source]

Get the value (with units) of this variable in a form that can be indexed in the context of a group. For example, if a postsynaptic variable x is accessed in a synapse S as S.x_post, the synaptic indexing scheme can be used.

get_len()[source]

Get the length of the value associated with the variable or 0 for a scalar variable.

get_value()[source]

Return the value associated with the variable (without units). This is the way variables are accessed in generated code.

item()[source]
set_conditional_write(var)[source]
set_value(value)[source]

Set the value associated with the variable.