# GatingProjection¶

## Overview¶

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 GatingProjection’s receiver. If the sender and/or receiver arguments are not specified, its initialization is deferred.

### Deferred Initialization¶

When a GatingProjection is created, its full initialization is deferred until its sender and receiver have been fully specified. This allows a GatingProjection to be created before its sender and/or 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.

## Structure¶

The 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.

## Execution¶

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).

Note

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 Reference¶

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.

Parameters
sender

source of the gating_signal.

Type

GatingSignal

receiver

InputPort or OutputPort to which the GatingProjection projects.

Type

InputPort or OutputPort of a Mechanism

variable

same as gating_signal.

Type

2d np.array

gating_signal

the value of the GatingProjection’s sender.

Type

1d np.array

value

the value used to modify the value of 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).

Type

float

projection_sender

alias of psyneulink.core.components.mechanisms.modulatory.control.gating.gatingmechanism.GatingMechanism

_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

Parameters
• request_set

• target_set

• context

Returns

_instantiate_receiver(context=None)

Assign port if receiver is Mechanism, and match output to param being modulated

exception psyneulink.core.components.projections.modulatory.gatingprojection.GatingProjectionError(error_value)