本文整理汇总了Python中neurokernel.pattern.Interface.get_common_ports方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.get_common_ports方法的具体用法?Python Interface.get_common_ports怎么用?Python Interface.get_common_ports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neurokernel.pattern.Interface
的用法示例。
在下文中一共展示了Interface.get_common_ports方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_common_ports_unequal_num_levels
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import get_common_ports [as 别名]
def test_get_common_ports_unequal_num_levels(self):
# Without type, some with only one level:
i = Interface('/foo[0:6],/bar')
i['/*', 'interface'] = 0
j = Interface('/bar,/baz')
j['/*', 'interface'] = 0
assert i.get_common_ports(0, j, 0, 'spike') == []
self.assertItemsEqual(i.get_common_ports(0, j, 0),
[('bar',)])
# Without type, more than one level:
i = Interface('/foo[0:6],/bar[0:2]/baz')
i['/*', 'interface'] = 0
j = Interface('/foo[3:9]')
j['/*', 'interface'] = 0
assert i.get_common_ports(0, j, 0, 'spike') == []
self.assertItemsEqual(i.get_common_ports(0, j, 0),
[('foo', 3), ('foo', 4), ('foo', 5)])
# With type, some with only one level:
i = Interface('/foo[0:6],/bar,/baz')
i['/foo[3,4],/bar', 'interface', 'type'] = [0, 'spike']
j = Interface('/bar,/baz,/qux')
j['/bar,/baz', 'interface', 'type'] = [0, 'spike']
self.assertItemsEqual(i.get_common_ports(0, j, 0, 'spike'),
[('bar',)])
# With type, more than one level:
i = Interface('/foo[0:6],/bar[0:2]/baz')
i['/foo[3,4]', 'interface', 'type'] = [0, 'spike']
j = Interface('/foo[3:9]')
j['/foo[3,4]', 'interface', 'type'] = [0, 'spike']
self.assertItemsEqual(i.get_common_ports(0, j, 0, 'spike'),
[('foo', 3), ('foo', 4)])
示例2: test_get_common_ports
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import get_common_ports [as 别名]
def test_get_common_ports(self):
# Without type, single level:
i = Interface('/foo,/bar,/baz')
i['/*', 'interface'] = 0
j = Interface('/bar,/baz,/qux')
j['/*', 'interface'] = 0
assert i.get_common_ports(0, j, 0, 'spike') == []
self.assertItemsEqual(i.get_common_ports(0, j, 0),
[('bar',), ('baz',)])
# Without type, multiple levels:
i = Interface('/foo[0:6]')
i['/*', 'interface'] = 0
j = Interface('/foo[3:9]')
j['/*', 'interface'] = 0
assert i.get_common_ports(0, j, 0, 'spike') == []
self.assertItemsEqual(i.get_common_ports(0, j, 0),
[('foo', 3), ('foo', 4), ('foo', 5)])
# With type, single level:
i = Interface('/foo,/bar,/baz')
i['/foo,/bar', 'interface', 'type'] = [0, 'spike']
j = Interface('/bar,/baz,/qux')
j['/bar,/baz', 'interface', 'type'] = [0, 'spike']
self.assertItemsEqual(i.get_common_ports(0, j, 0, 'spike'),
[('bar',)])
# With type, multiple levels:
i = Interface('/foo[0:6]')
i['/foo[3,4]', 'interface', 'type'] = [0, 'spike']
j = Interface('/foo[3:9]')
j['/foo[3,4]', 'interface', 'type'] = [0, 'spike']
self.assertItemsEqual(i.get_common_ports(0, j, 0, 'spike'),
[('foo', 3), ('foo', 4)])