本文整理汇总了Python中neurokernel.pattern.Pattern.interface[m2_sel_out_spike]方法的典型用法代码示例。如果您正苦于以下问题:Python Pattern.interface[m2_sel_out_spike]方法的具体用法?Python Pattern.interface[m2_sel_out_spike]怎么用?Python Pattern.interface[m2_sel_out_spike]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neurokernel.pattern.Pattern
的用法示例。
在下文中一共展示了Pattern.interface[m2_sel_out_spike]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_transmit_spikes_one_to_many
# 需要导入模块: from neurokernel.pattern import Pattern [as 别名]
# 或者: from neurokernel.pattern.Pattern import interface[m2_sel_out_spike] [as 别名]
def test_transmit_spikes_one_to_many(self):
m1_sel_in_gpot = Selector('')
m1_sel_out_gpot = Selector('')
m1_sel_in_spike = Selector('')
m1_sel_out_spike = Selector('/m1/out/spike[0:4]')
m1_sel, m1_sel_in, m1_sel_out, m1_sel_gpot, m1_sel_spike = \
make_sels(m1_sel_in_gpot, m1_sel_out_gpot, m1_sel_in_spike, m1_sel_out_spike)
N1_gpot = SelectorMethods.count_ports(m1_sel_gpot)
N1_spike = SelectorMethods.count_ports(m1_sel_spike)
m2_sel_in_gpot = Selector('')
m2_sel_out_gpot = Selector('')
m2_sel_in_spike = Selector('/m2/in/spike[0:4]')
m2_sel_out_spike = Selector('')
m2_sel, m2_sel_in, m2_sel_out, m2_sel_gpot, m2_sel_spike = \
make_sels(m2_sel_in_gpot, m2_sel_out_gpot, m2_sel_in_spike, m2_sel_out_spike)
N2_gpot = SelectorMethods.count_ports(m2_sel_gpot)
N2_spike = SelectorMethods.count_ports(m2_sel_spike)
m1_id = 'm1'
self.man.add(MyModule1, m1_id,
m1_sel, m1_sel_in, m1_sel_out,
m1_sel_gpot, m1_sel_spike,
np.zeros(N1_gpot, dtype=np.double),
np.zeros(N1_spike, dtype=int),
device=0, debug=debug, out_spike_data=[1, 0, 0, 0])
f, out_file_name = tempfile.mkstemp()
os.close(f)
m2_id = 'm2'
self.man.add(MyModule2, m2_id,
m2_sel, m2_sel_in, m2_sel_out,
m2_sel_gpot, m2_sel_spike,
np.zeros(N2_gpot, dtype=np.double),
np.zeros(N2_spike, dtype=int),
device=1, debug=debug, out_file_name=out_file_name)
pat12 = Pattern(m1_sel, m2_sel)
pat12.interface[m1_sel_out_gpot] = [0, 'in', 'gpot']
pat12.interface[m1_sel_in_gpot] = [0, 'out', 'gpot']
pat12.interface[m1_sel_out_spike] = [0, 'in', 'spike']
pat12.interface[m1_sel_in_spike] = [0, 'out', 'spike']
pat12.interface[m2_sel_in_gpot] = [1, 'out', 'gpot']
pat12.interface[m2_sel_out_gpot] = [1, 'in', 'gpot']
pat12.interface[m2_sel_in_spike] = [1, 'out', 'spike']
pat12.interface[m2_sel_out_spike] = [1, 'in', 'spike']
pat12['/m1/out/spike[0]', '/m2/in/spike[0]'] = 1
pat12['/m1/out/spike[0]', '/m2/in/spike[1]'] = 1
pat12['/m1/out/spike[0]', '/m2/in/spike[2]'] = 1
pat12['/m1/out/spike[0]', '/m2/in/spike[3]'] = 1
self.man.connect(m1_id, m2_id, pat12, 0, 1)
# Run emulation for 2 steps:
self.man.spawn()
self.man.start(2)
self.man.wait()
# Get output of m2:
with open(out_file_name, 'r') as f:
output = pickle.load(f)
os.remove(out_file_name)
self.assertSequenceEqual(list(output), [1, 1, 1, 1])