Constant
self, name, value) core.Constant.Constant(
Constant parameter that can be used by all neurons and synapses.
The class Constant
derives from float
, so any legal operation on floats (addition, multiplication) can be used.
If a Neuron/Synapse defines a parameter with the same name, the constant parameters will not be visible.
Example:
= ann.Constant('tau', 20)
tau = ann.Constant('factor', 0.1)
factor = ann.Constant('real_tau', tau*factor)
real_tau
= ann.Neuron(
neuron ='''
equations real_tau*dr/dt + r =1.0
'''
)
The value of the constant can be changed anytime with the set()
method. Assignments will have no effect (e.g. tau = 10.0
only creates a new float).
The value of constants defined as combination of other constants (real_tau
) is not updated if the value of these constants changes (changing tau
with tau.set(10.0)
will not modify the value of real_tau
).
Parameters
Name | Type | Description | Default |
---|---|---|---|
name | name of the constant (unique), which can be used in equations. | required | |
value | the value of the constant, which must be a float, or a combination of Constants. | required |
Attributes
Name | Description |
---|---|
name | Name. |
value | Value. |
Methods
Name | Description |
---|---|
set | Changes the value of the constant. |
set
set(value, network=None) core.Constant.Constant.
Changes the value of the constant.
Parameters
Name | Type | Description | Default |
---|---|---|---|
value | float | Value. | required |
network | Network instance which should be updated. By default, all active networks are updated. | None |