fixed modules

This commit is contained in:
2023-10-12 14:33:38 +02:00
parent 336c5167f4
commit 5bce4ce983
13 changed files with 103 additions and 15 deletions

6
morbidissimo/__init__.py Normal file
View File

@ -0,0 +1,6 @@
from .modman import ModuleManager
from .morioc import MorIOC
from .sendmail import sendmail, Message, SendMailError

View File

@ -0,0 +1,4 @@
from .modman import ModuleManager

View File

@ -1,8 +1,8 @@
from time import sleep
from pathlib import Path
from module import Module, ModuleLoadError, MissingEntryFunctionError
from utils import printable_exception
from .module import Module, ModuleLoadError, MissingEntryFunctionError
from .utils import printable_exception
class ModuleManager:

View File

@ -1,8 +1,8 @@
from pathlib import Path
from importing import load_module
from task import Task
from utils import printable_exception
from .importing import load_module
from .task import Task
from .utils import printable_exception
class Module:

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
from modman import ModuleManager
from .modman import ModuleManager
folder = "scripts"

View File

@ -1,6 +1,6 @@
from threading import Thread
from killthread import killthread
from .killthread import killthread
class Task(Thread):

View File

@ -0,0 +1,4 @@
from .morioc import MorIOC

View File

@ -3,10 +3,10 @@ from datetime import datetime
from threading import Thread
from pcaspy import SimpleServer, Driver
from channels import PV, Image
from context import Context
from pvinfoset import PVInfoSet
from managed import delete_managed
from .channels import PV, Image
from .context import Context
from .pvinfoset import PVInfoSet
from .managed import delete_managed
INITIAL_PVDB = { #TODO make wait_time caput-able

View File

@ -1,5 +1,5 @@
from pvinfo import PVInfo
from managed import is_managed, get_managed_dtype
from .pvinfo import PVInfo
from .managed import is_managed, get_managed_dtype
class PVInfoSet(set):

View File

@ -5,7 +5,7 @@ from random import random, randint, choice
from numpy.random import normal
import numpy as np
from morioc import MorIOC
from .morioc import MorIOC
if __name__ == "__main__":

View File

@ -6,7 +6,7 @@ import numpy as np
import pytest
from pvinfo import infer_type as it
from .pvinfo import infer_type as it
psfalse = partial(it, parse_string=False)
pstrue = partial(it, parse_string=True)

11
run-modman.py Executable file
View 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
View 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)