本文整理汇总了Python中micropsi_core.runtime.step_nodenet函数的典型用法代码示例。如果您正苦于以下问题:Python step_nodenet函数的具体用法?Python step_nodenet怎么用?Python step_nodenet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了step_nodenet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: test_add_modulator_monitor
def test_add_modulator_monitor(fixed_nodenet):
uid = micropsi.add_modulator_monitor(fixed_nodenet, 'base_test', 'Testmonitor')
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert monitor.name == 'Testmonitor'
assert monitor.modulator == 'base_test'
assert len(monitor.values) == 0
micropsi.step_nodenet(fixed_nodenet)
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert monitor.values[1] == 1
micropsi.nodenets[fixed_nodenet].set_modulator('base_test', 0.7)
micropsi.step_nodenet(fixed_nodenet)
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert len(monitor.values) == 2
assert monitor.values[2] == 0.7
开发者ID:brucepro,项目名称:micropsi2,代码行数:14,代码来源:test_runtime_monitors.py
示例17: test_multiple_nodenet_interference
def test_multiple_nodenet_interference(engine, resourcepath):
import os
nodetype_file = os.path.join(resourcepath, 'Test', 'nodetypes.json')
nodefunc_file = os.path.join(resourcepath, 'Test', 'nodefunctions.py')
with open(nodetype_file, 'w') as fp:
fp.write('{"Testnode": {\
"name": "Testnode",\
"slottypes": ["gen", "foo", "bar"],\
"gatetypes": ["gen", "foo", "bar"],\
"nodefunction_name": "testnodefunc"\
}}')
with open(nodefunc_file, 'w') as fp:
fp.write("def testnodefunc(netapi, node=None, **prams):\r\n node.get_gate('gen').gate_function(17)")
micropsi.reload_native_modules()
result, n1_uid = micropsi.new_nodenet('Net1', engine=engine, owner='Pytest User')
result, n2_uid = micropsi.new_nodenet('Net2', engine=engine, owner='Pytest User')
n1 = micropsi.nodenets[n1_uid]
n2 = micropsi.nodenets[n2_uid]
nativemodule = n1.netapi.create_node("Testnode", None, "Testnode")
register1 = n1.netapi.create_node("Register", None, "Register1")
n1.netapi.link(nativemodule, 'gen', register1, 'gen', weight=1.2)
source2 = n2.netapi.create_node("Register", None, "Source2")
register2 = n2.netapi.create_node("Register", None, "Register2")
n2.netapi.link(source2, 'gen', source2, 'gen')
n2.netapi.link(source2, 'gen', register2, 'gen', weight=0.9)
source2.activation = 0.7
micropsi.step_nodenet(n2.uid)
assert n1.current_step == 0
assert register1.activation == 0
assert register1.name == "Register1"
assert nativemodule.name == "Testnode"
assert round(register1.get_slot('gen').get_links()[0].weight, 2) == 1.2
assert register1.get_slot('gen').get_links()[0].source_node.name == 'Testnode'
assert n1.get_node(register1.uid).name == "Register1"
assert n2.current_step == 1
assert round(source2.activation, 2) == 0.7
assert round(register2.activation, 2) == 0.63
assert register2.name == "Register2"
assert source2.name == "Source2"
assert round(register2.get_slot('gen').get_links()[0].weight, 2) == 0.9
assert register2.get_slot('gen').get_links()[0].source_node.name == 'Source2'
assert n2.get_node(register2.uid).name == "Register2"
开发者ID:joschabach,项目名称:micropsi2,代码行数:50,代码来源:test_runtime_nodenet_basics.py
示例18: test_add_link_monitor
def test_add_link_monitor(fixed_nodenet):
uid = micropsi.add_link_monitor(fixed_nodenet, 'S', 'gen', 'B1', 'gen', 'weight', 'Testmonitor')
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert monitor.name == 'Testmonitor'
assert monitor.property == 'weight'
assert monitor.source_node_uid == 'S'
assert monitor.target_node_uid == 'B1'
assert monitor.gate_type == 'gen'
assert monitor.slot_type == 'gen'
assert len(monitor.values) == 0
micropsi.step_nodenet(fixed_nodenet)
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert monitor.values[1] == 1
micropsi.nodenets[fixed_nodenet].set_link_weight('S', 'gen', 'B1', 'gen', weight=0.7)
micropsi.step_nodenet(fixed_nodenet)
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert len(monitor.values) == 2
assert monitor.values[2] == 0.7
开发者ID:brucepro,项目名称:micropsi2,代码行数:18,代码来源:test_runtime_monitors.py
示例19: test_add_link_monitor
def test_add_link_monitor(fixed_nodenet):
uid = micropsi.add_link_monitor(fixed_nodenet, 'n0005', 'gen', 'n0003', 'gen', 'weight', 'Testmonitor', color="#112233")
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert monitor.name == 'Testmonitor'
assert monitor.property == 'weight'
assert monitor.source_node_uid == 'n0005'
assert monitor.target_node_uid == 'n0003'
assert monitor.gate_type == 'gen'
assert monitor.slot_type == 'gen'
assert monitor.color == "#112233"
assert len(monitor.values) == 0
micropsi.step_nodenet(fixed_nodenet)
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert round(monitor.values[1], 2) == 1
micropsi.nodenets[fixed_nodenet].set_link_weight('n0005', 'gen', 'n0003', 'gen', weight=0.7)
micropsi.step_nodenet(fixed_nodenet)
monitor = micropsi.nodenets[fixed_nodenet].get_monitor(uid)
assert len(monitor.values) == 2
assert round(monitor.values[2], 2) == 0.7
开发者ID:ianupright,项目名称:micropsi2,代码行数:19,代码来源:test_runtime_monitors.py
示例20: test_actuators_do_not_reset_each_others_datatarget
def test_actuators_do_not_reset_each_others_datatarget(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_runner_properties(200, 1)
runtime.set_nodenet_properties(nodenet.uid, worldadapter='Braitenberg', world_uid=world.uid)
actor1 = nodenet.netapi.create_node("Actor", "Root")
actor2 = nodenet.netapi.create_node("Actor", "Root")
actor1.set_parameter('datatarget', 'engine_r')
actor2.set_parameter('datatarget', 'engine_r')
reg1 = nodenet.netapi.create_node("Register", "Root")
reg2 = nodenet.netapi.create_node("Register", "Root")
nodenet.netapi.link(reg1, 'gen', actor1, 'gen')
nodenet.netapi.link(reg2, 'gen', actor2, 'gen')
reg1.activation = 0.7
reg2.activation = 0.3
runtime.step_nodenet(test_nodenet)
actor1.node_function()
actor2.node_function()
assert world.agents[test_nodenet].datatargets['engine_r'] == 1
开发者ID:brucepro,项目名称:micropsi2,代码行数:21,代码来源:test_runtime_world_basics.py
注:本文中的micropsi_core.runtime.step_nodenet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论