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


Python runtime.step_nodenet函数代码示例

本文整理汇总了Python中micropsi_core.runtime.step_nodenet函数的典型用法代码示例。如果您正苦于以下问题:Python step_nodenet函数的具体用法?Python step_nodenet怎么用?Python step_nodenet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_clear_monitor

def test_clear_monitor(fixed_nodenet):
    monitor = micropsi.add_gate_monitor(fixed_nodenet, 'A1', 'gen')
    micropsi.step_nodenet(fixed_nodenet)
    micropsi.clear_monitor(fixed_nodenet, monitor['uid'])
    data = micropsi.get_monitor_data(fixed_nodenet)
    values = data['monitors'][monitor['uid']]['values']
    assert len(values.keys()) == 0
开发者ID:conorshankey,项目名称:micropsi2,代码行数:7,代码来源:test_runtime_monitors.py

示例2: test_export_monitor_data_with_id

def test_export_monitor_data_with_id(fixed_nodenet):
    monitor1 = micropsi.add_gate_monitor(fixed_nodenet, 'A1', 'gen')
    micropsi.add_gate_monitor(fixed_nodenet, 'B1', 'gen')
    micropsi.step_nodenet(fixed_nodenet)
    data = micropsi.export_monitor_data(fixed_nodenet, monitor_uid=monitor1['uid'])
    assert data['node_name'] == 'A1'
    assert 'values' in data
开发者ID:conorshankey,项目名称:micropsi2,代码行数:7,代码来源:test_runtime_monitors.py

示例3: test_export_monitor_data_with_id

def test_export_monitor_data_with_id(fixed_nodenet):
    uid1 = micropsi.add_gate_monitor(fixed_nodenet, 'n0001', 'gen', name="Testmonitor")
    micropsi.add_gate_monitor(fixed_nodenet, 'n0003', 'gen')
    micropsi.step_nodenet(fixed_nodenet)
    data = micropsi.export_monitor_data(fixed_nodenet, monitor_uid=uid1)
    assert data['name'] == 'Testmonitor'
    assert 'values' in data
开发者ID:ianupright,项目名称:micropsi2,代码行数:7,代码来源:test_runtime_monitors.py

示例4: test_grow_partitions

def test_grow_partitions(test_nodenet):
    nodenet = micropsi.get_nodenet(test_nodenet)
    netapi = nodenet.netapi
    nodespace = netapi.create_nodespace(None, name="partition", options={
        "new_partition": True,
        "initial_number_of_nodes": 2,
        "average_elements_per_node_assumption": 4,
        "initial_number_of_nodespaces": 1
    })

    for i in range(20):
        netapi.create_node("Pipe", nodespace.uid, "N %d" % i)

    partition = nodespace.partition

    # growby (NoN // 2): 2,3,4,6,9,13,19,28
    assert len(partition.allocated_nodes) == 28
    assert partition.NoE > 28 * 4

    for i in range(2):
        netapi.create_nodespace(nodespace.uid, name="NS %d" % i)

    assert len(partition.allocated_nodespaces) == 4

    # step, save, and load the net to make sure all data structures have been grown properly
    micropsi.step_nodenet(test_nodenet)
    micropsi.save_nodenet(test_nodenet)
    micropsi.revert_nodenet(test_nodenet)
    micropsi.step_nodenet(test_nodenet)
开发者ID:joschabach,项目名称:micropsi2,代码行数:29,代码来源:test_nodenet_partitions.py

示例5: test_clear_monitor

def test_clear_monitor(fixed_nodenet):
    uid = micropsi.add_gate_monitor(fixed_nodenet, 'n0001', 'gen')
    micropsi.step_nodenet(fixed_nodenet)
    micropsi.clear_monitor(fixed_nodenet, uid)
    data = micropsi.get_monitor_data(fixed_nodenet)
    values = data['monitors'][uid]['values']
    assert len(values.keys()) == 0
开发者ID:ianupright,项目名称:micropsi2,代码行数:7,代码来源:test_runtime_monitors.py

示例6: test_export_monitor_data

def test_export_monitor_data(fixed_nodenet):
    monitor1 = micropsi.add_gate_monitor(fixed_nodenet, 'A1', 'gen')
    monitor2 = micropsi.add_gate_monitor(fixed_nodenet, 'B1', 'gen')
    micropsi.step_nodenet(fixed_nodenet)
    data = micropsi.export_monitor_data(fixed_nodenet)
    assert monitor1['uid'] in data
    assert 'values' in data[monitor1['uid']]
    assert monitor2['uid'] in data
开发者ID:conorshankey,项目名称:micropsi2,代码行数:8,代码来源:test_runtime_monitors.py

示例7: test_node_logic_sensor_datasource

def test_node_logic_sensor_datasource(test_nodenet, default_world):
    net, netapi, source = prepare(test_nodenet)
    micropsi.set_nodenet_properties(test_nodenet, worldadapter="Default", world_uid=default_world)
    register = netapi.create_node("Register", None)
    netapi.link_sensor(register, "static_on", "gen", weight=0.35)
    micropsi.step_nodenet(test_nodenet)
    micropsi.step_nodenet(test_nodenet)
    assert round(register.get_gate("gen").activation, 3) == 0.35
开发者ID:joschabach,项目名称:micropsi2,代码行数:8,代码来源:test_node_logic.py

示例8: test_get_monitor_data

