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