etho-python 0.22.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- etho/__init__.py +9 -0
- etho/app.py +569 -0
- etho/assets/etho_icon1_pipeline_dark.svg +23 -0
- etho/assets/etho_icon1_pipeline_light.svg +30 -0
- etho/cli.py +215 -0
- etho/client.py +384 -0
- etho/services/ANAZeroService.py +123 -0
- etho/services/BLTZeroService.py +108 -0
- etho/services/DAQZeroService.py +326 -0
- etho/services/DLPZeroService.py +240 -0
- etho/services/GCMZeroService.py +271 -0
- etho/services/GOVZeroService.py +231 -0
- etho/services/NICounterZeroService.py +92 -0
- etho/services/NITriggerZeroService.py +120 -0
- etho/services/TemplateZeroService.py +98 -0
- etho/services/ZeroService.py +272 -0
- etho/services/__init__.py +0 -0
- etho/services/callbacks/__init__.py +19 -0
- etho/services/callbacks/_base.py +92 -0
- etho/services/callbacks/_image.py +798 -0
- etho/services/callbacks/_trace.py +456 -0
- etho/services/camera/__init__.py +13 -0
- etho/services/camera/base.py +164 -0
- etho/services/camera/basler.py +201 -0
- etho/services/camera/dummy.py +139 -0
- etho/services/camera/hamamatsu.py +133 -0
- etho/services/camera/spinnaker.py +317 -0
- etho/services/camera/ximea.py +167 -0
- etho/services/daq/IOTask.py +311 -0
- etho/services/daq/ai.py +174 -0
- etho/services/dlp/dlp_make_warpfiles.py +131 -0
- etho/services/dlp/dlp_runners.py +238 -0
- etho/services/utils/__init__.py +0 -0
- etho/services/utils/concurrent_task.py +236 -0
- etho/services/utils/log_exceptions.py +39 -0
- etho/utils/__init__.py +0 -0
- etho/utils/calibration.py +88 -0
- etho/utils/config.py +41 -0
- etho/utils/runner.py +121 -0
- etho/utils/shuffled_cycle.py +45 -0
- etho/utils/sound.py +336 -0
- etho/utils/tui.py +105 -0
- etho/utils/zeroclient.py +95 -0
- etho_python-0.22.0.dist-info/METADATA +49 -0
- etho_python-0.22.0.dist-info/RECORD +47 -0
- etho_python-0.22.0.dist-info/WHEEL +4 -0
- etho_python-0.22.0.dist-info/entry_points.txt +3 -0
etho/utils/zeroclient.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import zerorpc
|
|
2
|
+
import time
|
|
3
|
+
from .runner import Runner
|
|
4
|
+
import zmq
|
|
5
|
+
import logging
|
|
6
|
+
from zmq.log.handlers import PUBHandler
|
|
7
|
+
import socket
|
|
8
|
+
from .. import config
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ZeroClient(zerorpc.Client):
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
host: str,
|
|
15
|
+
service_name: str = "CLIENT",
|
|
16
|
+
logging_port: str = "1460",
|
|
17
|
+
serializer: str = "default",
|
|
18
|
+
python_exe: str = "python",
|
|
19
|
+
):
|
|
20
|
+
"""_summary_
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
host (str): Host name or IP address used for ZeroRPC connections.
|
|
24
|
+
service_name (str, optional): _description_. Defaults to 'CLIENT'.
|
|
25
|
+
logging_port (str, optional): _description_. Defaults to '1460'.
|
|
26
|
+
serializer (str, optional): _description_. Defaults to 'default'.
|
|
27
|
+
"""
|
|
28
|
+
self.SERVICE_NAME = service_name
|
|
29
|
+
self.LOGGING_PORT = logging_port
|
|
30
|
+
|
|
31
|
+
ctx = zerorpc.Context()
|
|
32
|
+
ctx.register_serializer(serializer)
|
|
33
|
+
super(ZeroClient, self).__init__(timeout=180, heartbeat=90, context=ctx)
|
|
34
|
+
self._init_network_logger()
|
|
35
|
+
|
|
36
|
+
self.sr = Runner(host, python_exe=python_exe)
|
|
37
|
+
self.pid = None # pid of local server process
|
|
38
|
+
|
|
39
|
+
def _init_network_logger(self, log_level: int = logging.INFO):
|
|
40
|
+
# TODO: set log levels of logger and handler
|
|
41
|
+
ctx = zmq.Context()
|
|
42
|
+
ctx.LINGER = 0
|
|
43
|
+
pub = ctx.socket(zmq.PUB)
|
|
44
|
+
head_ip = config["name"] # log to head
|
|
45
|
+
pub.connect("tcp://{0}:{1}".format(head_ip, self.LOGGING_PORT))
|
|
46
|
+
|
|
47
|
+
self.log = logging.getLogger()
|
|
48
|
+
self.log.setLevel(log_level)
|
|
49
|
+
|
|
50
|
+
# get host name or IP to append to message
|
|
51
|
+
self.hostname = socket.gethostname()
|
|
52
|
+
|
|
53
|
+
prefix = "%(asctime)s.%(msecs)03d {0}@{1}:".format(self.SERVICE_NAME, self.hostname)
|
|
54
|
+
body = "%(module)s:%(funcName)s:%(lineno)d - %(message)s"
|
|
55
|
+
df = "%Y-%m-%d,%H:%M:%S"
|
|
56
|
+
formatters = {
|
|
57
|
+
logging.DEBUG: logging.Formatter(prefix + body + "\n", datefmt=df),
|
|
58
|
+
logging.INFO: logging.Formatter(prefix + "%(message)s\n", datefmt=df),
|
|
59
|
+
logging.WARN: logging.Formatter(prefix + body + "\n", datefmt=df),
|
|
60
|
+
logging.ERROR: logging.Formatter(prefix + body + " - %(exc_info)s\n", datefmt=df),
|
|
61
|
+
logging.CRITICAL: logging.Formatter(prefix + body + "\n", datefmt=df),
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
handler = PUBHandler(pub)
|
|
65
|
+
handler.formatters = formatters
|
|
66
|
+
handler.setLevel(log_level)
|
|
67
|
+
self.log.addHandler(handler)
|
|
68
|
+
|
|
69
|
+
def start_server(self, server_name, warmup=2, timeout=5, new_console: bool = False):
|
|
70
|
+
self.log.info(f" {self.SERVICE_NAME} starting")
|
|
71
|
+
self.sr.run(server_name, timeout=timeout, new_console=new_console, disown=True)
|
|
72
|
+
self.pid = self.sr.pid(query=server_name)
|
|
73
|
+
self.log.info(f" {self.SERVICE_NAME} warmup")
|
|
74
|
+
time.sleep(warmup) # wait for server to warm up
|
|
75
|
+
status = self.sr.is_running(self.pid)
|
|
76
|
+
self.log.info(f" {self.SERVICE_NAME} done")
|
|
77
|
+
return status
|
|
78
|
+
|
|
79
|
+
def stop_server(self):
|
|
80
|
+
self.log.info(f" {self.SERVICE_NAME} finish and cleanup")
|
|
81
|
+
self.finish()
|
|
82
|
+
self.cleanup()
|
|
83
|
+
self.log.info(f" {self.SERVICE_NAME} killing")
|
|
84
|
+
if self.sr.is_running(self.pid):
|
|
85
|
+
self.sr.kill(self.pid)
|
|
86
|
+
return not self.sr.is_running(self.pid)
|
|
87
|
+
|
|
88
|
+
def get_server_pid(self, query):
|
|
89
|
+
return self.sr.pid(query)
|
|
90
|
+
|
|
91
|
+
def close(self):
|
|
92
|
+
pass
|
|
93
|
+
|
|
94
|
+
def __del__(self):
|
|
95
|
+
self.close()
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: etho-python
|
|
3
|
+
Version: 0.22.0
|
|
4
|
+
Summary: etho
|
|
5
|
+
Author-email: Jan Clemens <clemensjan@googlemail.com>
|
|
6
|
+
Requires-Python: >3.6
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Requires-Dist: numpy
|
|
10
|
+
Requires-Dist: scipy
|
|
11
|
+
Requires-Dist: h5py
|
|
12
|
+
Requires-Dist: opencv-python-headless
|
|
13
|
+
Requires-Dist: bleak
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: pyzmq
|
|
16
|
+
Requires-Dist: gevent
|
|
17
|
+
Requires-Dist: future
|
|
18
|
+
Requires-Dist: pillow
|
|
19
|
+
Requires-Dist: msgpack-python
|
|
20
|
+
Requires-Dist: pyyaml
|
|
21
|
+
Requires-Dist: ipython
|
|
22
|
+
Requires-Dist: defopt
|
|
23
|
+
Requires-Dist: msgpack-numpy
|
|
24
|
+
Requires-Dist: rich
|
|
25
|
+
Requires-Dist: psutil
|
|
26
|
+
Requires-Dist: pydaqmx
|
|
27
|
+
Requires-Dist: pyqtgraph
|
|
28
|
+
Requires-Dist: qtpy
|
|
29
|
+
Requires-Dist: PySide6-Essentials
|
|
30
|
+
Requires-Dist: zarr
|
|
31
|
+
Requires-Dist: pytest ; extra == "dev"
|
|
32
|
+
Requires-Dist: flit>=3.2 ; extra == "dev"
|
|
33
|
+
Requires-Dist: sphinx ; extra == "doc"
|
|
34
|
+
Requires-Dist: furo ; extra == "doc"
|
|
35
|
+
Requires-Dist: sphinx-inline-tabs ; extra == "doc"
|
|
36
|
+
Requires-Dist: sphinx-copybutton ; extra == "doc"
|
|
37
|
+
Requires-Dist: ghp-import ; extra == "doc"
|
|
38
|
+
Requires-Dist: myst-nb ; extra == "doc"
|
|
39
|
+
Requires-Dist: sphinx-panels ; extra == "doc"
|
|
40
|
+
Requires-Dist: sphinxcontrib-images ; extra == "doc"
|
|
41
|
+
Project-URL: documentation, https://janclemenslab.org/etho/
|
|
42
|
+
Project-URL: source, https://github.com/janclemenslab/etho
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Provides-Extra: doc
|
|
45
|
+
|
|
46
|
+
# Etho
|
|
47
|
+
|
|
48
|
+
See [docs](https://janclemenslab.org/etho) for information on how to [install](https://janclemenslab.org/etho/install.html) and use.
|
|
49
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
etho/__init__.py,sha256=XvIqZj7_ExaS8jhdA7MpKeLxN2coevS0u6qQG-XvIqA,214
|
|
2
|
+
etho/app.py,sha256=0bQgZS3d2gxXAZrXeHVIrOpXMmlMWAnX10VEbEvRmJU,19711
|
|
3
|
+
etho/cli.py,sha256=n9YI77ZQ9oxb-2uh-WL9PtVQhQ8uv5Bteo1r2slyrm4,6377
|
|
4
|
+
etho/client.py,sha256=m7fU_yuOLk5xYzlllrJ0YAGkml58-Utm5N3EB7_3yO8,15012
|
|
5
|
+
etho/assets/etho_icon1_pipeline_dark.svg,sha256=3QsJqCS__aND4JqtOCv4gk7vJWaP90KQ1eB5Ia5mTc8,1654
|
|
6
|
+
etho/assets/etho_icon1_pipeline_light.svg,sha256=nYE1YUlnZ2KoLZNTipLlnPyP2CpwPuRELqukolqFriw,1801
|
|
7
|
+
etho/services/ANAZeroService.py,sha256=hrnCkmKyZRak_DNjSjsD6rfkYg38Xd_jT3vY7KAUyM4,4374
|
|
8
|
+
etho/services/BLTZeroService.py,sha256=blYHZmufFVpq8v0T-kUpxHnzLEdaoDyx1xnA6dO1uiY,3581
|
|
9
|
+
etho/services/DAQZeroService.py,sha256=xCf5jicbZ0xxmVt1uXkm7gDZXiQdThLtLtqFkiOZ6Ek,11989
|
|
10
|
+
etho/services/DLPZeroService.py,sha256=9aUyiD_IqxcrAdso1vhFhcgfOiAgDq_vZmpW0_1tsM8,8665
|
|
11
|
+
etho/services/GCMZeroService.py,sha256=PSvzqGVs8qh9lLpLM8gxlxFNBiYn0MzQ34CNdwzdTnA,9277
|
|
12
|
+
etho/services/GOVZeroService.py,sha256=MgoQ3B3h438-WGHSJAR_o2CilRzpbuAT3LV5BpNNc1o,7699
|
|
13
|
+
etho/services/NICounterZeroService.py,sha256=iVCNUARKX42Op-jeA9V-iScEluiT5jUVK1k_lzv0HJs,2960
|
|
14
|
+
etho/services/NITriggerZeroService.py,sha256=25JyBXM2K13csSd52dTe56PeFADKbGWXasi6v09NFpQ,4267
|
|
15
|
+
etho/services/TemplateZeroService.py,sha256=Z9Ycb2XD8Ii9hK-gG8ScWD6VAc0Mxt-rYG3oFLrUB3c,3164
|
|
16
|
+
etho/services/ZeroService.py,sha256=-YlL4FStUZoT_Tzff7HS7YBMRbxTMof7-bg2Ntfy05Y,9469
|
|
17
|
+
etho/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
etho/services/callbacks/__init__.py,sha256=XGD_-ZGuYvPOKXn_u3MOYVMC-aa6AFN0HqlB3RXV-pU,550
|
|
19
|
+
etho/services/callbacks/_base.py,sha256=Kd1BdkTgMtg4FzKH7XwzJjmFaJw6BkgKupSiHr8ChPs,2673
|
|
20
|
+
etho/services/callbacks/_image.py,sha256=jVSDrzaL7lPZfk_msSA2JicfbwkeqB2GGAlL2rLgZKY,27440
|
|
21
|
+
etho/services/callbacks/_trace.py,sha256=eDbgPTFUsh2cAespzHoafdjHbO2u_rWRYQ5aNB9s2GE,18204
|
|
22
|
+
etho/services/camera/__init__.py,sha256=gC9MTAxax0WYsfaEgG9x7yHOik78tSkiTOm6APnv13M,286
|
|
23
|
+
etho/services/camera/base.py,sha256=RqaeZGl-PCLaha6fq6OyOni1vPja5oP2xoOa25TOv-A,3646
|
|
24
|
+
etho/services/camera/basler.py,sha256=Snz060KZWejB6A3DI3fPof8b2G6noJ85U-V9mIUgafc,7003
|
|
25
|
+
etho/services/camera/dummy.py,sha256=rwYfQvm_3sxR8gtqw2-J9isULxurV8lCDJgSYehBq8k,3582
|
|
26
|
+
etho/services/camera/hamamatsu.py,sha256=M6zVEgpUlGCcszVNSBrnjyRdexzA0ZivI4G_GpqMAP4,3690
|
|
27
|
+
etho/services/camera/spinnaker.py,sha256=4QewxZlNm0CSRyfXK-9300QthD4egCX1ulyEg_qPsi0,11961
|
|
28
|
+
etho/services/camera/ximea.py,sha256=qNPMC49j_WH3xkRfv0sZF20HVu4W4FTA6-lsFqy8OOc,5306
|
|
29
|
+
etho/services/daq/IOTask.py,sha256=JE9joY5RryAevPKlDmfNlzRZUHt3lnE5MAUHbd9blT0,12633
|
|
30
|
+
etho/services/daq/ai.py,sha256=JNDbhtZbmuO-LbKtybmWIPGpMYuFw41xGJg63ZPTgCw,6561
|
|
31
|
+
etho/services/dlp/dlp_make_warpfiles.py,sha256=YL9rBmryb_mwDpwc6QlXTf7jqANyFg8XVcAVt0dM2S8,5995
|
|
32
|
+
etho/services/dlp/dlp_runners.py,sha256=KSNn8PXvDAW5TDJ54zXUi9wYWXyLJ0uojpSnFChpugA,8885
|
|
33
|
+
etho/services/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
+
etho/services/utils/concurrent_task.py,sha256=nvIYMZc1zgpMc3D_Gs-Je__wK3fcVm5BQhu-ojcK82k,9154
|
|
35
|
+
etho/services/utils/log_exceptions.py,sha256=di4vbfK3YT4ZXtugcaltGeqCh5MMZQ86M1NIyTgUaZo,1059
|
|
36
|
+
etho/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
+
etho/utils/calibration.py,sha256=-FMABMS-ReJ4XXR0wUAiAqGizXX5Vlj2NYH4ofiBnpA,3145
|
|
38
|
+
etho/utils/config.py,sha256=Og5cMvkizgluE74Q-QnaBkcGh_EzdJzj6IPlM2sOvt4,1273
|
|
39
|
+
etho/utils/runner.py,sha256=XiUWQp0ua1DYwHUdgBr5Z_lz5ZVxBVCidPBgjckEaH8,4171
|
|
40
|
+
etho/utils/shuffled_cycle.py,sha256=WvBbNQP-iK7fVoCgHGTDjmT0wJhZm8Rb7IDXIbBcE5Q,1481
|
|
41
|
+
etho/utils/sound.py,sha256=Yjn9IbCo7eHLIxeU2FsgDo1TeBClcG0ujTZcualIdww,13207
|
|
42
|
+
etho/utils/tui.py,sha256=zPaV5ItzOa3QuC3DGMNcTWM4N3El87hnAnTy51lacHs,3777
|
|
43
|
+
etho/utils/zeroclient.py,sha256=3wHR9rtHlESLu9UR1hZRsVisGNpLJKYv2m0sIJUbT08,3498
|
|
44
|
+
etho_python-0.22.0.dist-info/entry_points.txt,sha256=Y9LGGC-42Xm1bv62a_IiLYVq8T2HoPO5fLypuFfqamo,38
|
|
45
|
+
etho_python-0.22.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
46
|
+
etho_python-0.22.0.dist-info/METADATA,sha256=8vWXK_NU6Rqqkcm8q2LgPKmy8Ia9BIN2otYCpnm5lJ4,1499
|
|
47
|
+
etho_python-0.22.0.dist-info/RECORD,,
|