pymodaq 5.0.0__py3-none-any.whl → 5.0.1__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.
Potentially problematic release.
This version of pymodaq might be problematic. Click here for more details.
- pymodaq/__init__.py +55 -89
- pymodaq/control_modules/daq_move.py +123 -52
- pymodaq/control_modules/daq_move_ui.py +42 -11
- pymodaq/control_modules/daq_viewer.py +30 -13
- pymodaq/control_modules/move_utility_classes.py +345 -78
- pymodaq/control_modules/utils.py +26 -9
- pymodaq/control_modules/viewer_utility_classes.py +51 -14
- pymodaq/daq_utils/daq_utils.py +6 -0
- pymodaq/dashboard.py +532 -263
- pymodaq/examples/qt_less_standalone_module.py +128 -0
- pymodaq/extensions/bayesian/bayesian_optimisation.py +30 -21
- pymodaq/extensions/bayesian/utils.py +6 -3
- pymodaq/extensions/daq_logger/__init__.py +1 -0
- pymodaq/extensions/daq_logger/daq_logger.py +4 -5
- pymodaq/extensions/daq_scan.py +1 -3
- pymodaq/extensions/daq_scan_ui.py +7 -9
- pymodaq/extensions/pid/__init__.py +0 -1
- pymodaq/extensions/pid/actuator_controller.py +13 -0
- pymodaq/extensions/pid/daq_move_PID.py +25 -46
- pymodaq/extensions/pid/pid_controller.py +48 -40
- pymodaq/extensions/pid/utils.py +3 -2
- pymodaq/extensions/utils.py +41 -7
- pymodaq/resources/setup_plugin.py +1 -0
- pymodaq/updater.py +107 -0
- pymodaq/utils/chrono_timer.py +6 -7
- pymodaq/utils/daq_utils.py +6 -3
- pymodaq/utils/data.py +11 -16
- pymodaq/utils/enums.py +6 -0
- pymodaq/utils/gui_utils/loader_utils.py +27 -2
- pymodaq/utils/gui_utils/utils.py +9 -12
- pymodaq/utils/gui_utils/widgets/lcd.py +8 -0
- pymodaq/utils/leco/daq_move_LECODirector.py +21 -14
- pymodaq/utils/leco/daq_xDviewer_LECODirector.py +13 -8
- pymodaq/utils/leco/pymodaq_listener.py +8 -7
- pymodaq/utils/leco/utils.py +33 -7
- pymodaq/utils/managers/modules_manager.py +20 -10
- pymodaq/utils/managers/overshoot_manager.py +45 -1
- pymodaq/utils/managers/preset_manager.py +22 -46
- pymodaq/utils/managers/preset_manager_utils.py +17 -13
- pymodaq/utils/managers/remote_manager.py +1 -1
- pymodaq/utils/messenger.py +6 -0
- pymodaq/utils/parameter/__init__.py +5 -1
- pymodaq/utils/tcp_ip/mysocket.py +4 -110
- pymodaq/utils/tcp_ip/serializer.py +4 -769
- pymodaq/utils/tcp_ip/tcp_server_client.py +5 -5
- pymodaq-5.0.1.dist-info/METADATA +242 -0
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.1.dist-info}/RECORD +51 -52
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.1.dist-info}/WHEEL +1 -1
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.1.dist-info}/entry_points.txt +1 -0
- pymodaq/examples/custom_app.py +0 -255
- pymodaq/examples/custom_viewer.py +0 -112
- pymodaq/examples/parameter_ex.py +0 -158
- pymodaq/examples/preset_MockCamera.xml +0 -1
- pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.py +0 -142
- pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.ui +0 -232
- pymodaq/post_treatment/daq_measurement/daq_measurement_main.py +0 -391
- pymodaq/post_treatment/daq_measurement/process_from_QtDesigner_DAQ_Measurement_GUI.bat +0 -2
- pymodaq-5.0.0.dist-info/METADATA +0 -166
- /pymodaq/{post_treatment/daq_measurement → daq_utils}/__init__.py +0 -0
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.1.dist-info}/licenses/LICENSE +0 -0
pymodaq/utils/tcp_ip/mysocket.py
CHANGED
|
@@ -4,115 +4,9 @@ Created the 26/10/2023
|
|
|
4
4
|
|
|
5
5
|
@author: Sebastien Weber
|
|
6
6
|
"""
|
|
7
|
-
import
|
|
8
|
-
from typing import Union
|
|
7
|
+
from pymodaq_data.serialize.mysocket import Socket
|
|
9
8
|
|
|
10
|
-
from
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Socket:
|
|
14
|
-
"""Custom Socket wrapping the built-in one and added functionalities to
|
|
15
|
-
make sure message have been sent and received entirely"""
|
|
16
|
-
def __init__(self, socket: socket.socket = None):
|
|
17
|
-
super().__init__()
|
|
18
|
-
self._socket = socket
|
|
19
|
-
|
|
20
|
-
def __eq__(self, other_obj):
|
|
21
|
-
if isinstance(other_obj, Socket):
|
|
22
|
-
other_obj = other_obj.socket
|
|
23
|
-
return self.socket == other_obj
|
|
24
|
-
|
|
25
|
-
@property
|
|
26
|
-
def socket(self):
|
|
27
|
-
return self._socket
|
|
28
|
-
|
|
29
|
-
def bind(self, *args, **kwargs):
|
|
30
|
-
return self.socket.bind(*args, **kwargs)
|
|
31
|
-
|
|
32
|
-
def listen(self, *args, **kwargs):
|
|
33
|
-
return self.socket.listen(*args, **kwargs)
|
|
34
|
-
|
|
35
|
-
def getsockname(self, *args, **kwargs):
|
|
36
|
-
return self.socket.getsockname(*args, **kwargs)
|
|
37
|
-
|
|
38
|
-
def accept(self):
|
|
39
|
-
sock, addr = self.socket.accept()
|
|
40
|
-
return Socket(sock), addr
|
|
41
|
-
|
|
42
|
-
def connect(self, *args, **kwargs):
|
|
43
|
-
return self.socket.connect(*args, **kwargs)
|
|
44
|
-
|
|
45
|
-
def send(self, *args, **kwargs):
|
|
46
|
-
return self.socket.send(*args, **kwargs)
|
|
47
|
-
|
|
48
|
-
def sendall(self, *args, **kwargs):
|
|
49
|
-
return self.socket.sendall(*args, **kwargs)
|
|
50
|
-
|
|
51
|
-
def recv(self, *args, **kwargs):
|
|
52
|
-
return self.socket.recv(*args, **kwargs)
|
|
53
|
-
|
|
54
|
-
def close(self):
|
|
55
|
-
return self.socket.close()
|
|
56
|
-
|
|
57
|
-
def check_sended(self, data_bytes: bytes):
|
|
58
|
-
"""
|
|
59
|
-
Make sure all bytes are sent through the socket
|
|
60
|
-
Parameters
|
|
61
|
-
----------
|
|
62
|
-
data_bytes: bytes
|
|
63
|
-
"""
|
|
64
|
-
if not isinstance(data_bytes, bytes):
|
|
65
|
-
raise TypeError(f'{data_bytes} should be an bytes string, not a {type(data_bytes)}')
|
|
66
|
-
sended = 0
|
|
67
|
-
while sended < len(data_bytes):
|
|
68
|
-
sended += self.socket.send(data_bytes[sended:])
|
|
69
|
-
|
|
70
|
-
def check_sended_with_serializer(self, obj: object):
|
|
71
|
-
""" Convenience function to convert permitted objects to bytes and then use the check_sended method
|
|
72
|
-
|
|
73
|
-
For a list of allowed objects, see :meth:`Serializer.to_bytes`
|
|
74
|
-
"""
|
|
75
|
-
self.check_sended(Serializer(obj).to_bytes())
|
|
76
|
-
|
|
77
|
-
def check_received_length(self, length) -> bytes:
|
|
78
|
-
"""
|
|
79
|
-
Make sure all bytes (length) that should be received are received through the socket
|
|
80
|
-
|
|
81
|
-
Parameters
|
|
82
|
-
----------
|
|
83
|
-
length: int
|
|
84
|
-
The number of bytes to be read from the socket
|
|
85
|
-
|
|
86
|
-
Returns
|
|
87
|
-
-------
|
|
88
|
-
bytes
|
|
89
|
-
"""
|
|
90
|
-
if not isinstance(length, int):
|
|
91
|
-
raise TypeError(f'{length} should be an integer, not a {type(length)}')
|
|
92
|
-
|
|
93
|
-
mess_length = 0
|
|
94
|
-
data_bytes = b''
|
|
95
|
-
while mess_length < length:
|
|
96
|
-
if mess_length < length - 4096:
|
|
97
|
-
data_bytes_tmp = self.socket.recv(4096)
|
|
98
|
-
else:
|
|
99
|
-
data_bytes_tmp = self.socket.recv(length - mess_length)
|
|
100
|
-
mess_length += len(data_bytes_tmp)
|
|
101
|
-
data_bytes += data_bytes_tmp
|
|
102
|
-
# print(data_bytes)
|
|
103
|
-
return data_bytes
|
|
104
|
-
|
|
105
|
-
def get_first_nbytes(self, length: int) -> bytes:
|
|
106
|
-
""" Read the first N bytes from the socket
|
|
107
|
-
|
|
108
|
-
Parameters
|
|
109
|
-
----------
|
|
110
|
-
length: int
|
|
111
|
-
The number of bytes to be read from the socket
|
|
112
|
-
|
|
113
|
-
Returns
|
|
114
|
-
-------
|
|
115
|
-
bytes: the read bytes string
|
|
116
|
-
"""
|
|
117
|
-
return self.check_received_length(length)
|
|
9
|
+
from pymodaq_utils.utils import deprecation_msg
|
|
118
10
|
|
|
11
|
+
deprecation_msg('Importing Socket from pymodaq is deprecated in PyMoDAQ >= 5,'
|
|
12
|
+
'import it from pymodaq_data.serialize.mysocket')
|