A GatingProjection is a type of ModulatoryProjection that projects to the InputPort or
OutputPort of a Mechanism. It takes the value of a GatingSignal of a Gating Mechanism,
and uses it to modulate the
value of the Port to which it projects.
Creating a GatingProjection¶
A GatingProjection can be created using any of the standard ways to create a projection,
or by including it in the specification of an InputPort or
OutputPort . If a GatingProjection is created explicitly (using its constructor), its receiver
argument can be specified as a particular InputPort or OutputPort of a designated Mechanism, or simply
as the Mechanism. In the latter case, the Mechanism’s primary InputPort will be used. If the
GatingProjection is included in an InputPort or OutputPort specification, that Port will be assigned as the
receiver. If the sender and/or receiver arguments are not
specified, its initialization is deferred.
When a GatingProjection is created, its full initialization is deferred until its
receiver have been fully specified. This allows
a GatingProjection to be created before its
receiver have been created (e.g., before them in a
script), by calling its constructor without specifying its sender or receiver arguments. However, for the
GatingProjection to be operational, initialization must be completed by calling its
deferred_init method. This is
not necessary if the Port(s) to be gated are specified in the gate argument of a GatingMechanism, in which case deferred initialization is completed automatically by the
GatingMechanism when it is created.
sender of a GatingProjection is a GatingSignal of a Gating Mechanism. The
value of the
sender is used by the GatingProjection as its
variable; this is also assigned to its
gating_signal attribute, and serves as the input to the GatingProjection’s
function. The default
function for a
GatingProjection is an identity function (
Linear with slope=1 and intercept=0); that is,
it simply conveys the value of its
gating_signal to its
receiver, for use in modifying the
value of the Port that it gates. Its
receiver is the InputPort or OutputPort of a Mechanism.
A GatingProjection cannot be executed directly. It is executed when the InputPort or OutputPort to which it
projects is updated. Note that this only occurs when the Mechanism to which the Port belongs
is executed (see Lazy Evaluation for an explanation of “lazy” updating). When a
GatingProjection is executed, its
function gets the
gating_signal from its
sender and conveys that to its
receiver. This is used by the
receiver to modify the
value of the Port gated by the GatingProjection (see Modulation, InputPort Execution and OutputPort Execution for how modulation operates and how this
applies to a InputPorts and OutputPorts).
The changes in an InputPort or OutputPort’s
value in response to the execution of a
GatingProjection are not applied until the Mechanism to which the Port belongs is next executed;
see Lazy Evaluation for an explanation of “lazy” updating).
- class psyneulink.core.components.projections.modulatory.gatingprojection.GatingProjection(sender=None, receiver=None, gating_signal_params=None)¶
Subclass of ModulatoryProjection that modulates the value of an InputPort or OutputPort of a Mechanism. See Projection for additional arguments and attributes.
sender (GatingMechanism or GatingSignal : default None) – specifies the source of the
gating_signalfor the GatingProjection; if it is not specified and cannot be inferred from context , initialization is deferred.
receiver (Mechanism, InputPort or OutputPort : default None) – specifies the InputPort or OutputPort to which the GatingProjection projects; if it is not specified, and cannot be inferred from context, initialization is deferred.
gating_signal_params (Dict[param keyword: param value]) – a parameter dictionary that can be used to specify the parameters for the GatingProjection’s
sender(see Structure for a description of GatingSignal parameters).
source of the
InputPort or OutputPort to which the GatingProjection projects.
InputPort or OutputPort of a Mechanism
the value used to modify the
valueof the InputPort or OutputPort gated by the GatingProjection (see Modulation, InputPort Execution, and OutputPort Execution for how modulation operates and how this applies to InputPorts and OutputPorts).
- _instantiate_sender(sender, params=None, context=None)¶
Check that sender is not a process and that, if specified as a Mechanism, it is a GatingMechanism
- _validate_params(request_set, target_set=None, context=None)¶
Validate PROJECTION_SENDER and/or sender arg (current self.sender), and assign one of them as self.sender
Check: - that PROJECTION_SENDER is a Mechanism or Port - if it is different from .projection_sender, use it - if it is the same or is invalid, check if sender arg was provided to __init__ and is valid - if sender arg is valid use it (if PROJECTION_SENDER can’t be used); - if both were not provided, use .projection_sender - otherwise, if one was not provided and the other is invalid, generate error - when done, sender is assigned to self.sender
Note: check here only for sender’s type, NOT content (e.g., length, etc.); that is done in _instantiate_sender
Assign port if receiver is Mechanism, and match output to param being modulated
- exception psyneulink.core.components.projections.modulatory.gatingprojection.GatingProjectionError(error_value)¶