neurokernel.pattern.Interface

class neurokernel.pattern.Interface(selector='', columns=['interface', 'io', 'type'])[source]

Container for set of interface comprising ports.

This class contains information about a set of interfaces comprising path-like identifiers and the attributes associated with them. By default, each port must have at least the following attributes; other attributes may be added:

  • interface - indicates which interface a port is associated with.
  • io - indicates whether the port receives input (‘in’) or emits output (‘out’).
  • type - indicates whether the port emits/receives spikes or graded potentials.

All port identifiers in an interface must be unique. For two interfaces to be deemed compatible, they must contain the same port identifiers and their identifiers’ ‘io’ attributes must be the inverse of each other (i.e., every ‘in’ port in one interface must be mirrored by an ‘out’ port in the other interface.

Examples

>>> i = Interface('/foo[0:4],/bar[0:3]')
>>> i['/foo[0:2]', 'interface', 'io', 'type'] = [0, 'in', 'spike']
>>> i['/foo[2:4]', 'interface', 'io', 'type'] = [1, 'out', 'spike']
data

pandas.DataFrame – Port attribute data.

index

pandas.MultiIndex – Index of port identifiers.

Parameters:
  • selector (str, unicode, or sequence) – Selector string (e.g., ‘foo[0:2]’) or sequence of token sequences (e.g., [[‘foo’, (0, 2)]]) describing the port identifiers comprised by the interface.
  • columns (list, default = ['interface', 'io', 'type']) – Data column names.

See also

plsel.SelectorMethods

__init__(selector='', columns=['interface', 'io', 'type'])[source]

x.__init__(…) initializes x; see help(type(x)) for signature

Methods

__init__([selector, columns]) x.__init__(…) initializes x; see help(type(x)) for signature
clear() Clear all ports in class instance.
copy() Make a copy of this object.
data_select(f[, inplace]) Restrict Interface data with a selection function.
equals(other) Check whether this interface is equivalent to another interface.
from_csv(file_name, **kwargs) Create an Interface from a properly formatted CSV file.
from_df(df) Create an Interface from a properly formatted DataFrame.
from_dict(d) Create an Interface from a dictionary of selectors and data values.
from_graph(g) Create an Interface from a NetworkX graph.
from_selectors(sel[, sel_in, sel_out, …]) Create an Interface instance from selectors.
get_common_ports(a, i, b[, t]) Get port identifiers common to this and another Interface instance.
gpot_ports([i, tuples]) Restrict Interface ports to graded potential ports.
in_ports([i, tuples]) Restrict Interface ports to input ports.
interface_ports([i, tuples]) Restrict Interface ports to specific interface.
is_compatible(a, i, b[, allow_subsets]) Check whether two interfaces can be connected.
is_in_interfaces(s) Check whether ports comprised by a selector are in the stored interfaces.
out_ports([i, tuples]) Restrict Interface ports to output ports.
port_select(f[, inplace]) Restrict Interface ports with a selection function.
set_pm(t, pm) Set port mapper associated with a specific port type.
spike_ports([i, tuples]) Restrict Interface ports to spiking ports.
to_selectors([i]) Retrieve Interface’s port identifiers as list of path-like selectors.
to_tuples([i]) Retrieve Interface’s port identifiers as list of tuples.
which_int(s) Return the interface containing the identifiers comprised by a selector.

Attributes

idx_levels Number of levels in Interface index.
index Interface index.
interface_ids Interface identifiers.
io_inv Returns new Interface instance with inverse input-output attributes.