Subexpression class¶
(Shortest import: from brian2.core.variables import Subexpression)
-
class
brian2.core.variables.
Subexpression
(name, owner, expr, device, dimensions=Dimension(), dtype=None, scalar=False)[source]¶ Bases:
brian2.core.variables.Variable
An object providing information about a named subexpression in a model. Most of the time
Variables.add_subexpression
should be used instead of instantiating this class directly.Parameters: name : str
The name of the subexpression.
dimensions :
Dimension
, optionalThe physical dimensions of the subexpression.
owner :
Group
The group to which the expression refers.
expr : str
The subexpression itself.
device :
Device
The device responsible for the memory access.
dtype :
dtype
, optionalThe dtype used for the expression. Defaults to core.default_float_dtype.
scalar: bool, optional :
Whether this is an expression only referring to scalar variables. Defaults to
False
Attributes
device
The Device
responsible for memory accessexpr
The expression defining the subexpression identifiers
The identifiers used in the expression 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. Details
-
device
¶ The
Device
responsible for memory access
-
expr
¶ The expression defining the subexpression
-
identifiers
¶ The identifiers used in the expression
-
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 synapseS
asS.x_post
, the synaptic indexing scheme can be used.Parameters: name : str
The name of the variable
group :
Group
The group providing the context for the indexing. Note that this
group
is not necessarily the same asVariable.owner
: a variable owned by aNeuronGroup
can be indexed in a different way if accessed via aSynapses
object.Returns: variable : object
The variable in an indexable form (without units).
-
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 synapseS
asS.x_post
, the synaptic indexing scheme can be used.Parameters: name : str
The name of the variable
group :
Group
The group providing the context for the indexing. Note that this
group
is not necessarily the same asVariable.owner
: a variable owned by aNeuronGroup
can be indexed in a different way if accessed via aSynapses
object.Returns: variable : object
The variable in an indexable form (with units).
-