Ejemplo n.º 1
0
def fixed_nodenet(request, test_world, engine):
    """
    A test nodenet filled with some example data (nodenet_data.py)
    Structure:

          ->  A1 ->  A2
        /
       S                     ACTA
        \
          ->  B1 ->  B2

    S: Sensor, brightness_l
    A1: Pipe
    A2: Pipe
    B1: Pipe
    B2: Pipe
    ACTA: Activator, por
    """
    from micropsi_core.tests.nodenet_data import fixed_nodenet_data
    if engine == "theano_engine":
        fixed_nodenet_data = fixed_nodenet_data.replace('Root', 's0001')
    success, uid = micropsi.new_nodenet("Fixednet",
                                        engine=engine,
                                        worldadapter="Braitenberg",
                                        owner="Pytest User",
                                        world_uid=test_world,
                                        uid='fixed_test_nodenet')
    micropsi.get_nodenet(uid)
    micropsi.merge_nodenet(uid, fixed_nodenet_data, keep_uids=True)
    micropsi.save_nodenet(uid)
    yield uid
    try:
        micropsi.delete_nodenet(uid)
    except:
        pass
Ejemplo n.º 2
0
def fixed_nodenet(request, test_world, engine):
    """
    A test nodenet filled with some example data (nodenet_data.py)
    Structure:

          ->  A1 ->  A2
        /
       S                     ACTA
        \
          ->  B1 ->  B2

    S: Sensor, brightness_l
    A1: Pipe
    A2: Pipe
    B1: Pipe
    B2: Pipe
    ACTA: Activator, por
    """
    from micropsi_core.tests.nodenet_data import fixed_nodenet_data
    if engine == "theano_engine":
        fixed_nodenet_data = fixed_nodenet_data.replace('Root', 's0001')
    success, uid = micropsi.new_nodenet("Fixednet", engine=engine, worldadapter="Braitenberg", owner="Pytest User", world_uid=test_world, uid='fixed_test_nodenet')
    micropsi.get_nodenet(uid)
    micropsi.merge_nodenet(uid, fixed_nodenet_data, keep_uids=True)
    micropsi.save_nodenet(uid)
    yield uid
    try:
        micropsi.delete_nodenet(uid)
    except:
        pass
Ejemplo n.º 3
0
def fixed_nodenet(request, test_world, engine):
    from micropsi_core.tests.nodenet_data import fixed_nodenet_data
    if engine == "theano_engine":
        fixed_nodenet_data = fixed_nodenet_data.replace('Root', 's0001')
    success, uid = micropsi.new_nodenet("Fixednet", engine=engine, worldadapter="Braitenberg", owner="Pytest User", world_uid=test_world, uid='fixed_test_nodenet')
    micropsi.get_nodenet(uid)
    micropsi.merge_nodenet(uid, fixed_nodenet_data, keep_uids=True)
    micropsi.save_nodenet(uid)
    return uid
Ejemplo n.º 4
0
def fixed_nodenet(request, test_world):
    from micropsi_core.tests.nodenet_data import fixed_nodenet_data
    success, uid = micropsi.new_nodenet("Fixednet", "Braitenberg", owner="Pytest User", world_uid=test_world, uid='fixed_test_nodenet')
    micropsi.get_nodenet(uid)
    micropsi.merge_nodenet(uid, fixed_nodenet_data)
    def fin():
        if DELETE_TEST_FILES_ON_EXIT:
            micropsi.delete_nodenet(uid)
    request.addfinalizer(fin)
    return uid
Ejemplo n.º 5
0
def fixed_nodenet(request, test_world, engine):
    from micropsi_core.tests.nodenet_data import fixed_nodenet_data
    if engine == "theano_engine":
        fixed_nodenet_data = fixed_nodenet_data.replace('Root', 's0001')
    success, uid = micropsi.new_nodenet("Fixednet",
                                        engine=engine,
                                        worldadapter="Braitenberg",
                                        owner="Pytest User",
                                        world_uid=test_world,
                                        uid='fixed_test_nodenet')
    micropsi.get_nodenet(uid)
    micropsi.merge_nodenet(uid, fixed_nodenet_data, keep_uids=True)
    micropsi.save_nodenet(uid)
    return uid
Ejemplo n.º 6
0
def merge_nodenet_rpc(nodenet_uid, nodenet_data):
    return runtime.merge_nodenet(nodenet_uid, nodenet_data)
Ejemplo n.º 7
0
def merge_nodenet(nodenet_uid):
    data = request.files['file_upload'].file.read()
    data = data.decode('utf-8')
    runtime.merge_nodenet(nodenet_uid, data)
    return dict(status='success', msg="Nodenet merged")
Ejemplo n.º 8
0
def merge_nodenet(nodenet_uid):
    runtime.merge_nodenet(nodenet_uid, request.files['file_upload'].file.read())
    return dict(status='success', msg="Nodenet merged")
Ejemplo n.º 9
0
def merge_nodenet_rpc(nodenet_uid, nodenet_data):
    """ Merge a json dump into the given nodenet"""
    return runtime.merge_nodenet(nodenet_uid, nodenet_data)