def test_clone_nodes_copies_gate_params(fixed_nodenet):
    nodenet = micropsi.get_nodenet(fixed_nodenet)
    micropsi.set_gate_parameters(fixed_nodenet, 'n0001', 'gen', {'maximum': 0.1})
    success, result = micropsi.clone_nodes(fixed_nodenet, ['n0001'], 'internal')
    assert success
    copy = nodenet.get_node(result['nodes'][0]['uid'])
    assert round(copy.get_gate_parameters()['gen']['maximum'], 2) == 0.1
def test_clone_nodes_copies_gate_params(fixed_nodenet):
    nodenet = micropsi.get_nodenet(fixed_nodenet)
    micropsi.set_gate_parameters(fixed_nodenet, 'A1', 'gen', {'decay': 0.1})
    success, result = micropsi.clone_nodes(fixed_nodenet, ['A1'], 'internal')
    assert success
    copy = nodenet.get_node(result['nodes'][0]['uid'])
    assert copy.get_gate_parameters()['gen']['decay'] == 0.1
Esempio n. 3
0
def test_non_standard_gate_defaults(fixed_nodenet):
    nodenet = micropsi.nodenets[fixed_nodenet]
    micropsi.add_node(fixed_nodenet, 'Trigger', [30, 30], uid='testtrigger', name='test')
    node = nodenet.netapi.get_node('testtrigger')
    params = node.get_gate_parameters()
    genparams = params['gen']
    genparams['maximum'] = 1
    micropsi.set_gate_parameters(nodenet.uid, node.uid, 'gen', genparams)
    assert node.clone_non_default_gate_parameters()['gen']['maximum'] == 1
Esempio n. 4
0
def test_clone_nodes_copies_gate_params(fixed_nodenet):
    nodenet = micropsi.get_nodenet(fixed_nodenet)
    micropsi.set_gate_parameters(fixed_nodenet, 'n0001', 'gen',
                                 {'maximum': 0.1})
    success, result = micropsi.clone_nodes(fixed_nodenet, ['n0001'],
                                           'internal')
    assert success
    copy = nodenet.get_node(list(result.keys())[0])
    assert round(copy.get_gate_parameters()['gen']['maximum'], 2) == 0.1
def test_nodenet_data_gate_parameters(fixed_nodenet):
    from micropsi_core.nodenet.node import Nodetype
    data = micropsi.nodenets[fixed_nodenet].data
    assert data['nodes']['n0005']['gate_parameters'] == {}
    micropsi.set_gate_parameters(fixed_nodenet, 'n0005', 'gen', {'threshold': 1})
    data = micropsi.nodenets[fixed_nodenet].data
    assert data['nodes']['n0005']['gate_parameters'] == {'gen': {'threshold': 1}}
    defaults = Nodetype.GATE_DEFAULTS.copy()
    defaults.update({'threshold': 1})
    data = micropsi.nodenets[fixed_nodenet].get_node('n0005').data['gate_parameters']
    assert data == {'gen': {'threshold': 1}}
Esempio n. 6
0
def test_non_standard_gate_defaults(fixed_nodenet):
    nodenet = micropsi.nodenets[fixed_nodenet]
    res, uid = micropsi.add_node(fixed_nodenet, 'Register', [30, 30], name='test')
    node = nodenet.netapi.get_node(uid)
    genparams = {'maximum': 0.5}
    micropsi.set_gate_parameters(nodenet.uid, node.uid, 'gen', genparams)
    assert node.clone_non_default_gate_parameters()['gen']['maximum'] == 0.5
    assert node.data['gate_parameters'] == {'gen': {'maximum': 0.5}}
    assert nodenet.data['nodes'][uid]['gate_parameters'] == {'gen': {'maximum': 0.5}}
    data = micropsi.get_nodenet_data(fixed_nodenet, None, step=-1, include_links=False)
    assert data['nodes'][uid]['gate_parameters'] == {'gen': {'maximum': 0.5}}
Esempio n. 7
0
def test_nodenet_data_gate_parameters(fixed_nodenet):
    from micropsi_core.nodenet.node import Nodetype
    data = micropsi.nodenets[fixed_nodenet].get_data()
    assert data['nodes']['n0005']['gate_parameters'] == {}
    micropsi.set_gate_parameters(fixed_nodenet, 'n0005', 'gen',
                                 {'threshold': 1})
    data = micropsi.nodenets[fixed_nodenet].get_data()
    assert data['nodes']['n0005']['gate_parameters'] == {
        'gen': {
            'threshold': 1
        }
    }
    defaults = Nodetype.GATE_DEFAULTS.copy()
    defaults.update({'threshold': 1})
    data = micropsi.nodenets[fixed_nodenet].get_node(
        'n0005').get_data()['gate_parameters']
    assert data == {'gen': {'threshold': 1}}
Esempio n. 8
0
def set_gate_parameters(nodenet_uid, node_uid, gate_type, parameters):
    return runtime.set_gate_parameters(nodenet_uid, node_uid, gate_type, parameters)