smart-emulator 1.0.1__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.
@@ -0,0 +1,5 @@
1
+ [flake8]
2
+ select = B,C,E,F,P,W
3
+ max_line_length = 88
4
+ ignore = E722, P207, W503, E203
5
+ max-complexity = 20
@@ -0,0 +1,68 @@
1
+ # MkDocs build output (built from the root mkdocs.yml)
2
+ public/
3
+ site/
4
+
5
+ # pip cache used by CI
6
+ .cache/
7
+
8
+ # OS / editor cruft
9
+ .DS_Store
10
+ Thumbs.db
11
+ *.swp
12
+
13
+ # Python (smart_emulator_python/ and examples/Python/)
14
+ __pycache__/
15
+ *.py[cod]
16
+ *.pyo
17
+ *.pyd
18
+ *.so
19
+ *.egg
20
+ *.egg-info/
21
+ dist/
22
+ .eggs/
23
+ .env
24
+ .venv
25
+ env/
26
+ venv/
27
+ .mypy_cache/
28
+ .pytest_cache/
29
+ .ruff_cache/
30
+ .claude
31
+
32
+ # C++ (smart_emulator_cpp/ and examples/C++/)
33
+ build/
34
+ CMakeFiles/
35
+ CMakeCache.txt
36
+ cmake_install.cmake
37
+ Makefile
38
+ *.o
39
+ *.a
40
+ *.lib
41
+ *.dll
42
+ *.exe
43
+
44
+ # C++ MSBuild (smart_emulator_cpp/vc-cpp/)
45
+ x64/
46
+ Win32/
47
+ Debug/
48
+ Release/
49
+ *.pdb
50
+ *.ilk
51
+ *.exp
52
+ *.recipe
53
+
54
+ # C# (smart_emulator_csharp/ and examples/C#/) — also covers vc-cpp/'s
55
+ # Visual Studio cache and per-project user settings
56
+ bin/
57
+ obj/
58
+ *.user
59
+ .vs/
60
+ *.suo
61
+
62
+ # Internal dev-test scratch (not public examples) — hardcodes
63
+ # developer-specific paths and performs destructive device operations
64
+ examples/Python/test_all/
65
+ examples/C++/test_all/
66
+ examples/C#/TestAll/
67
+
68
+ output/
@@ -0,0 +1,30 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-json
9
+ - id: check-toml
10
+ - id: check-case-conflict
11
+ - id: check-merge-conflict
12
+
13
+ - repo: https://github.com/asottile/pyupgrade
14
+ rev: v3.19.1
15
+ hooks:
16
+ - id: pyupgrade
17
+ args: [--py38-plus]
18
+
19
+ - repo: https://github.com/psf/black
20
+ rev: 25.1.0
21
+ hooks:
22
+ - id: black
23
+ language_version: python3
24
+ args: [--target-version, py311]
25
+
26
+ - repo: https://github.com/PyCQA/flake8
27
+ rev: 7.1.1
28
+ hooks:
29
+ - id: flake8
30
+ additional_dependencies: [flake8-bugbear]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nuclear Instruments s.r.l.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.5
2
+ Name: smart-emulator
3
+ Version: 1.0.1
4
+ Summary: Smart Emulator for DT4810 Python Library
5
+ Project-URL: Homepage, https://gitlab.nuclearinstruments.eu/public-repo/dt4810/smart-emulator-library
6
+ Project-URL: Documentation, https://public-repo.pages.nuclearinstruments.eu/dt4810/smart-emulator-library/
7
+ Project-URL: Bug Tracker, https://support.nuclearinstruments.eu
8
+ Author-email: Nuclear Instruments <info@nuclearinstruments.eu>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: CAEN,DT4810,Emulator,Nuclear Instruments,firmware,fpga
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Requires-Python: >=3.8
16
+ Requires-Dist: requests
17
+ Description-Content-Type: text/markdown
18
+
19
+ # Smart Emulator — DT4810 Python Library
20
+
21
+ The full user documentation is available [here](https://public-repo.pages.nuclearinstruments.eu/dt4810/smart-emulator-library/).
22
+
23
+ ## Features
24
+
25
+ - Simple connection handling (login/logout, session cookie, error reporting via `DT4810Error`)
26
+ - Pythonic configuration objects mirroring the device's REST API
27
+ - Enumerations for all categorical parameters (shape mode, amplitude mode, rate format, clock source, etc.)
28
+ - High-level acquisition control (turn on/off, reset, statistics, saved configurations)
29
+ - Readout of statistics, spectrum histograms, oscilloscope traces, and the reference spectrum catalog
30
+ - Equivalent client libraries are also available for [C++](../smart_emulator_cpp) and [C#](../smart_emulator_csharp)
31
+
32
+
33
+ ## Quick start
34
+
35
+ ```python
36
+ from smart_emulator import Emulator, ConfigTime, ConfigAmplitude
37
+
38
+ dt = Emulator()
39
+ dt.connect("http://192.168.50.20", "password")
40
+
41
+ print(dt.get_system_info())
42
+
43
+ # Configure rate and amplitude
44
+ dt.set_time_config(ConfigTime(
45
+ mode=ConfigTime.Mode.POISSON,
46
+ rate_format=ConfigTime.RateFormat.KHZ,
47
+ rate=10.0,
48
+ ))
49
+ dt.set_amplitude_config(ConfigAmplitude.fixed(lsb=8000))
50
+
51
+ # Run acquisition
52
+ dt.turn_on()
53
+ import time; time.sleep(5)
54
+ dt.turn_off()
55
+
56
+ spectrum = dt.get_spectrum_data()
57
+ print(spectrum) # SpectrumData(bins=16384, total=...)
58
+
59
+ dt.disconnect()
60
+ ```
61
+
62
+ ## Documentation
63
+
64
+ The documentation is shared by the Python, C++ and C# libraries and lives at
65
+ the root of the repository. To build it locally:
66
+
67
+ ```bash
68
+ # From the repository root (one level up from this folder)
69
+ pip install -r requirements-mkdocs.txt
70
+ mkdocs serve
71
+ ```
72
+
73
+ Then open <http://127.0.0.1:8000/> in your browser.
74
+
75
+ The documentation is organized as:
76
+
77
+ - **Home** – overview and installation
78
+ - **Connection & System** – connection helpers and system information
79
+ - **Configuration** – digital I/O, shape/amplitude, time, noise and settings configuration
80
+ - **Acquisition & Data** – statistics, acquisition control and readout
81
+ - **Spectrum & Catalog** – spectrum histograms, uploads and the reference catalog
82
+ - **Config Library** – saved configuration management
83
+
84
+ ## API overview
85
+
86
+ ### `Emulator` — main class
87
+
88
+ | Group | Methods |
89
+ |---|---|
90
+ | Connection | `connect`, `disconnect` |
91
+ | System | `get_system_info`, `get_eth0`, `get_usb0`, `set_eth_config_dynamic`, `set_eth_config_static`, `reboot`, `set_password` |
92
+ | Output | `turn_on`, `turn_off`, `toggle_output`, `get_output_status`, `get_quick_status` |
93
+ | Configuration | `get/set_digital_io_configuration`, `set_inverter`, `get/set_shape_config`, `get/set_amplitude_config`, `get/set_time_config`, `get/set_noise_config`, `get/set_pulse_height` |
94
+ | Statistics | `get_statistics`, `get_home_statistics`, `reset_statistics`, `get_display_info` |
95
+ | Spectrum | `get_spectrum_data`, `reset_spectrum`, `start/stop_spectrum`, `get_spectrum_status`, `upload_spectrum`, `get_last_spectra_list`, `get_last_spectrum_data`, `delete_last_spectrum`, `delete_all_last_spectra` |
96
+ | Oscilloscope | `get_oscilloscope_data` |
97
+ | Config library | `get_config_list`, `get_saved_configs`, `get_configuration_by_id`, `get_loaded_config`, `save_config`, `update_config`, `load_config_by_id`, `load_config_from_file`, `check_config_name`, `rename_config`, `delete_config`, `get_global_config` |
98
+ | Catalog | `get_elements`, `get_catalog_spectrum` |
99
+
100
+ ### Configuration classes
101
+
102
+ | Class | Parameters |
103
+ |---|---|
104
+ | `ConfigDigitalIO` | `digital_in`, `digital_out`, `pulse_delay`, `pulse_width`, `inverter`, `offset`, `gain` |
105
+ | `ConfigShape` | `mode` (exponential / pulse), `tau`, `rc_risetime`, `rise_time`, `fall_time`, `flat` |
106
+ | `ConfigAmplitude` | `mode` (fixed / spectrum), `lsb`, `spectrum_name`, `spectrum_data` |
107
+ | `ConfigTime` | `mode` (constant / poisson), `rate_format` (hz / khz), `rate` |
108
+ | `ConfigNoise` | `white_noise_enabled/v/lsb` (the only noise the device actually applies) |
109
+
110
+ ## Versioning
111
+
112
+ This library follows [Semantic Versioning](https://semver.org/):
113
+
114
+ - **MAJOR** – incompatible API changes
115
+ - **MINOR** – new functionality in a backwards-compatible manner
116
+ - **PATCH** – backwards-compatible bug fixes
117
+
118
+ Tag releases in Git and publish the same version to PyPI and GitLab Pages when appropriate.
119
+
120
+ ## Contact / Support
121
+
122
+ Issues: <https://support.nuclearinstruments.eu>
123
+
124
+ ## License
125
+
126
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,108 @@
1
+ # Smart Emulator — DT4810 Python Library
2
+
3
+ The full user documentation is available [here](https://public-repo.pages.nuclearinstruments.eu/dt4810/smart-emulator-library/).
4
+
5
+ ## Features
6
+
7
+ - Simple connection handling (login/logout, session cookie, error reporting via `DT4810Error`)
8
+ - Pythonic configuration objects mirroring the device's REST API
9
+ - Enumerations for all categorical parameters (shape mode, amplitude mode, rate format, clock source, etc.)
10
+ - High-level acquisition control (turn on/off, reset, statistics, saved configurations)
11
+ - Readout of statistics, spectrum histograms, oscilloscope traces, and the reference spectrum catalog
12
+ - Equivalent client libraries are also available for [C++](../smart_emulator_cpp) and [C#](../smart_emulator_csharp)
13
+
14
+
15
+ ## Quick start
16
+
17
+ ```python
18
+ from smart_emulator import Emulator, ConfigTime, ConfigAmplitude
19
+
20
+ dt = Emulator()
21
+ dt.connect("http://192.168.50.20", "password")
22
+
23
+ print(dt.get_system_info())
24
+
25
+ # Configure rate and amplitude
26
+ dt.set_time_config(ConfigTime(
27
+ mode=ConfigTime.Mode.POISSON,
28
+ rate_format=ConfigTime.RateFormat.KHZ,
29
+ rate=10.0,
30
+ ))
31
+ dt.set_amplitude_config(ConfigAmplitude.fixed(lsb=8000))
32
+
33
+ # Run acquisition
34
+ dt.turn_on()
35
+ import time; time.sleep(5)
36
+ dt.turn_off()
37
+
38
+ spectrum = dt.get_spectrum_data()
39
+ print(spectrum) # SpectrumData(bins=16384, total=...)
40
+
41
+ dt.disconnect()
42
+ ```
43
+
44
+ ## Documentation
45
+
46
+ The documentation is shared by the Python, C++ and C# libraries and lives at
47
+ the root of the repository. To build it locally:
48
+
49
+ ```bash
50
+ # From the repository root (one level up from this folder)
51
+ pip install -r requirements-mkdocs.txt
52
+ mkdocs serve
53
+ ```
54
+
55
+ Then open <http://127.0.0.1:8000/> in your browser.
56
+
57
+ The documentation is organized as:
58
+
59
+ - **Home** – overview and installation
60
+ - **Connection & System** – connection helpers and system information
61
+ - **Configuration** – digital I/O, shape/amplitude, time, noise and settings configuration
62
+ - **Acquisition & Data** – statistics, acquisition control and readout
63
+ - **Spectrum & Catalog** – spectrum histograms, uploads and the reference catalog
64
+ - **Config Library** – saved configuration management
65
+
66
+ ## API overview
67
+
68
+ ### `Emulator` — main class
69
+
70
+ | Group | Methods |
71
+ |---|---|
72
+ | Connection | `connect`, `disconnect` |
73
+ | System | `get_system_info`, `get_eth0`, `get_usb0`, `set_eth_config_dynamic`, `set_eth_config_static`, `reboot`, `set_password` |
74
+ | Output | `turn_on`, `turn_off`, `toggle_output`, `get_output_status`, `get_quick_status` |
75
+ | Configuration | `get/set_digital_io_configuration`, `set_inverter`, `get/set_shape_config`, `get/set_amplitude_config`, `get/set_time_config`, `get/set_noise_config`, `get/set_pulse_height` |
76
+ | Statistics | `get_statistics`, `get_home_statistics`, `reset_statistics`, `get_display_info` |
77
+ | Spectrum | `get_spectrum_data`, `reset_spectrum`, `start/stop_spectrum`, `get_spectrum_status`, `upload_spectrum`, `get_last_spectra_list`, `get_last_spectrum_data`, `delete_last_spectrum`, `delete_all_last_spectra` |
78
+ | Oscilloscope | `get_oscilloscope_data` |
79
+ | Config library | `get_config_list`, `get_saved_configs`, `get_configuration_by_id`, `get_loaded_config`, `save_config`, `update_config`, `load_config_by_id`, `load_config_from_file`, `check_config_name`, `rename_config`, `delete_config`, `get_global_config` |
80
+ | Catalog | `get_elements`, `get_catalog_spectrum` |
81
+
82
+ ### Configuration classes
83
+
84
+ | Class | Parameters |
85
+ |---|---|
86
+ | `ConfigDigitalIO` | `digital_in`, `digital_out`, `pulse_delay`, `pulse_width`, `inverter`, `offset`, `gain` |
87
+ | `ConfigShape` | `mode` (exponential / pulse), `tau`, `rc_risetime`, `rise_time`, `fall_time`, `flat` |
88
+ | `ConfigAmplitude` | `mode` (fixed / spectrum), `lsb`, `spectrum_name`, `spectrum_data` |
89
+ | `ConfigTime` | `mode` (constant / poisson), `rate_format` (hz / khz), `rate` |
90
+ | `ConfigNoise` | `white_noise_enabled/v/lsb` (the only noise the device actually applies) |
91
+
92
+ ## Versioning
93
+
94
+ This library follows [Semantic Versioning](https://semver.org/):
95
+
96
+ - **MAJOR** – incompatible API changes
97
+ - **MINOR** – new functionality in a backwards-compatible manner
98
+ - **PATCH** – backwards-compatible bug fixes
99
+
100
+ Tag releases in Git and publish the same version to PyPI and GitLab Pages when appropriate.
101
+
102
+ ## Contact / Support
103
+
104
+ Issues: <https://support.nuclearinstruments.eu>
105
+
106
+ ## License
107
+
108
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "smart-emulator"
7
+ version = "1.0.1"
8
+ authors = [
9
+ { name = "Nuclear Instruments", email = "info@nuclearinstruments.eu" },
10
+ ]
11
+ description = "Smart Emulator for DT4810 Python Library"
12
+ readme = "README.md"
13
+ license = { text = "MIT" }
14
+ requires-python = ">=3.8"
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ]
20
+ keywords = ["Nuclear Instruments", "Emulator", "DT4810", "firmware", "fpga", "CAEN"]
21
+ dependencies = [
22
+ "requests"
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://gitlab.nuclearinstruments.eu/public-repo/dt4810/smart-emulator-library"
27
+ Documentation = "https://public-repo.pages.nuclearinstruments.eu/dt4810/smart-emulator-library/"
28
+ "Bug Tracker" = "https://support.nuclearinstruments.eu"
@@ -0,0 +1,5 @@
1
+ black==25.1.0
2
+ flake8==7.1.1
3
+ flake8-bugbear
4
+ pre-commit==4.0.1
5
+ requests==2.32.3
@@ -0,0 +1,37 @@
1
+ from typing import NamedTuple
2
+
3
+ from .smart_emulator import ( # noqa: F401
4
+ DT4810Error,
5
+ ConfigDigitalIO,
6
+ ConfigShape,
7
+ ConfigAmplitude,
8
+ ConfigTime,
9
+ ConfigNoise,
10
+ SystemInfo,
11
+ SpectrumData,
12
+ OscilloscopeData,
13
+ Emulator,
14
+ compose_from_catalog,
15
+ compose_from_peaks,
16
+ )
17
+
18
+ __all__ = [
19
+ "DT4810Error",
20
+ "ConfigDigitalIO",
21
+ "ConfigShape",
22
+ "ConfigAmplitude",
23
+ "ConfigTime",
24
+ "ConfigNoise",
25
+ "SystemInfo",
26
+ "SpectrumData",
27
+ "OscilloscopeData",
28
+ "Emulator",
29
+ "compose_from_catalog",
30
+ "compose_from_peaks",
31
+ ]
32
+
33
+
34
+ __copyright__ = "2026-Present, Nuclear Instruments srl"
35
+ __version__ = "1.0.1"
36
+ __package_name__ = "smart-emulator"
37
+ VERSION = __version__