当前位置: 首页>>代码示例>>Python>>正文


Python Pattern.interface[m2_int_sel_out_gpot]方法代码示例

本文整理汇总了Python中pattern.Pattern.interface[m2_int_sel_out_gpot]方法的典型用法代码示例。如果您正苦于以下问题:Python Pattern.interface[m2_int_sel_out_gpot]方法的具体用法?Python Pattern.interface[m2_int_sel_out_gpot]怎么用?Python Pattern.interface[m2_int_sel_out_gpot]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pattern.Pattern的用法示例。


在下文中一共展示了Pattern.interface[m2_int_sel_out_gpot]方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: emulate

# 需要导入模块: from pattern import Pattern [as 别名]
# 或者: from pattern.Pattern import interface[m2_int_sel_out_gpot] [as 别名]
    def emulate(n, steps):
        assert(n>1)
        n = str(n)

        # Set up emulation:
        man = Manager(get_random_port(), get_random_port(), get_random_port())
        man.add_brok()

        m1_int_sel_in_gpot = '/a/in/gpot0,/a/in/gpot1'
        m1_int_sel_out_gpot = '/a/out/gpot0,/a/out/gpot1'
        m1_int_sel_in_spike = '/a/in/spike0,/a/in/spike1'
        m1_int_sel_out_spike = '/a/out/spike0,/a/out/spike1'
        m1_int_sel = ','.join([m1_int_sel_in_gpot, m1_int_sel_out_gpot,
                               m1_int_sel_in_spike, m1_int_sel_out_spike])
        m1_int_sel_in = ','.join([m1_int_sel_in_gpot, m1_int_sel_in_spike])
        m1_int_sel_out = ','.join([m1_int_sel_out_gpot, m1_int_sel_out_spike])
        m1_int_sel_gpot = ','.join([m1_int_sel_in_gpot, m1_int_sel_out_gpot])
        m1_int_sel_spike = ','.join([m1_int_sel_in_spike, m1_int_sel_out_spike])
        N1_gpot = SelectorMethods.count_ports(m1_int_sel_gpot)
        N1_spike = SelectorMethods.count_ports(m1_int_sel_spike)
        m1 = MyModule(m1_int_sel,
                      m1_int_sel_in, m1_int_sel_out,
                      m1_int_sel_gpot, m1_int_sel_spike,
                      np.zeros(N1_gpot, np.float64),
                      np.zeros(N1_spike, int), ['interface', 'io', 'type'],
                      man.port_data, man.port_ctrl, man.port_time, 'm1', None,
                      False, True)
        man.add_mod(m1)

        m2_int_sel_in_gpot = '/b/in/gpot0,/b/in/gpot1'
        m2_int_sel_out_gpot = '/b/out/gpot0,/b/out/gpot1'
        m2_int_sel_in_spike = '/b/in/spike0,/b/in/spike1'
        m2_int_sel_out_spike = '/b/out/spike0,/b/out/spike1'
        m2_int_sel = ','.join([m2_int_sel_in_gpot, m2_int_sel_out_gpot,
                               m2_int_sel_in_spike, m2_int_sel_out_spike])
        m2_int_sel_in = ','.join([m2_int_sel_in_gpot, m2_int_sel_in_spike])
        m2_int_sel_out = ','.join([m2_int_sel_out_gpot, m2_int_sel_out_spike])
        m2_int_sel_gpot = ','.join([m2_int_sel_in_gpot, m2_int_sel_out_gpot])
        m2_int_sel_spike = ','.join([m2_int_sel_in_spike, m2_int_sel_out_spike])
        N2_gpot = SelectorMethods.count_ports(m2_int_sel_gpot)
        N2_spike = SelectorMethods.count_ports(m2_int_sel_spike),
        m2 = MyModule(m2_int_sel,
                      m2_int_sel_in, m2_int_sel_out,
                      m2_int_sel_gpot, m2_int_sel_spike,
                      np.zeros(N2_gpot, np.float64),
                      np.zeros(N2_spike, int), ['interface', 'io', 'type'],
                      man.port_data, man.port_ctrl, man.port_time, 'm2', None,
                      False, True)
        man.add_mod(m2)

        # Make sure that all ports in the patterns' interfaces are set so 
        # that they match those of the modules:
        pat12 = Pattern(m1_int_sel, m2_int_sel)
        pat12.interface[m1_int_sel_out_gpot] = [0, 'in', 'gpot']
        pat12.interface[m1_int_sel_in_gpot] = [0, 'out', 'gpot']
        pat12.interface[m1_int_sel_out_spike] = [0, 'in', 'spike']
        pat12.interface[m1_int_sel_in_spike] = [0, 'out', 'spike']
        pat12.interface[m2_int_sel_in_gpot] = [1, 'out', 'gpot']
        pat12.interface[m2_int_sel_out_gpot] = [1, 'in', 'gpot']
        pat12.interface[m2_int_sel_in_spike] = [1, 'out', 'spike']
        pat12.interface[m2_int_sel_out_spike] = [1, 'in', 'spike']
        pat12['/a/out/gpot0', '/b/in/gpot0'] = 1
        pat12['/a/out/gpot1', '/b/in/gpot1'] = 1
        pat12['/b/out/gpot0', '/a/in/gpot0'] = 1
        pat12['/b/out/gpot1', '/a/in/gpot1'] = 1
        pat12['/a/out/spike0', '/b/in/spike0'] = 1
        pat12['/a/out/spike1', '/b/in/spike1'] = 1
        pat12['/b/out/spike0', '/a/in/spike0'] = 1
        pat12['/b/out/spike1', '/a/in/spike1'] = 1
        man.connect(m1, m2, pat12, 0, 1)

        # To set the emulation to exit after executing a fixed number of steps,
        # start it as follows and remove the sleep statement:
        man.start(steps=steps)
        # man.start()
        # time.sleep(2)
        man.stop()
        return m1
