nineml.abstraction_layer.component.Port

class nineml.abstraction_layer.component.Port(name, mode='send', reduce_op=None)

Base class for EventPort and AnalogPort.

In general, a port has a name, which can be used to reference it, and a mode, which specifies whether it sends or receives information.

Generally, a send port can be connected to receive port to allow different components to communicate.

In the case of an AnalogPort, we have three modes, send, recv and reduce. send ports can be connected to any number of recv ports, but each recv port can only be connected to a single send port. In order to collect analog inputs from several send ports into a single port, we use a reduce port. A reduce port also requires an additional parameter, op, which specifies how to combine the information from the ports, for example, by adding their values together, +.

For example, if we had several Hodgkin-Huxley channels on a neuron, we would want each one to have a send port, i containing the current passing through that type of channel. Then, we would have a single reduce port, I_in for example, with op='+', which would combine them together to calculate the voltage change in the neuron.

__init__(name, mode='send', reduce_op=None)

Port Constructor.

Parameters:
  • name – The name of the port, as a string
  • mode – The mode of the port, which should be a string as either, send,``recv`` or reduce.
  • reduce_op – This should be None unless the mode is reduce. If the mode is reduce, then this must be a supported reduce_op

Note

Currently support reduce_op s are: +.

Methods

__init__(name[, mode, reduce_op]) Port Constructor.
is_incoming() Returns True if the port’s mode is ‘recv’ or ‘reduce’
is_outgoing() Returns True if the port’s mode is ‘send’

Attributes

mode The mode of the port.
name The name of the port, local to the current component
reduce_op The reduce operation of the port, if it is a ‘reduce’ port
is_incoming()

Returns True if the port’s mode is ‘recv’ or ‘reduce’

is_outgoing()

Returns True if the port’s mode is ‘send’

mode

The mode of the port. [‘send’,’recv’ or ‘reduce’]

name

The name of the port, local to the current component

reduce_op

The reduce operation of the port, if it is a ‘reduce’ port