Interface the R2X4 light source from Industrialise.
Project description
Driver package for the R2X4 programmable light source from Industrialise.
The R2X4 is a powerful and precise programmable constant-current LED light source. It has four independent LED channels and is temperature stabilized. It is powered using USB Power Delivery or by a DC adapter.
Installation
The package can be installed from PyPI using pip or uv:
pip install ind-ls-r2x4
uv add ind-ls-r2x4
There is an optional Qt-based GUI available, next to a tkinter-based one.
The Qt GUI uses QtPy to abstract the Qt backend. The package can be installed with:
pip install qtpy
uv add qtpy
The actual Qt backend needs to be installed separately. For example, to use the PySide6 backend:
pip install PySide6
uv add PySide6
PySide2, PyQt5 and PyQt6 are also supported. Checkout the QtPy documentation for information on which version of backend
is supported by which version of QtPy.
There is also a R2X4Panel available for use in Gamma Desk which uses the same widget as the Qt GUI. Check the
ls_r2x4.gui.gdesk_panel module for more information. To install Gamma Desk:
pip install gamma-desk PySide6
uv add gamma-desk PySide6
Usage
Demo
A text-based demo is started when the package is run as a module:
python -m ls_r2x4
uv run -m ls_r2x4
These top level scripts are available when the Python environment is active:
-
r2x4_gui_tkinter: Start the GUI using thetkinterbackend. -
r2x4_gui_qt: Start the GUI using a Qt backend. This is needspyqtorpysideto be installed! -
r2x4_demo: Start the same demo as when the package is run as a script.
More demo scripts are available in the ls_r2x4.demo.demo module.
JupyterLab users may refer to a demo Jupyter Notebook available in the ls_r2x4.demo folder.
GUI
To run the GUI, run:
r2x4_gui_qt
uvx --from ind-ls-r2x4 --with pyside6,qtpy r2x4_gui_qt
Programming API
The main class to use is the LightSourceR2X4 class.
from ls_r2x4 import LightSourceR2X4
ls = LightSourceR2X4()
ls.connect()
A serial port name can be passed to the constructor, if left None it will try to find the correct port automatically.
Once the instance is connected, the light source can be controlled using the methods and attributes of the class.
import time
ls.triggering_force_a_channels()
ls.blue_a.value = 5 # set the blue a channel to 5%
ls.red_b.value = 3 # set the red b channel to 3%
time.sleep(2)
ls.triggering_force_b_channels()
time.sleep(1)
ls.blue_a.value = 0 # turn back off
ls.red_b.value = 0
Checkout the demo scripts for more examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ind_ls_r2x4-0.4.3.tar.gz.
File metadata
- Download URL: ind_ls_r2x4-0.4.3.tar.gz
- Upload date:
- Size: 45.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97311efb07fb6b5ea59e2e93ee80ec00c94c527974d7bdc4a05c17d8eda8ced0
|
|
| MD5 |
35d61080ff843a5cb43dd96cf2228451
|
|
| BLAKE2b-256 |
01a3b0f52cefde6cd996fe90449db08853f5ea120463a4a4d0a6adab9eb3418f
|
File details
Details for the file ind_ls_r2x4-0.4.3-py3-none-any.whl.
File metadata
- Download URL: ind_ls_r2x4-0.4.3-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
affa82cc1f2b7325a7fe19d2a3a79e7d553b48b8a194e0af36290d0e1b4f343c
|
|
| MD5 |
0fb6ee41586e3117c4298767cffbaf80
|
|
| BLAKE2b-256 |
e8eeb4449fe9fd57e04648e380dc19af147f05d2f19c8ae1f854f8b557b09f7d
|