def test_get_monitor_data(fixed_nodenet):
    monitor = micropsi.add_gate_monitor(fixed_nodenet, 'A1', 'gen')
    micropsi.step_nodenet(fixed_nodenet)
    data = micropsi.get_monitor_data(fixed_nodenet)
    assert data['current_step'] == 1
    assert data['monitors'][monitor['uid']]['node_name'] == 'A1'
    values = data['monitors'][monitor['uid']]['values']
    assert len(values.keys()) == 1
开发者ID:conorshankey,项目名称:micropsi2,代码行数:8,代码来源:test_runtime_monitors.py

示例9: test_export_monitor_data

def test_export_monitor_data(fixed_nodenet):
    uid1 = micropsi.add_gate_monitor(fixed_nodenet, 'n0001', 'gen')
    uid2 = micropsi.add_gate_monitor(fixed_nodenet, 'n0003', 'gen')
    micropsi.step_nodenet(fixed_nodenet)
    data = micropsi.export_monitor_data(fixed_nodenet)
    assert uid1 in data
    assert 'values' in data[uid1]
    assert uid2 in data
开发者ID:ianupright,项目名称:micropsi2,代码行数:8,代码来源:test_runtime_monitors.py

示例10: test_node_logic_sensor_nomodulators

def test_node_logic_sensor_nomodulators(engine, default_world):
    result, nnuid = micropsi.new_nodenet("adf", engine, "Default", world_uid=default_world, use_modulators=False)
    net, netapi, source = prepare(nnuid)
    register = netapi.create_node("Register", None)
    netapi.link_sensor(register, "static_on", "gen", weight=0.4)
    micropsi.step_nodenet(nnuid)
    micropsi.step_nodenet(nnuid)
    assert round(register.get_gate("gen").activation, 1) == 0.4
开发者ID:joschabach,项目名称:micropsi2,代码行数:8,代码来源:test_node_logic.py

示例11: test_get_monitor_data

def test_get_monitor_data(fixed_nodenet):
    uid = micropsi.add_gate_monitor(fixed_nodenet, 'n0001', 'gen', name="Testmonitor")
    micropsi.step_nodenet(fixed_nodenet)
    data = micropsi.get_monitor_data(fixed_nodenet)
    assert data['current_step'] == 1
    assert data['monitors'][uid]['name'] == 'Testmonitor'
    values = data['monitors'][uid]['values']
    assert len(values.keys()) == 1
    assert [k for k in values.keys()] == [1]
开发者ID:ianupright,项目名称:micropsi2,代码行数:9,代码来源:test_runtime_monitors.py

示例12: test_worldadapter_update_calls_reset_datatargets

def test_worldadapter_update_calls_reset_datatargets(test_world, test_nodenet):
    world = runtime.worlds[test_world]
    nodenet = runtime.get_nodenet(test_nodenet)
    runtime.load_nodenet(test_nodenet)
    nodenet.world = world
    runtime.set_nodenet_properties(nodenet.uid, worldadapter='Braitenberg', world_uid=world.uid)
    world.agents[test_nodenet].reset_datatargets = mock.MagicMock(name='reset')
    runtime.step_nodenet(test_nodenet)
    world.agents[test_nodenet].reset_datatargets.assert_called_once()
开发者ID:brucepro,项目名称:micropsi2,代码行数:9,代码来源:test_runtime_world_basics.py

示例13: test_add_slot_monitor

def test_add_slot_monitor(fixed_nodenet):
    uid = micropsi.add_slot_monitor(fixed_nodenet, 'A1', 'gen', name="FooBarMonitor")
    monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
    assert monitor.name == 'FooBarMonitor'
    assert monitor.node_uid == 'A1'
    assert monitor.target == 'gen'
    assert monitor.type == 'slot'
    assert len(monitor.values) == 0
    micropsi.step_nodenet(fixed_nodenet)
    monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
    assert len(monitor.values) == 1
开发者ID:brucepro,项目名称:micropsi2,代码行数:11,代码来源:test_runtime_monitors.py

示例14: test_add_gate_monitor

def test_add_gate_monitor(fixed_nodenet):
    uid = micropsi.add_gate_monitor(fixed_nodenet, 'A1', 'gen', sheaf='default')
    monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
    assert monitor.name == 'gate gen @ Node A1'
    assert monitor.node_uid == 'A1'
    assert monitor.target == 'gen'
    assert monitor.type == 'gate'
    assert monitor.sheaf == 'default'
    assert len(monitor.values) == 0
    micropsi.step_nodenet(fixed_nodenet)
    monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
    assert len(monitor.values) == 1
开发者ID:brucepro,项目名称:micropsi2,代码行数:12,代码来源:test_runtime_monitors.py

示例15: test_add_custom_monitor

def test_add_custom_monitor(fixed_nodenet):
    code = """return len(netapi.get_nodes())"""
    uid = micropsi.add_custom_monitor(fixed_nodenet, code, 'Nodecount')
    monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
    assert monitor.name == 'Nodecount'
    assert monitor.compiled_function is not None
    assert monitor.function == code
    assert len(monitor.values) == 0
    micropsi.step_nodenet(fixed_nodenet)
    monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
    assert len(monitor.values) == 1
    assert monitor.values[1] == len(micropsi.nodenets[fixed_nodenet].netapi.get_nodes())
开发者ID:brucepro,项目名称:micropsi2,代码行数:12,代码来源:test_runtime_monitors.py


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