本文整理汇总了Python中neurokernel.pattern.Interface.in_ports方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.in_ports方法的具体用法?Python Interface.in_ports怎么用?Python Interface.in_ports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neurokernel.pattern.Interface
的用法示例。
在下文中一共展示了Interface.in_ports方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_in_ports
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import in_ports [as 别名]
def test_in_ports(self):
# Selector with multiple levels:
i = Interface('/foo[0:2]')
i['/foo[0]'] = [0, 'in', 'spike']
i['/foo[1]'] = [1, 'out', 'spike']
df = pd.DataFrame([(0, 'in', 'spike')],
pd.MultiIndex.from_tuples([('foo', 0)],
names=['0', '1']),
['interface', 'io', 'type'],
dtype=object)
# Test returning result as Interface:
assert_frame_equal(i.in_ports(0).data, df)
# Test returning result as list of tuples:
self.assertItemsEqual(i.in_ports(0, True), df.index.tolist())
# Selector with single level:
i = Interface('/[foo,bar]')
i['/foo'] = [0, 'in', 'spike']
i['/bar'] = [1, 'out', 'spike']
df = pd.DataFrame([(0, 'in', 'spike')],
pd.MultiIndex.from_tuples([('foo',)],
names=['0']),
['interface', 'io', 'type'],
dtype=object)
# Test returning result as Interface:
assert_frame_equal(i.in_ports(0).data, df)
# Test returning result as list of tuples:
self.assertItemsEqual(i.in_ports(0, True), df.index.tolist())