#!/usr/bin/env python from time import sleep from random import random, randint, choice from numpy.random import normal import numpy as np from morbidissimo import MorIOC if __name__ == "__main__": with MorIOC("mtest") as mor: ch_pv = mor.PV("chan-PV") ch_img = mor.Image("chan-Image") for i in range(1000): ch_pv.put(random()) img = np.random.random(200).reshape(10, 20) ch_img.put(img) img = np.random.random(200).reshape(10, 20) width, height = img.shape mor.serve(**{ "IMG:FPICTURE": img, "IMG:WIDTH": width, "IMG:HEIGHT": height, }) arr = np.random.random(20).reshape(2, 10) mor.serve( arr = arr ) mor.serve( rand2 = 1.23, ) mor.serve( rand0 = normal(), rand1 = random(), rand2 = randint(100, 200), rand3 = random() + 10, rand4 = choice(["test", "bla", "blabla"]), rand5 = "float" ) mor.host( bucket1 = int, bucket2 = "float", bucket3 = str ) v = mor.get("bucket1") mor.serve(test = v*2) sleep(0.5)