linked_var function

(Shortest import: from brian2 import linked_var)

brian2.core.variables.linked_var(group_or_variable, name=None, index=None)[source]

Represents a link target for setting a linked variable.


group_or_variable : NeuronGroup or VariableView

Either a reference to the target NeuronGroup (e.g. G) or a direct reference to a VariableView object (e.g. G.v). In case only the group is specified, name has to be specified as well.

name : str, optional

The name of the target variable, necessary if group_or_variable is a NeuronGroup.

index : str or ndarray, optional

An indexing array (or the name of a state variable), providing a mapping from the entries in the link source to the link target.


>>> from brian2 import *
>>> G1 = NeuronGroup(10, 'dv/dt = -v / (10*ms) : volt')
>>> G2 = NeuronGroup(10, 'v : volt (linked)')
>>> G2.v = linked_var(G1, 'v')
>>> G2.v = linked_var(G1.v)  # equivalent