neurokernel.pm.BasePortMapper¶
-
class
neurokernel.pm.
BasePortMapper
(selector, portmap=None)[source]¶ Maps integer sequence to/from path-like port identifiers.
Examples
>>> pm = BasePortMapper('/[a,b][0:2]') >>> print pm.ports_to_inds('/b[0:2]') array([2, 3]) >>> print pm.inds_to_ports([0, 1]) [('a', 0), ('a', 1)]
Parameters: - selector (str, unicode, or sequence) – Selector string (e.g., ‘/foo[0:2]’) or sequence of token sequences (e.g., [[‘foo’, (0, 2)]]) to map to data.
- portmap (sequence of int) – Integer indices to map to port identifiers. If no map is specified, it is assumed to be an array of consecutive integers from 0 through one less than the number of ports.
-
index
¶ pandas.MultiIndex – Index of port identifiers.
-
portmap
¶ pandas.Series – Map of port identifiers to integer indices.
Notes
The selectors may not contain any ‘*’ or ‘[:]’ characters. A single port identifier may be mapped to multiple integer indices, but not vice-versa.
-
__init__
(selector, portmap=None)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
Methods
__init__
(selector[, portmap])x.__init__(…) initializes x; see help(type(x)) for signature copy
()Return copy of this port mapper. equals
(pm)Check whether this mapper is equivalent to another mapper. from_index
(idx[, portmap])Create port mapper from a Pandas index and a sequence of integer indices. from_pm
(pm)Create a new port mapper instance given an existing instance. get_map
(selector)Retrieve integer indices associated with selector. inds_to_ports
(inds)Convert list of integer indices to port identifiers. ports_to_inds
(selector)Convert port selector to list of integer indices. set_map
(selector, portmap)Set mapped integer index associated with selector. Attributes
index
Port mapper index.