horiba-sdk 0.3.2__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.2 → horiba_sdk-0.4.0}/PKG-INFO +120 -18
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/README.md +119 -16
- {horiba_sdk-0.3.2 → 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.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/ccd_discovery.py +10 -12
- {horiba_sdk-0.3.2 → 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.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_responses/monochromator.json +38 -10
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/monochromator_discovery.py +16 -9
- {horiba_sdk-0.3.2 → 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.2 → 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.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/communication/abstract_communicator.py +2 -3
- {horiba_sdk-0.3.2 → 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.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/device_manager.py +13 -10
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/fake_icl_server.py +9 -6
- {horiba_sdk-0.3.2 → 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.2 → horiba_sdk-0.4.0}/pyproject.toml +2 -3
- horiba_sdk-0.3.2/horiba_sdk/devices/fake_responses/ccd.json +0 -168
- horiba_sdk-0.3.2/horiba_sdk/devices/single_devices/ccd.py +0 -443
- horiba_sdk-0.3.2/horiba_sdk/sync/devices/device_discovery.py +0 -82
- horiba_sdk-0.3.2/horiba_sdk/sync/devices/single_devices/ccd.py +0 -219
- horiba_sdk-0.3.2/horiba_sdk/sync/devices/single_devices/monochromator.py +0 -150
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/LICENSE +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/communication/__init__.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/communication/abstract_communicator.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/communication/communication_exception.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/communication/messages.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/communication/websocket_communicator.py +0 -0
- {horiba_sdk-0.3.2/horiba_sdk/sync → horiba_sdk-0.4.0/horiba_sdk/core}/__init__.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/core/resolution.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/__init__.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/abstract_device_discovery.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/abstract_device_manager.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_device_manager.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_icl_server.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/fake_responses/icl.json +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/devices/single_devices/__init__.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/__init__.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/abstract_error.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/abstract_error_db.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/error_list.json +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/icl_error.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/icl_error/icl_error_db.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/communication/__init__.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/communication/test_client.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/__init__.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/abstract_device_discovery.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/abstract_device_manager.py +0 -0
- {horiba_sdk-0.3.2 → horiba_sdk-0.4.0}/horiba_sdk/sync/devices/fake_device_manager.py +0 -0
- {horiba_sdk-0.3.2 → 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)
|
@@ -30,11 +29,12 @@ Description-Content-Type: text/markdown
|
|
30
29
|
|
31
30
|
<div align="center">
|
32
31
|
|
33
|
-
[](https://github.com/ThatsTheEnd/horiba-python-sdk/actions/workflows/build.yml)
|
33
|
+
[](https://pypi.org/project/horiba-sdk/)
|
34
|
+
[](https://pypi.org/project/horiba-sdk/)
|
35
35
|
[](https://github.com/ThatsTheEnd/horiba-python-sdk/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)
|
36
36
|
|
37
|
-
[](https://github.com/astral-sh/ruff)
|
38
38
|
[](https://github.com/PyCQA/bandit)
|
39
39
|
[](https://github.com/ThatsTheEnd/horiba-python-sdk/blob/master/.pre-commit-config.yaml)
|
40
40
|
[](https://github.com/ThatsTheEnd/horiba-python-sdk/releases)
|
@@ -42,29 +42,103 @@ Description-Content-Type: text/markdown
|
|
42
42
|

|
43
43
|
[](https://horiba-python-sdk.readthedocs.io/en/latest/?badge=latest)
|
44
44
|
|
45
|
-
'horiba-
|
45
|
+
'horiba-sdk' is a package that provides source code for the development with Horiba devices
|
46
46
|
|
47
47
|
</div>
|
48
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
|
+
|
64
|
+
**📦 Prerequisites**
|
65
|
+
|
66
|
+
* Python `>=3.9`
|
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>
|
75
|
+
|
49
76
|
## 🛠️ Usage
|
50
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
|
+
|
113
|
+
|
51
114
|
1. Install the sdk:
|
52
115
|
|
53
116
|
```bash
|
54
|
-
pip install horiba-
|
117
|
+
pip install horiba-sdk
|
55
118
|
```
|
56
119
|
|
57
120
|
or install with `Poetry`
|
58
121
|
|
59
122
|
```bash
|
60
|
-
poetry add horiba-
|
123
|
+
poetry add horiba-sdk
|
61
124
|
```
|
62
125
|
|
63
126
|
2. Create a file named `center_scan.py` and copy-paste the content of
|
64
|
-
[`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:
|
65
130
|
|
131
|
+
```bash
|
132
|
+
pip install matplotlib
|
133
|
+
```
|
134
|
+
|
135
|
+
or install with `Poetry`
|
136
|
+
|
137
|
+
```bash
|
138
|
+
poetry add matplotlib
|
139
|
+
```
|
66
140
|
|
67
|
-
|
141
|
+
4. Run the example with:
|
68
142
|
|
69
143
|
```bash
|
70
144
|
python center_scan.py
|
@@ -72,13 +146,13 @@ Description-Content-Type: text/markdown
|
|
72
146
|
|
73
147
|
## 👩💻 First steps as contributor
|
74
148
|
|
75
|
-
###
|
149
|
+
### Clone and setup the repo
|
76
150
|
|
77
|
-
1.
|
151
|
+
1. Clone the repo:
|
78
152
|
|
79
153
|
```bash
|
154
|
+
git clone https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
80
155
|
cd horiba-python-sdk
|
81
|
-
git init
|
82
156
|
```
|
83
157
|
|
84
158
|
2. If you don't have `Poetry` installed run:
|
@@ -100,14 +174,12 @@ make pre-commit-install
|
|
100
174
|
make codestyle
|
101
175
|
```
|
102
176
|
|
103
|
-
5.
|
177
|
+
5. To push local changes to the remote repository, run:
|
104
178
|
|
105
179
|
```bash
|
106
180
|
git add .
|
107
|
-
git commit -m ":
|
108
|
-
git
|
109
|
-
git remote add origin https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
110
|
-
git push -u origin main
|
181
|
+
git commit -m "feat: add new feature xyz"
|
182
|
+
git push
|
111
183
|
```
|
112
184
|
|
113
185
|
<!-- ### Set up bots -->
|
@@ -255,7 +327,37 @@ make mypy
|
|
255
327
|
|
256
328
|
Run `pytest`
|
257
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
|
+
|
258
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"
|
259
361
|
make test
|
260
362
|
```
|
261
363
|
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
<div align="center">
|
4
4
|
|
5
|
-
[](https://github.com/ThatsTheEnd/horiba-python-sdk/actions/workflows/build.yml)
|
6
|
+
[](https://pypi.org/project/horiba-sdk/)
|
7
|
+
[](https://pypi.org/project/horiba-sdk/)
|
7
8
|
[](https://github.com/ThatsTheEnd/horiba-python-sdk/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)
|
8
9
|
|
9
|
-
[](https://github.com/astral-sh/ruff)
|
10
11
|
[](https://github.com/PyCQA/bandit)
|
11
12
|
[](https://github.com/ThatsTheEnd/horiba-python-sdk/blob/master/.pre-commit-config.yaml)
|
12
13
|
[](https://github.com/ThatsTheEnd/horiba-python-sdk/releases)
|
@@ -14,29 +15,103 @@
|
|
14
15
|

|
15
16
|
[](https://horiba-python-sdk.readthedocs.io/en/latest/?badge=latest)
|
16
17
|
|
17
|
-
'horiba-
|
18
|
+
'horiba-sdk' is a package that provides source code for the development with Horiba devices
|
18
19
|
|
19
20
|
</div>
|
20
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
|
+
|
37
|
+
**📦 Prerequisites**
|
38
|
+
|
39
|
+
* Python `>=3.9`
|
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>
|
48
|
+
|
21
49
|
## 🛠️ Usage
|
22
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
|
+
|
86
|
+
|
23
87
|
1. Install the sdk:
|
24
88
|
|
25
89
|
```bash
|
26
|
-
pip install horiba-
|
90
|
+
pip install horiba-sdk
|
27
91
|
```
|
28
92
|
|
29
93
|
or install with `Poetry`
|
30
94
|
|
31
95
|
```bash
|
32
|
-
poetry add horiba-
|
96
|
+
poetry add horiba-sdk
|
33
97
|
```
|
34
98
|
|
35
99
|
2. Create a file named `center_scan.py` and copy-paste the content of
|
36
|
-
[`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:
|
37
103
|
|
104
|
+
```bash
|
105
|
+
pip install matplotlib
|
106
|
+
```
|
107
|
+
|
108
|
+
or install with `Poetry`
|
109
|
+
|
110
|
+
```bash
|
111
|
+
poetry add matplotlib
|
112
|
+
```
|
38
113
|
|
39
|
-
|
114
|
+
4. Run the example with:
|
40
115
|
|
41
116
|
```bash
|
42
117
|
python center_scan.py
|
@@ -44,13 +119,13 @@
|
|
44
119
|
|
45
120
|
## 👩💻 First steps as contributor
|
46
121
|
|
47
|
-
###
|
122
|
+
### Clone and setup the repo
|
48
123
|
|
49
|
-
1.
|
124
|
+
1. Clone the repo:
|
50
125
|
|
51
126
|
```bash
|
127
|
+
git clone https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
52
128
|
cd horiba-python-sdk
|
53
|
-
git init
|
54
129
|
```
|
55
130
|
|
56
131
|
2. If you don't have `Poetry` installed run:
|
@@ -72,14 +147,12 @@ make pre-commit-install
|
|
72
147
|
make codestyle
|
73
148
|
```
|
74
149
|
|
75
|
-
5.
|
150
|
+
5. To push local changes to the remote repository, run:
|
76
151
|
|
77
152
|
```bash
|
78
153
|
git add .
|
79
|
-
git commit -m ":
|
80
|
-
git
|
81
|
-
git remote add origin https://github.com/ThatsTheEnd/horiba-python-sdk.git
|
82
|
-
git push -u origin main
|
154
|
+
git commit -m "feat: add new feature xyz"
|
155
|
+
git push
|
83
156
|
```
|
84
157
|
|
85
158
|
<!-- ### Set up bots -->
|
@@ -227,7 +300,37 @@ make mypy
|
|
227
300
|
|
228
301
|
Run `pytest`
|
229
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
|
+
|
230
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"
|
231
334
|
make test
|
232
335
|
```
|
233
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
|
"""
|