def test_skimage_1(): """ Push two images, perform ADO function to combine and return image """ session = pymcas.create_session(os.getenv('SERVER_IP'), 11911, debug=3) if sys.getrefcount(session) != 2: raise ValueError("session ref count should be 2") pool = session.create_pool("myPool2", int(1e9), 100) if sys.getrefcount(pool) != 2: raise ValueError("pool ref count should be 2") # save image from skimage import data, io, filters pool.save('camera', data.camera()) pool.save('brick', data.brick()) # # perform ADO invocation shape = pool.invoke('camera', blend_ado_function, 0.5) # param is delta print("shape:{0}".format(shape)) blend = pool.load('blended') io.imshow(blend) io.show()
def test_skimage_0(): """ Test using NdArray data and Scikit-Image to perform Sobel filter in ADO """ session = pymcas.create_session(os.getenv('SERVER_IP'), 11911, debug=3) if sys.getrefcount(session) != 2: raise ValueError("session ref count should be 2") pool = session.create_pool("myPool") if sys.getrefcount(pool) != 2: raise ValueError("pool ref count should be 2") # save image from skimage import data, io, filters image = data.coins() pool.save('image0', image) # perform ADO invocation shape = pool.invoke('image0', sobel_filter) print("shape:{0}".format(shape)) # recall and display image edges = pool.load('image0-edges') print(type(edges)) io.imshow(edges) io.show()
def test_erase(): session = pymcas.create_session(os.getenv('SERVER_IP'), 11911, debug=3) if sys.getrefcount(session) != 2: raise ValueError("session ref count should be 2") pool = session.create_pool("myPool") if sys.getrefcount(pool) != 2: raise ValueError("pool ref count should be 2") from skimage import data, io, filters image = data.coins() pool.save('image0', image) pool.erase('image0') try: pool.load('image0') except: print("TEST: correctly erased - object cannot be loaded!")
def basic_test_0(): session = pymcas.create_session(os.getenv('SERVER_IP'), 11911, debug=3) if sys.getrefcount(session) != 2: raise ValueError("session ref count should be 2") pool = session.create_pool("myPool") if sys.getrefcount(pool) != 2: raise ValueError("pool ref count should be 2") a = np.identity(10) print(a) key = 'object-A' pool.save(key, a) b = pool.load(key) print("test0 OK!?") print("result of load:") print(b) return b
def test_dict(): """ Test for non-NdArray types, e.g., dictionary. Tests parameter passing also. """ session = pymcas.create_session(os.getenv('SERVER_IP'), 11911, debug=3) if sys.getrefcount(session) != 2: raise ValueError("session ref count should be 2") pool = session.create_pool("myPool") if sys.getrefcount(pool) != 2: raise ValueError("pool ref count should be 2") mydict = {} mydict['cat'] = ["jenny", "jazmine"] mydict['dog'] = ["violet"] mydict['chickens'] = ["bob", "ferdy", "rosemary"] pool.save('household', mydict) result = pool.invoke('household', test_dict_work, {"children": ["ben", "molly"]}) print("New household->", result)