本文整理汇总了Python中neurokernel.pattern.Pattern.is_connected方法的典型用法代码示例。如果您正苦于以下问题:Python Pattern.is_connected方法的具体用法?Python Pattern.is_connected怎么用?Python Pattern.is_connected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neurokernel.pattern.Pattern
的用法示例。
在下文中一共展示了Pattern.is_connected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_connected_multi_level
# 需要导入模块: from neurokernel.pattern import Pattern [as 别名]
# 或者: from neurokernel.pattern.Pattern import is_connected [as 别名]
def test_is_connected_multi_level(self):
# No connections:
p = Pattern('/aaa[0:3]', '/bbb[0:3]')
assert p.is_connected(0, 1) == False
assert p.is_connected(1, 0) == False
# Connected in one direction:
p = Pattern('/aaa[0:3]', '/bbb[0:3]')
p['/aaa[0]', '/bbb[2]'] = 1
assert p.is_connected(0, 1) == True
assert p.is_connected(1, 0) == False
# Connected in both directions:
p = Pattern('/aaa[0:3]', '/bbb[0:3]')
p['/aaa[0]', '/bbb[2]'] = 1
p['/bbb[0]', '/aaa[1]'] = 1
assert p.is_connected(0, 1) == True
assert p.is_connected(1, 0) == True
示例2: test_is_connected_single_level
# 需要导入模块: from neurokernel.pattern import Pattern [as 别名]
# 或者: from neurokernel.pattern.Pattern import is_connected [as 别名]
def test_is_connected_single_level(self):
# No connections:
p = Pattern('/[aaa,bbb]', '/[ccc,ddd]')
assert p.is_connected(0, 1) == False
assert p.is_connected(1, 0) == False
# Connected in one direction:
p = Pattern('/[aaa,bbb]', '/[ccc,ddd]')
p['/aaa', '/ccc'] = 1
assert p.is_connected(0, 1) == True
assert p.is_connected(1, 0) == False
# Connected in both directions:
p = Pattern('/[aaa,bbb,ccc]', '/[ddd,eee,fff]')
p['/aaa', '/ddd'] = 1
p['/eee', '/bbb'] = 1
assert p.is_connected(0, 1) == True
assert p.is_connected(1, 0) == True