N1081B Python SDK
Python client library to control the Nuclear Instruments N1081B programmable logic unit over a WebSocket interface.
It provides a typed API to:
-
configure and read back all available functions:
- Logic functions: Wire, AND, OR, OR-Veto, Veto, Majority, Coincidence Gate, LUT
- Counting and timing: Scaler, Counter, Counter/Timer, Chronometer, Rate Meter, Rate Meter Advanced
- Time measurement: Time Tag, Time of Flight, Time over Threshold
- Signal generation: Pulse Generator, Digital Generator, Pattern Generator
-
Acquisition control (start/stop/reset) and result readout for all function types that support it
-
Input/output configuration per section: signal standard and impedance
-
Input configuration per channel: input enable, gate, delay and signal inversion
-
Output configuration per channel: output enable, monostable and signal inversion
-
Logic analyser: configuration and status readout for all input and output channels
-
System settings: ethernet, clock and configuration file management
It is also possible to set and get the input and output sections and channels configuration parameters.
It implements the logic analyser configuration and data retrieval to acquire the logic status of all input and output channels.
Ethernet, clock and configuration file settings can also be managed through the SDK.
Features
- Simple WebSocket connection handling (connect/disconnect/login, password change)
- Enumerations for all categorical parameters (sections, function types, signal standards, impedance, etc.)
- High-level configuration helpers for each function type, for input/output sections and channels, for the logic analyzer and for the settings management
Installation
From PyPI
pip install n1081b-sdk
From source (this repository)
git clone https://gitlab.nuclearinstruments.eu/public-repo/n1081/n1081b_sdk_python.git
cd n1081b_sdk_python
# (optional) create a virtualenv
python -m venv .venv
source .venv/bin/activate # on Windows: .venv\Scripts\activate
pip install -e .
Quick start
Minimal example showing how to connect to a board, configure a section and start acquisition.
from n1081b_sdk import N1081B
# 1. Create device object and connect
device = N1081B("192.168.0.10")
device.connect()
# 2. Login with default password
if not device.login("password"):
raise RuntimeError("Login failed")
# 3. Configure input of section A in NIM standard
device.set_input_configuration(N1081B.Section.SEC_A,
N1081B.SignalStandard.STANDARD_NIM,
N1081B.SignalStandard.STANDARD_NIM,
0, N1081B.SignalImpedance.IMPEDANCE_50)
# 4. Configure section A as a scaler
device.set_section_function(N1081B.Section.SEC_A, N1081B.FunctionType.FN_SCALER)
# 5. Configure scaler enabling all four input channels and the input gate
device.configure_scaler(N1081B.Section.SEC_A, True, True, True, True, True)
# 6. Read results
data = device.get_function_results(N1081B.Section.SEC_A)
print(data)
# 7. Disconnect
device.disconnect()
See the examples/ directory for fully worked demos of each function type.
Documentation
The full user guide is generated with MkDocs and published as GitLab Pages.
To build the documentation locally:
pip install -r requirements-mkdocs.txt
mkdocs serve
Then open http://127.0.0.1:8000/ in your browser.
Versioning
Follow Semantic Versioning for library releases:
MAJOR– incompatible API changesMINOR– new functionality in a backwards compatible mannerPATCH– backwards compatible bug fixes
Tag releases in Git and publish the same version on PyPI and GitLab Pages.
Contact / Support
Metadata
Release files for n1081b-sdk 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| n1081b_sdk-1.0.4.tar.gz | 2.0 MB | Without provenance | Details for n1081b_sdk-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| n1081b_sdk-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for n1081b_sdk-1.0.4-py3-none-any.whl |
Total release size: 2.0 MB
Release files / n1081b_sdk-1.0.4.tar.gz
| Download URL | n1081b_sdk-1.0.4.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d081624257f1427128954e44fca5d55268437741463b2bb88ec811110278265
|
|
BLAKE2b-256 checksum How to use checksums |
5843f4d010aac51ec8212f0000826825de3e23cc5b4abbac32eff40d8520c7c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / n1081b_sdk-1.0.4-py3-none-any.whl
| Download URL | n1081b_sdk-1.0.4-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8b0ee3d04201f821c0329e8ada0961ec64bf0ff48ced7e1199d2c109ed18d82
|
|
BLAKE2b-256 checksum How to use checksums |
b7a5a0a649df1e361a45e77fe29133623895267ec4ac0b48a4e25900c7906227
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for n1081b-sdk 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.