horiba-sdk 0.3.3__py3-none-any.whl → 0.5.2__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.
- horiba_sdk/__init__.py +5 -3
- horiba_sdk/communication/websocket_communicator.py +2 -2
- horiba_sdk/core/__init__.py +0 -0
- horiba_sdk/core/acquisition_format.py +20 -0
- horiba_sdk/core/clean_count_mode.py +13 -0
- horiba_sdk/core/timer_resolution.py +14 -0
- horiba_sdk/core/x_axis_conversion_type.py +18 -0
- horiba_sdk/devices/ccd_discovery.py +10 -12
- horiba_sdk/devices/device_manager.py +24 -10
- horiba_sdk/devices/fake_responses/ccd.json +261 -12
- horiba_sdk/devices/fake_responses/monochromator.json +38 -10
- horiba_sdk/devices/monochromator_discovery.py +16 -9
- horiba_sdk/devices/single_devices/abstract_device.py +46 -1
- horiba_sdk/devices/single_devices/ccd.py +388 -143
- horiba_sdk/devices/single_devices/monochromator.py +87 -71
- horiba_sdk/sync/communication/abstract_communicator.py +2 -3
- horiba_sdk/sync/communication/websocket_communicator.py +38 -18
- horiba_sdk/sync/devices/device_discovery.py +13 -37
- horiba_sdk/sync/devices/device_manager.py +14 -10
- horiba_sdk/sync/devices/fake_icl_server.py +9 -6
- horiba_sdk/sync/devices/single_devices/abstract_device.py +11 -7
- horiba_sdk/sync/devices/single_devices/ccd.py +517 -62
- horiba_sdk/sync/devices/single_devices/monochromator.py +288 -25
- {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/METADATA +166 -92
- {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/RECORD +27 -22
- {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/LICENSE +0 -0
- {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/WHEEL +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
|
-
from typing import Any
|
2
|
+
from typing import Any, List, Optional
|
3
3
|
|
4
4
|
from horiba_sdk.communication import AbstractCommunicator, Command, Response
|
5
5
|
from horiba_sdk.icl_error import AbstractError, AbstractErrorDB
|
@@ -22,6 +22,14 @@ class AbstractDevice(ABC):
|
|
22
22
|
self._error_db: AbstractErrorDB = error_db
|
23
23
|
self._communicator: AbstractCommunicator = communicator
|
24
24
|
|
25
|
+
def id(self) -> int:
|
26
|
+
"""Return the ID of the device.
|
27
|
+
|
28
|
+
Returns:
|
29
|
+
int: ID of the device.
|
30
|
+
"""
|
31
|
+
return self._id
|
32
|
+
|
25
33
|
@abstractmethod
|
26
34
|
async def open(self) -> None:
|
27
35
|
"""
|
@@ -43,6 +51,43 @@ class AbstractDevice(ABC):
|
|
43
51
|
"""
|
44
52
|
pass
|
45
53
|
|
54
|
+
async def pass_command(
|
55
|
+
self, command: str, params: Optional[List[Any]] = None, values: Optional[List[Any]] = None
|
56
|
+
) -> Response:
|
57
|
+
"""command to pass user input strings to ICL
|
58
|
+
|
59
|
+
.. note: used for internal usage
|
60
|
+
"""
|
61
|
+
|
62
|
+
parameters = params if params else []
|
63
|
+
parameter_values = values if values else []
|
64
|
+
|
65
|
+
def convert_to_float(s):
|
66
|
+
try:
|
67
|
+
float(s)
|
68
|
+
return True
|
69
|
+
except ValueError:
|
70
|
+
return False
|
71
|
+
|
72
|
+
j = 0
|
73
|
+
for i in parameter_values:
|
74
|
+
if convert_to_float(i):
|
75
|
+
parameter_values[j] = float(parameter_values[j])
|
76
|
+
print(parameter_values[j])
|
77
|
+
print(type(parameter_values[j]))
|
78
|
+
j += 1
|
79
|
+
else:
|
80
|
+
j += 1
|
81
|
+
|
82
|
+
params_dict = dict(zip(parameters, parameter_values))
|
83
|
+
params_dict['index'] = self._id
|
84
|
+
|
85
|
+
if params[0] == '':
|
86
|
+
response: Response = await self._execute_command(str(command), {'index': self._id})
|
87
|
+
else:
|
88
|
+
response: Response = await self._execute_command(str(command), params_dict)
|
89
|
+
return response
|
90
|
+
|
46
91
|
async def _execute_command(self, command_name: str, parameters: dict[Any, Any], timeout: int = 5) -> Response:
|
47
92
|
"""
|
48
93
|
Creates a command from the command name, and it's parameters
|