开发者ID:chungheng,项目名称:neurokernel,代码行数:80,代码来源:core.py

示例2: Pattern

# 需要导入模块: from pattern import Pattern [as 别名]
# 或者: from pattern.Pattern import interface[m2_int_sel_out_gpot] [as 别名]
    man.add(MyModule, m2_id, m2_int_sel, m2_int_sel_in, m2_int_sel_out,
            m2_int_sel_gpot, m2_int_sel_spike,
            np.zeros(N2_gpot, dtype=np.double),
            np.zeros(N2_spike, dtype=int),
            ['interface', 'io', 'type'],
            CTRL_TAG, GPOT_TAG, SPIKE_TAG, time_sync=True)

    # Make sure that all ports in the patterns' interfaces are set so 
    # that they match those of the modules:
    pat12 = Pattern(m1_int_sel, m2_int_sel)
    pat12.interface[m1_int_sel_out_gpot] = [0, 'in', 'gpot']
    pat12.interface[m1_int_sel_in_gpot] = [0, 'out', 'gpot']
    pat12.interface[m1_int_sel_out_spike] = [0, 'in', 'spike']
    pat12.interface[m1_int_sel_in_spike] = [0, 'out', 'spike']
    pat12.interface[m2_int_sel_in_gpot] = [1, 'out', 'gpot']
    pat12.interface[m2_int_sel_out_gpot] = [1, 'in', 'gpot']
    pat12.interface[m2_int_sel_in_spike] = [1, 'out', 'spike']
    pat12.interface[m2_int_sel_out_spike] = [1, 'in', 'spike']
    pat12['/a/out/gpot0', '/b/in/gpot0'] = 1
    pat12['/a/out/gpot1', '/b/in/gpot1'] = 1
    pat12['/b/out/gpot0', '/a/in/gpot0'] = 1
    pat12['/b/out/gpot1', '/a/in/gpot1'] = 1
    pat12['/a/out/spike0', '/b/in/spike0'] = 1
    pat12['/a/out/spike1', '/b/in/spike1'] = 1
    pat12['/b/out/spike0', '/a/in/spike0'] = 1
    pat12['/b/out/spike1', '/a/in/spike1'] = 1
    man.connect(m1_id, m2_id, pat12, 0, 1)

    # Start emulation and allow it to run for a little while before shutting
    # down.  To set the emulation to exit after executing a fixed number of
    # steps, start it as follows and remove the sleep statement:
开发者ID:CEPBEP,项目名称:neurokernel,代码行数:33,代码来源:core.py

示例3: Pattern

# 需要导入模块: from pattern import Pattern [as 别名]
# 或者: from pattern.Pattern import interface[m2_int_sel_out_gpot] [as 别名]
        ["interface", "io", "type"],
        CTRL_TAG,
        GPOT_TAG,
        SPIKE_TAG,
        time_sync=True,
    )

    # Make sure that all ports in the patterns' interfaces are set so
    # that they match those of the modules:
    pat12 = Pattern(m1_int_sel, m2_int_sel)
    pat12.interface[m1_int_sel_out_gpot] = [0, "in", "gpot"]
    pat12.interface[m1_int_sel_in_gpot] = [0, "out", "gpot"]
    pat12.interface[m1_int_sel_out_spike] = [0, "in", "spike"]
    pat12.interface[m1_int_sel_in_spike] = [0, "out", "spike"]
    pat12.interface[m2_int_sel_in_gpot] = [1, "out", "gpot"]
    pat12.interface[m2_int_sel_out_gpot] = [1, "in", "gpot"]
    pat12.interface[m2_int_sel_in_spike] = [1, "out", "spike"]
    pat12.interface[m2_int_sel_out_spike] = [1, "in", "spike"]
    pat12["/a/out/gpot0", "/b/in/gpot0"] = 1
    pat12["/a/out/gpot1", "/b/in/gpot1"] = 1
    pat12["/b/out/gpot0", "/a/in/gpot0"] = 1
    pat12["/b/out/gpot1", "/a/in/gpot1"] = 1
    pat12["/a/out/spike0", "/b/in/spike0"] = 1
    pat12["/a/out/spike1", "/b/in/spike1"] = 1
    pat12["/b/out/spike0", "/a/in/spike0"] = 1
    pat12["/b/out/spike1", "/a/in/spike1"] = 1
    man.connect(m1_id, m2_id, pat12, 0, 1)

    # Start emulation and allow it to run for a little while before shutting
    # down.  To set the emulation to exit after executing a fixed number of
    # steps, start it as follows and remove the sleep statement:
开发者ID:Taaccoo-beta,项目名称:neurokernel,代码行数:33,代码来源:core.py


注:本文中的pattern.Pattern.interface[m2_int_sel_out_gpot]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。