fixed modules
This commit is contained in:
6
morbidissimo/__init__.py
Normal file
6
morbidissimo/__init__.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
from .modman import ModuleManager
|
||||||
|
from .morioc import MorIOC
|
||||||
|
from .sendmail import sendmail, Message, SendMailError
|
||||||
|
|
||||||
|
|
4
morbidissimo/modman/__init__.py
Normal file
4
morbidissimo/modman/__init__.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
from .modman import ModuleManager
|
||||||
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
from time import sleep
|
from time import sleep
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from module import Module, ModuleLoadError, MissingEntryFunctionError
|
from .module import Module, ModuleLoadError, MissingEntryFunctionError
|
||||||
from utils import printable_exception
|
from .utils import printable_exception
|
||||||
|
|
||||||
|
|
||||||
class ModuleManager:
|
class ModuleManager:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from importing import load_module
|
from .importing import load_module
|
||||||
from task import Task
|
from .task import Task
|
||||||
from utils import printable_exception
|
from .utils import printable_exception
|
||||||
|
|
||||||
|
|
||||||
class Module:
|
class Module:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from modman import ModuleManager
|
from .modman import ModuleManager
|
||||||
|
|
||||||
|
|
||||||
folder = "scripts"
|
folder = "scripts"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from killthread import killthread
|
from .killthread import killthread
|
||||||
|
|
||||||
|
|
||||||
class Task(Thread):
|
class Task(Thread):
|
||||||
|
4
morbidissimo/morioc/__init__.py
Normal file
4
morbidissimo/morioc/__init__.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
from .morioc import MorIOC
|
||||||
|
|
||||||
|
|
@ -3,10 +3,10 @@ from datetime import datetime
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from pcaspy import SimpleServer, Driver
|
from pcaspy import SimpleServer, Driver
|
||||||
|
|
||||||
from channels import PV, Image
|
from .channels import PV, Image
|
||||||
from context import Context
|
from .context import Context
|
||||||
from pvinfoset import PVInfoSet
|
from .pvinfoset import PVInfoSet
|
||||||
from managed import delete_managed
|
from .managed import delete_managed
|
||||||
|
|
||||||
|
|
||||||
INITIAL_PVDB = { #TODO make wait_time caput-able
|
INITIAL_PVDB = { #TODO make wait_time caput-able
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from pvinfo import PVInfo
|
from .pvinfo import PVInfo
|
||||||
from managed import is_managed, get_managed_dtype
|
from .managed import is_managed, get_managed_dtype
|
||||||
|
|
||||||
|
|
||||||
class PVInfoSet(set):
|
class PVInfoSet(set):
|
||||||
|
@ -5,7 +5,7 @@ from random import random, randint, choice
|
|||||||
from numpy.random import normal
|
from numpy.random import normal
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from morioc import MorIOC
|
from .morioc import MorIOC
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -6,7 +6,7 @@ import numpy as np
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
from pvinfo import infer_type as it
|
from .pvinfo import infer_type as it
|
||||||
|
|
||||||
psfalse = partial(it, parse_string=False)
|
psfalse = partial(it, parse_string=False)
|
||||||
pstrue = partial(it, parse_string=True)
|
pstrue = partial(it, parse_string=True)
|
||||||
|
11
run-modman.py
Executable file
11
run-modman.py
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from morbidissimo import ModuleManager
|
||||||
|
|
||||||
|
|
||||||
|
folder = "morbidissimo/modman/scripts"
|
||||||
|
mm = ModuleManager(folder)
|
||||||
|
mm.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
63
run-morioc.py
Executable file
63
run-morioc.py
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/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)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user