horiba-sdk 0.3.3__tar.gz → 0.4.0__tar.gz
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-0.3.3 → horiba_sdk-0.4.0}/PKG-INFO +108 -13
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/README.md +107 -11
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/__init__.py +0 -4
- horiba_sdk-0.4.0/horiba_sdk/core/acquisition_format.py +10 -0
- horiba_sdk-0.4.0/horiba_sdk/core/clean_count_mode.py +11 -0
- horiba_sdk-0.4.0/horiba_sdk/core/timer_resolution.py +12 -0
- horiba_sdk-0.4.0/horiba_sdk/core/x_axis_conversion_type.py +13 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/ccd_discovery.py +10 -12
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/device_manager.py +13 -10
- horiba_sdk-0.4.0/horiba_sdk/devices/fake_responses/ccd.json +417 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_responses/monochromator.json +38 -10
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/monochromator_discovery.py +16 -9
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/single_devices/abstract_device.py +8 -0
- horiba_sdk-0.4.0/horiba_sdk/devices/single_devices/ccd.py +649 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/single_devices/monochromator.py +73 -70
- horiba_sdk-0.4.0/horiba_sdk/sync/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/communication/abstract_communicator.py +2 -3
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/communication/websocket_communicator.py +37 -17
- horiba_sdk-0.4.0/horiba_sdk/sync/devices/device_discovery.py +58 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/device_manager.py +13 -10
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/fake_icl_server.py +9 -6
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/single_devices/abstract_device.py +11 -7
- horiba_sdk-0.4.0/horiba_sdk/sync/devices/single_devices/ccd.py +636 -0
- horiba_sdk-0.4.0/horiba_sdk/sync/devices/single_devices/monochromator.py +400 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/pyproject.toml +2 -3
- horiba_sdk-0.3.3/horiba_sdk/devices/fake_responses/ccd.json +0 -168
- horiba_sdk-0.3.3/horiba_sdk/devices/single_devices/ccd.py +0 -443
- horiba_sdk-0.3.3/horiba_sdk/sync/devices/device_discovery.py +0 -82
- horiba_sdk-0.3.3/horiba_sdk/sync/devices/single_devices/ccd.py +0 -219
- horiba_sdk-0.3.3/horiba_sdk/sync/devices/single_devices/monochromator.py +0 -150
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/LICENSE +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/communication/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/communication/abstract_communicator.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/communication/communication_exception.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/communication/messages.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/communication/websocket_communicator.py +0 -0
- {horiba_sdk-0.3.3/horiba_sdk/sync → horiba_sdk-0.4.0/horiba_sdk/core}/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/core/resolution.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/abstract_device_discovery.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/abstract_device_manager.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_device_manager.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_icl_server.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_responses/icl.json +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/devices/single_devices/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/abstract_error.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/abstract_error_db.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/error_list.json +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/icl_error.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/icl_error_db.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/communication/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/communication/test_client.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/__init__.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/abstract_device_discovery.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/abstract_device_manager.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/fake_device_manager.py +0 -0
- {horiba_sdk-0.3.3 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/single_devices/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: horiba-sdk
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
4
4
|
Summary: 'horiba-sdk' is a package that provides source code for the development with Horiba devices
|
5
5
|
Home-page: https://github.com/ThatsTheEnd/horiba-python-sdk
|
6
6
|
License: MIT
|
@@ -18,7 +18,6 @@ Classifier: Programming Language :: Python :: 3.10
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.11
|
19
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
20
20
|
Requires-Dist: loguru (>=0.7.2,<0.8.0)
|
21
|
-
Requires-Dist: numericalunits (>=1.25,<2.0)
|
22
21
|
Requires-Dist: overrides (>=7.4.0,<8.0.0)
|
23
22
|
Requires-Dist: pint (>=0.23,<0.24)
|
24
23
|
Requires-Dist: psutil (>=5.9.7,<6.0.0)
|
@@ -47,13 +46,70 @@ Description-Content-Type: text/markdown
|
|
47
46
|
|
48
47
|
</div>
|
49
48
|
|
49
|
+
___
|
50
|
+
|
51
|
+
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
|
52
|
+
|
53
|
+
> [!WARNING]
|
54
|
+
> This SDK is under development and not yet released.
|
55
|
+
|
56
|
+
> [!IMPORTANT]
|
57
|
+
> For this python code to work, the SDK from Horiba has to be purchased, installed and licensed.
|
58
|
+
> The code in this repo and the SDK are under development and not yet released for public use!
|
59
|
+
|
60
|
+
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
|
61
|
+
|
62
|
+
___
|
63
|
+
|
50
64
|
**📦 Prerequisites**
|
51
65
|
|
52
66
|
* Python `>=3.9`
|
53
|
-
* ICL
|
67
|
+
* ICL.exe installed as part of the Horiba SDK, licensed and activated
|
68
|
+
|
69
|
+
<details>
|
70
|
+
<summary>To make sure that the USB devices do not get disconnected, uncheck the following boxes in the properties</summary>
|
71
|
+
|
72
|
+

|
73
|
+
|
74
|
+
</details>
|
54
75
|
|
55
76
|
## 🛠️ Usage
|
56
77
|
|
78
|
+
<details>
|
79
|
+
<summary>Video of the steps below</summary>
|
80
|
+
|
81
|
+

|
82
|
+
|
83
|
+
</details>
|
84
|
+
|
85
|
+
0. (Optional but recommended) Work in a virtual environment:
|
86
|
+
|
87
|
+
Navigate to the (empty) project folder you want to work and run:
|
88
|
+
|
89
|
+
```bash
|
90
|
+
python -m venv .
|
91
|
+
```
|
92
|
+
|
93
|
+
Activate the virtual environment:
|
94
|
+
|
95
|
+
<details>
|
96
|
+
<summary>Windows</summary>
|
97
|
+
|
98
|
+
```powershell
|
99
|
+
.\Scripts\activate
|
100
|
+
```
|
101
|
+
</details>
|
102
|
+
|
103
|
+
<details>
|
104
|
+
<summary>Unix</summary>
|
105
|
+
|
106
|
+
```bash
|
107
|
+
source ./bin/activate
|
108
|
+
```
|
109
|
+
</details>
|
110
|
+
|
111
|
+
*Note: do deactivate it, simply run `deactivate`.*
|
112
|
+
|
57
113
|
|
58
114
|
1. Install the sdk:
|
59
115
|
|
@@ -68,10 +124,21 @@ Description-Content-Type: text/markdown
|
|
68
124
|
```
|
69
125
|
|
70
126
|
2. Create a file named `center_scan.py` and copy-paste the content of
|
71
|
-
[`examples/asynchronous_examples/center_scan.py`](
|
127
|
+
[`examples/asynchronous_examples/center_scan.py`](examples/asynchronous_examples/center_scan.py)
|
128
|
+
|
129
|
+
3. Install the required library for plotting the graph in the example:
|
130
|
+
|
131
|
+
```bash
|
132
|
+
pip install matplotlib
|
133
|
+
```
|
134
|
+
|
135
|
+
or install with `Poetry`
|
72
136
|
|
137
|
+
```bash
|
138
|
+
poetry add matplotlib
|
139
|
+
```
|
73
140
|
|
74
|
-
|
141
|
+
4. Run the example with:
|
75
142
|
|
76
143
|
```bash
|
77
144
|
python center_scan.py
|
@@ -79,13 +146,13 @@ Description-Content-Type: text/markdown
|
|
79
146
|
|
80
147
|
## 👩💻 First steps as contributor
|
81
148
|
|
82
|
-
###
|
149
|
+
### Clone and setup the repo
|
83
150
|
|
84
|
-
1.
|
151
|
+
1. Clone the repo:
|
85
152
|
|
86
153
|
```bash
|
154
|
+
git clone https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
87
155
|
cd horiba-python-sdk
|
88
|
-
git init
|
89
156
|
```
|
90
157
|
|
91
158
|
2. If you don't have `Poetry` installed run:
|
@@ -107,14 +174,12 @@ make pre-commit-install
|
|
107
174
|
make codestyle
|
108
175
|
```
|
109
176
|
|
110
|
-
5.
|
177
|
+
5. To push local changes to the remote repository, run:
|
111
178
|
|
112
179
|
```bash
|
113
180
|
git add .
|
114
|
-
git commit -m ":
|
115
|
-
git
|
116
|
-
git remote add origin https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
117
|
-
git push -u origin main
|
181
|
+
git commit -m "feat: add new feature xyz"
|
182
|
+
git push
|
118
183
|
```
|
119
184
|
|
120
185
|
<!-- ### Set up bots -->
|
@@ -262,7 +327,37 @@ make mypy
|
|
262
327
|
|
263
328
|
Run `pytest`
|
264
329
|
|
330
|
+
Unix:
|
331
|
+
|
332
|
+
```bash
|
333
|
+
make test
|
334
|
+
```
|
335
|
+
|
336
|
+
Windows:
|
337
|
+
|
338
|
+
```powershell
|
339
|
+
poetry run pytest -c pyproject.toml --cov-report=html --cov=horiba_sdk tests/
|
340
|
+
```
|
341
|
+
|
342
|
+
For the hardware tests run the following:
|
343
|
+
|
344
|
+
Windows:
|
345
|
+
|
346
|
+
```powershell
|
347
|
+
$env:HAS_HARDWARE="true"
|
348
|
+
# If you want a remote ICL be used for the tests
|
349
|
+
# $env:TEST_ICL_IP="192.168.21.24"
|
350
|
+
# $env:TEST_ICL_PORT="1234"
|
351
|
+
poetry run pytest -c pyproject.toml --cov-report=html --cov=horiba_sdk tests/
|
352
|
+
```
|
353
|
+
|
354
|
+
Unix:
|
355
|
+
|
265
356
|
```bash
|
357
|
+
HAS_HARDWARE="true"
|
358
|
+
# If you want a remote ICL be used for the tests
|
359
|
+
# TEST_ICL_IP="192.168.21.24"
|
360
|
+
# TEST_ICL_PORT="1234"
|
266
361
|
make test
|
267
362
|
```
|
268
363
|
|
@@ -19,13 +19,70 @@
|
|
19
19
|
|
20
20
|
</div>
|
21
21
|
|
22
|
+
___
|
23
|
+
|
24
|
+
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
|
25
|
+
|
26
|
+
> [!WARNING]
|
27
|
+
> This SDK is under development and not yet released.
|
28
|
+
|
29
|
+
> [!IMPORTANT]
|
30
|
+
> For this python code to work, the SDK from Horiba has to be purchased, installed and licensed.
|
31
|
+
> The code in this repo and the SDK are under development and not yet released for public use!
|
32
|
+
|
33
|
+
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
|
34
|
+
|
35
|
+
___
|
36
|
+
|
22
37
|
**📦 Prerequisites**
|
23
38
|
|
24
39
|
* Python `>=3.9`
|
25
|
-
* ICL
|
40
|
+
* ICL.exe installed as part of the Horiba SDK, licensed and activated
|
41
|
+
|
42
|
+
<details>
|
43
|
+
<summary>To make sure that the USB devices do not get disconnected, uncheck the following boxes in the properties</summary>
|
44
|
+
|
45
|
+

|
46
|
+
|
47
|
+
</details>
|
26
48
|
|
27
49
|
## 🛠️ Usage
|
28
50
|
|
51
|
+
<details>
|
52
|
+
<summary>Video of the steps below</summary>
|
53
|
+
|
54
|
+

|
55
|
+
|
56
|
+
</details>
|
57
|
+
|
58
|
+
0. (Optional but recommended) Work in a virtual environment:
|
59
|
+
|
60
|
+
Navigate to the (empty) project folder you want to work and run:
|
61
|
+
|
62
|
+
```bash
|
63
|
+
python -m venv .
|
64
|
+
```
|
65
|
+
|
66
|
+
Activate the virtual environment:
|
67
|
+
|
68
|
+
<details>
|
69
|
+
<summary>Windows</summary>
|
70
|
+
|
71
|
+
```powershell
|
72
|
+
.\Scripts\activate
|
73
|
+
```
|
74
|
+
</details>
|
75
|
+
|
76
|
+
<details>
|
77
|
+
<summary>Unix</summary>
|
78
|
+
|
79
|
+
```bash
|
80
|
+
source ./bin/activate
|
81
|
+
```
|
82
|
+
</details>
|
83
|
+
|
84
|
+
*Note: do deactivate it, simply run `deactivate`.*
|
85
|
+
|
29
86
|
|
30
87
|
1. Install the sdk:
|
31
88
|
|
@@ -40,10 +97,21 @@
|
|
40
97
|
```
|
41
98
|
|
42
99
|
2. Create a file named `center_scan.py` and copy-paste the content of
|
43
|
-
[`examples/asynchronous_examples/center_scan.py`](
|
100
|
+
[`examples/asynchronous_examples/center_scan.py`](examples/asynchronous_examples/center_scan.py)
|
101
|
+
|
102
|
+
3. Install the required library for plotting the graph in the example:
|
103
|
+
|
104
|
+
```bash
|
105
|
+
pip install matplotlib
|
106
|
+
```
|
107
|
+
|
108
|
+
or install with `Poetry`
|
44
109
|
|
110
|
+
```bash
|
111
|
+
poetry add matplotlib
|
112
|
+
```
|
45
113
|
|
46
|
-
|
114
|
+
4. Run the example with:
|
47
115
|
|
48
116
|
```bash
|
49
117
|
python center_scan.py
|
@@ -51,13 +119,13 @@
|
|
51
119
|
|
52
120
|
## 👩💻 First steps as contributor
|
53
121
|
|
54
|
-
###
|
122
|
+
### Clone and setup the repo
|
55
123
|
|
56
|
-
1.
|
124
|
+
1. Clone the repo:
|
57
125
|
|
58
126
|
```bash
|
127
|
+
git clone https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
59
128
|
cd horiba-python-sdk
|
60
|
-
git init
|
61
129
|
```
|
62
130
|
|
63
131
|
2. If you don't have `Poetry` installed run:
|
@@ -79,14 +147,12 @@ make pre-commit-install
|
|
79
147
|
make codestyle
|
80
148
|
```
|
81
149
|
|
82
|
-
5.
|
150
|
+
5. To push local changes to the remote repository, run:
|
83
151
|
|
84
152
|
```bash
|
85
153
|
git add .
|
86
|
-
git commit -m ":
|
87
|
-
git
|
88
|
-
git remote add origin https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
89
|
-
git push -u origin main
|
154
|
+
git commit -m "feat: add new feature xyz"
|
155
|
+
git push
|
90
156
|
```
|
91
157
|
|
92
158
|
<!-- ### Set up bots -->
|
@@ -234,7 +300,37 @@ make mypy
|
|
234
300
|
|
235
301
|
Run `pytest`
|
236
302
|
|
303
|
+
Unix:
|
304
|
+
|
305
|
+
```bash
|
306
|
+
make test
|
307
|
+
```
|
308
|
+
|
309
|
+
Windows:
|
310
|
+
|
311
|
+
```powershell
|
312
|
+
poetry run pytest -c pyproject.toml --cov-report=html --cov=horiba_sdk tests/
|
313
|
+
```
|
314
|
+
|
315
|
+
For the hardware tests run the following:
|
316
|
+
|
317
|
+
Windows:
|
318
|
+
|
319
|
+
```powershell
|
320
|
+
$env:HAS_HARDWARE="true"
|
321
|
+
# If you want a remote ICL be used for the tests
|
322
|
+
# $env:TEST_ICL_IP="192.168.21.24"
|
323
|
+
# $env:TEST_ICL_PORT="1234"
|
324
|
+
poetry run pytest -c pyproject.toml --cov-report=html --cov=horiba_sdk tests/
|
325
|
+
```
|
326
|
+
|
327
|
+
Unix:
|
328
|
+
|
237
329
|
```bash
|
330
|
+
HAS_HARDWARE="true"
|
331
|
+
# If you want a remote ICL be used for the tests
|
332
|
+
# TEST_ICL_IP="192.168.21.24"
|
333
|
+
# TEST_ICL_PORT="1234"
|
238
334
|
make test
|
239
335
|
```
|
240
336
|
|
@@ -4,8 +4,6 @@
|
|
4
4
|
__version__ = '0.2.0' # It MUST match the version in pyproject.toml file
|
5
5
|
from importlib import metadata as importlib_metadata
|
6
6
|
|
7
|
-
from pint import UnitRegistry
|
8
|
-
|
9
7
|
|
10
8
|
def get_version() -> str:
|
11
9
|
try:
|
@@ -15,5 +13,3 @@ def get_version() -> str:
|
|
15
13
|
|
16
14
|
|
17
15
|
version: str = get_version()
|
18
|
-
|
19
|
-
ureg = UnitRegistry()
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import re
|
2
1
|
from typing import Any, final
|
3
2
|
|
4
3
|
from loguru import logger
|
@@ -32,24 +31,23 @@ class ChargeCoupledDevicesDiscovery(AbstractDeviceDiscovery):
|
|
32
31
|
response: Response = await self._communicator.request_with_response(Command('ccd_discover', {}))
|
33
32
|
if response.results.get('count', 0) == 0 and error_on_no_device:
|
34
33
|
raise Exception('No CCDs connected')
|
34
|
+
|
35
35
|
response = await self._communicator.request_with_response(Command('ccd_list', {}))
|
36
36
|
|
37
37
|
raw_device_list = response.results
|
38
38
|
self._charge_coupled_devices = self._parse_ccds(raw_device_list)
|
39
|
-
logger.info(f'Found {len(self._charge_coupled_devices)} CCD devices
|
39
|
+
logger.info(f'Found {len(self._charge_coupled_devices)} CCD devices')
|
40
40
|
|
41
41
|
def _parse_ccds(self, raw_device_list: dict[str, Any]) -> list[ChargeCoupledDevice]:
|
42
42
|
detected_ccds: list[ChargeCoupledDevice] = []
|
43
|
-
for
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
logger.info(f'Detected CCD: {ccd_type}')
|
52
|
-
detected_ccds.append(ChargeCoupledDevice(ccd_index, self._communicator, self._error_db))
|
43
|
+
for device in raw_device_list['devices']:
|
44
|
+
try:
|
45
|
+
logger.debug(f'Parsing CCD: {device}')
|
46
|
+
ccd = ChargeCoupledDevice(device['index'], self._communicator, self._error_db)
|
47
|
+
logger.info(f'Detected CCD: {device["deviceType"]}')
|
48
|
+
detected_ccds.append(ccd)
|
49
|
+
except Exception as e:
|
50
|
+
logger.error(f'Error while parsing ChargeCoupledDevice: {e}')
|
53
51
|
|
54
52
|
return detected_ccds
|
55
53
|
|
@@ -63,8 +63,8 @@ class DeviceManager(AbstractDeviceManager):
|
|
63
63
|
def __init__(
|
64
64
|
self,
|
65
65
|
start_icl: bool = True,
|
66
|
-
|
67
|
-
|
66
|
+
icl_ip: str = '127.0.0.1',
|
67
|
+
icl_port: str = '25010',
|
68
68
|
enable_binary_messages: bool = True,
|
69
69
|
):
|
70
70
|
"""
|
@@ -72,18 +72,16 @@ class DeviceManager(AbstractDeviceManager):
|
|
72
72
|
|
73
73
|
Args:
|
74
74
|
start_icl (bool) = True: If True, the ICL software is started and communication is established.
|
75
|
-
|
76
|
-
|
75
|
+
icl_ip (str) = '127.0.0.1': websocket IP
|
76
|
+
icl_port (str) = '25010': websocket port
|
77
77
|
enable_binary_messages (bool) = True: If True, binary messages are enabled.
|
78
78
|
"""
|
79
79
|
super().__init__()
|
80
80
|
self._start_icl = start_icl
|
81
|
-
self._icl_communicator: WebsocketCommunicator = WebsocketCommunicator(
|
82
|
-
'ws://' + websocket_ip + ':' + str(websocket_port)
|
83
|
-
)
|
81
|
+
self._icl_communicator: WebsocketCommunicator = WebsocketCommunicator('ws://' + icl_ip + ':' + str(icl_port))
|
84
82
|
self._icl_communicator.register_binary_message_callback(self._binary_message_callback)
|
85
|
-
self._icl_websocket_ip: str =
|
86
|
-
self._icl_websocket_port: str =
|
83
|
+
self._icl_websocket_ip: str = icl_ip
|
84
|
+
self._icl_websocket_port: str = icl_port
|
87
85
|
self._icl_process: Optional[asyncio.subprocess.Process] = None
|
88
86
|
self._binary_messages: bool = enable_binary_messages
|
89
87
|
self._charge_coupled_devices: list[ChargeCoupledDevice] = []
|
@@ -109,7 +107,12 @@ class DeviceManager(AbstractDeviceManager):
|
|
109
107
|
|
110
108
|
@override
|
111
109
|
async def stop(self) -> None:
|
112
|
-
|
110
|
+
if self._start_icl:
|
111
|
+
await self.stop_icl()
|
112
|
+
return
|
113
|
+
|
114
|
+
if self._icl_communicator.opened():
|
115
|
+
await self._icl_communicator.close()
|
113
116
|
|
114
117
|
async def start_icl(self) -> None:
|
115
118
|
"""
|