本文整理汇总了Python中neurokernel.pattern.Pattern.interface[lpu2_sel_in_spike,'io','type']方法的典型用法代码示例。如果您正苦于以下问题:Python Pattern.interface[lpu2_sel_in_spike,'io','type']方法的具体用法?Python Pattern.interface[lpu2_sel_in_spike,'io','type']怎么用?Python Pattern.interface[lpu2_sel_in_spike,'io','type']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neurokernel.pattern.Pattern
的用法示例。
在下文中一共展示了Pattern.interface[lpu2_sel_in_spike,'io','type']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_pattern
# 需要导入模块: from neurokernel.pattern import Pattern [as 别名]
# 或者: from neurokernel.pattern.Pattern import interface[lpu2_sel_in_spike,'io','type'] [as 别名]
def create_pattern(lpu1, lpu2):
lpu1_sel = ','.join(['/'+'/'.join([str(i) for i in sel]) for sel in lpu1.interface.index.tolist()])
lpu2_sel = ','.join(['/'+'/'.join([str(i) for i in sel]) for sel in lpu2.interface.index.tolist()])
pat = Pattern(lpu1_sel, lpu2_sel)
lpu1_sel_in_gpot = str(','.join( lpu1.interface.in_ports().gpot_ports().to_selectors() ))
lpu1_sel_out_gpot = str(','.join( lpu1.interface.out_ports().gpot_ports().to_selectors() ))
lpu2_sel_in_gpot = str(','.join( lpu2.interface.in_ports().gpot_ports().to_selectors() ))
lpu2_sel_out_gpot = str(','.join( lpu2.interface.out_ports().gpot_ports().to_selectors() ))
lpu1_sel_in_spike = str(','.join( lpu1.interface.in_ports().spike_ports().to_selectors() ))
lpu1_sel_out_spike = str(','.join( lpu1.interface.out_ports().spike_ports().to_selectors() ))
lpu2_sel_in_spike = str(','.join( lpu2.interface.in_ports().spike_ports().to_selectors() ))
lpu2_sel_out_spike = str(','.join( lpu2.interface.out_ports().spike_ports().to_selectors() ))
pat.interface[lpu1_sel_in_gpot, 'io', 'type'] = ['in', 'gpot']
pat.interface[lpu1_sel_out_gpot, 'io', 'type'] = ['out', 'gpot']
pat.interface[lpu2_sel_in_gpot, 'io', 'type'] = ['in', 'gpot']
pat.interface[lpu2_sel_out_gpot, 'io', 'type'] = ['out', 'gpot']
pat.interface[lpu1_sel_in_spike, 'io', 'type'] = ['in', 'spike']
pat.interface[lpu1_sel_out_spike, 'io', 'type'] = ['out', 'spike']
pat.interface[lpu2_sel_in_spike, 'io', 'type'] = ['in', 'spike']
pat.interface[lpu2_sel_out_spike, 'io', 'type'] = ['out', 'spike']
Neuron_list_12 = ['L1', 'L2', 'L3', 'L4', 'L5', 'T1']
Neuron_list_21 = ['C2', 'C3']
for i in range(768):
for neuron in Neuron_list_12:
pat['/lamina/cart'+str(i)+'/'+neuron, '/medulla/cart'+str(i)+'/'+neuron] = 1
for neuron in Neuron_list_21:
pat['/medulla/cart'+str(i)+'/'+neuron, '/lamina/cart'+str(i)+'/'+neuron] = 1
with open('lam_med_pattern', 'wb') as pat_file:
pickle.dump(pat, pat_file)
return pat
示例2: create_pattern
# 需要导入模块: from neurokernel.pattern import Pattern [as 别名]
# 或者: from neurokernel.pattern.Pattern import interface[lpu2_sel_in_spike,'io','type'] [as 别名]
def create_pattern(n_dict_1, n_dict_2, save_as=None):
"""
If `save_as` is not None, save the pattern as the specified file name.
"""
lpu1_sel_in_gpot = plsel.Selector(LPU.extract_in_gpot(n_dict_1))
lpu1_sel_out_gpot = plsel.Selector(LPU.extract_out_gpot(n_dict_1))
lpu2_sel_in_gpot = plsel.Selector(LPU.extract_in_gpot(n_dict_2))
lpu2_sel_out_gpot = plsel.Selector(LPU.extract_out_gpot(n_dict_2))
lpu1_sel_in_spike = plsel.Selector(LPU.extract_in_spk(n_dict_1))
lpu1_sel_out_spike = plsel.Selector(LPU.extract_out_spk(n_dict_1))
lpu2_sel_in_spike = plsel.Selector(LPU.extract_in_spk(n_dict_2))
lpu2_sel_out_spike = plsel.Selector(LPU.extract_out_spk(n_dict_2))
lpu1_sel_out = plsel.Selector.union(lpu1_sel_out_gpot, lpu1_sel_out_spike)
lpu2_sel_out = plsel.Selector.union(lpu2_sel_out_gpot, lpu2_sel_out_spike)
lpu1_sel_in = plsel.Selector.union(lpu1_sel_in_gpot, lpu1_sel_in_spike)
lpu2_sel_in = plsel.Selector.union(lpu2_sel_in_gpot, lpu2_sel_in_spike)
lpu1_sel = plsel.Selector.union(lpu1_sel_out, lpu1_sel_in)
lpu2_sel = plsel.Selector.union(lpu2_sel_out, lpu2_sel_in)
pat = Pattern(lpu1_sel, lpu2_sel)
pat.interface[lpu1_sel_in_gpot, 'io', 'type'] = ['in', 'gpot']
pat.interface[lpu1_sel_out_gpot, 'io', 'type'] = ['out', 'gpot']
pat.interface[lpu2_sel_in_gpot, 'io', 'type'] = ['in', 'gpot']
pat.interface[lpu2_sel_out_gpot, 'io', 'type'] = ['out', 'gpot']
pat.interface[lpu1_sel_in_spike, 'io', 'type'] = ['in', 'spike']
pat.interface[lpu1_sel_out_spike, 'io', 'type'] = ['out', 'spike']
pat.interface[lpu2_sel_in_spike, 'io', 'type'] = ['in', 'spike']
pat.interface[lpu2_sel_out_spike, 'io', 'type'] = ['out', 'spike']
Neuron_list_12 = ['L1', 'L2', 'L3', 'L4', 'L5', 'T1']
Neuron_list_21 = ['C2', 'C3']
for i in range(768):
for neuron in Neuron_list_12:
pat['/lamina/cart'+str(i)+'/'+neuron, '/medulla/cart'+str(i)+'/'+neuron] = 1
for neuron in Neuron_list_21:
pat['/medulla/cart'+str(i)+'/'+neuron, '/lamina/cart'+str(i)+'/'+neuron] = 1
if save_as:
with open(save_as, 'wb') as pat_file:
pickle.dump(pat, pat_file)
return pat