An IntegratorMechanism integrates its input, possibly based on its prior values. The input can be a single
scalar value or an array of scalars (list or 1d np.array). If it is a list or array, then each value is
independently integrated. The default function (
IntegratorFunction) can be parametrized to implement either a simple
increment rate, additive accumulator, or an (exponentially weighted) time-averaging of its input. It can also be
assigned a custom function.
Creating an IntegratorMechanism
An IntegratorMechanism can be created directly by calling its constructor, or using the
mechanism command and
specifying INTEGRATOR_MECHANISM as its mech_spec argument. Its function is specified in the function
argument, which can be parametrized by calling its constructor with parameter values:
>>> import psyneulink as pnl
>>> my_time_averaging_mechanism = pnl.IntegratorMechanism(function=pnl.AdaptiveIntegrator(rate=0.5))
The default_variable argument specifies the format of its input (i.e., whether it is a single scalar or an
array), as well as the value to use if none is provided when Mechanism is executed. Alternatively, the size
argument can be used to specify the length of the array, in which case it will be initialized with all zeros.
An IntegratorMechanism has a single InputPort, the
value of which is
used as the
variable for its
The default for
a custom function can also be specified, so long as it takes a numeric value, or a list or np.ndarray of numeric
values as its input, and returns a value of the same type and format. The Mechanism has a single OutputPort,
value of which is assigned the result of the call to the Mechanism’s
When an IntegratorMechanism is executed, it carries out the specified integration, and assigns the
result to the
value of its primary OutputPort. For the default
IntegratorFunction), if the value specified for default_variable is a list or array, or size is greater
than 1, each element of the array is independently integrated. If its
rate parameter is a
single value, that rate will be used for integrating each element. If the
rate parameter is a
list or array, then each element will be used as the rate for the corresponding element of the input (in this case,
rate must be the same length as the value specified for default_variable or size).
Subclass of ProcessingMechanism that integrates its input.
See Mechanism for additional arguments and attributes.
function (IntegratorFunction : default IntegratorFunction) – specifies the function used to integrate the input. Must take a single numeric value, or a list or np.array
of values, and return one of the same form.
_handle_default_variable(default_variable=None, size=None, input_ports=None, function=None, params=None)
If any parameters with len>1 have been specified for the Mechanism’s function, and Mechanism’s
default_variable has not been specified, reshape Mechanism’s variable to match function’s,
but make sure function’s has the same outer dimensionality as the Mechanism’s