Variables class
(Shortest import: from brian2.core.variables import Variables)
-
class
brian2.core.variables.
Variables
(owner, default_index='_idx')[source] Bases:
collections.abc.Mapping
A container class for storing
Variable
objects. Instances of this class are used as theGroup.variables
attribute and can be accessed as (read-only) dictionaries.Attributes
indices
A dictionary given the index name for every array name owner
A reference to the Group
owning these variablesMethods
add_arange
(name, size[, start, dtype, …])Add an array, initialized with a range of integers. add_array
(name, size[, dimensions, values, …])Add an array (initialized with zeros). add_arrays
(names, size[, dimensions, dtype, …])Adds several arrays (initialized with zeros) with the same attributes (size, units, etc.). add_auxiliary_variable
(name[, dimensions, …])Add an auxiliary variable (most likely one that is added automatically to abstract code, e.g. add_constant
(name, value[, dimensions])Add a scalar constant (e.g. add_dynamic_array
(name, size[, dimensions, …])Add a dynamic array. add_object
(name, obj)Add an arbitrary Python object. add_reference
(name, group[, varname, index])Add a reference to a variable defined somewhere else (possibly under a different name). add_references
(group, varnames[, index])Add all Variable
objects from a name toVariable
mapping with the same name as in the original mapping.add_referred_subexpression
(name, group, …)add_subexpression
(name, expr[, dimensions, …])Add a named subexpression. create_clock_variables
(clock[, prefix])Convenience function to add the t
anddt
attributes of aclock
.Details
-
indices
A dictionary given the index name for every array name
-
add_arange
(name, size, start=0, dtype=<class 'numpy.int32'>, constant=True, read_only=True, unique=True, index=None)[source] Add an array, initialized with a range of integers.
-
add_array
(name, size, dimensions=Dimension(), values=None, dtype=None, constant=False, read_only=False, scalar=False, unique=False, index=None)[source] Add an array (initialized with zeros).
-
add_arrays
(names, size, dimensions=Dimension(), dtype=None, constant=False, read_only=False, scalar=False, unique=False, index=None)[source] Adds several arrays (initialized with zeros) with the same attributes (size, units, etc.).
-
add_auxiliary_variable
(name, dimensions=Dimension(), dtype=None, scalar=False)[source] Add an auxiliary variable (most likely one that is added automatically to abstract code, e.g.
_cond
for a threshold condition), specifying its type and unit for code generation.
-
add_constant
(name, value, dimensions=Dimension())[source] Add a scalar constant (e.g. the number of neurons
N
).
-
add_dynamic_array
(name, size, dimensions=Dimension(), values=None, dtype=None, constant=False, needs_reference_update=False, resize_along_first=False, read_only=False, unique=False, scalar=False, index=None)[source] Add a dynamic array.
-
add_object
(name, obj)[source] Add an arbitrary Python object. This is only meant for internal use and therefore only names starting with an underscore are allowed.
-
add_reference
(name, group, varname=None, index=None)[source] Add a reference to a variable defined somewhere else (possibly under a different name). This is for example used in
Subgroup
andSynapses
to refer to variables in the respectiveNeuronGroup
.
-
add_references
(group, varnames, index=None)[source] Add all
Variable
objects from a name toVariable
mapping with the same name as in the original mapping.
-