Skip to main content

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 the tkinter backend.

  • r2x4_gui_qt: Start the GUI using a Qt backend. This is needs pyqt or pyside to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ind_ls_r2x4-0.4.4.tar.gz (3.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ind_ls_r2x4-0.4.4-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file ind_ls_r2x4-0.4.4.tar.gz.

File metadata

  • Download URL: ind_ls_r2x4-0.4.4.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ind_ls_r2x4-0.4.4.tar.gz
Algorithm Hash digest
SHA256 4f5dbc793d7276e3bd6c1c24498e457eb89c11099eac8e13a18e1bdffd26c426
MD5 eac412721454c8b06c62a085e029f38c
BLAKE2b-256 f447cb3b8df611b97533877a37740a9fb7c6dc2f79b1aeef0e1c495b7ee65a91

See more details on using hashes here.

File details

Details for the file ind_ls_r2x4-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: ind_ls_r2x4-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ind_ls_r2x4-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 440ca9f4b988ab4ca84bdb05c2f29261948f58ccf2f9f6321fe0c0fc409d1023
MD5 1fc292ce501c54488aedd3781b55ebd4
BLAKE2b-256 05a368ceb99ce4f37d1b376a223a4cbc66e32e8cc8fb175bb426c5f86ef27474

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page