Skip to main content

Qt-based framework for controlling scientific instruments over serial ports

Project description

QInstrument

License: GPL v3

A Qt-based framework for controlling scientific instruments over serial ports. Instruments are represented as Qt objects with a uniform property system, automatic UI binding, and JSON-based configuration persistence. Any Qt binding (PyQt5, PyQt6, PySide2, PySide6) is supported via qtpy.

Instruments

IPG Photonics

  • YLR Series: Ytterbium fibre laser

Laser Quantum

  • Opus: Continuous-wave laser

PiezoDrive

  • PDUS210: Piezo transducer driver

Prior Scientific

  • Proscan II/III: Motorised microscope stage controller

Stanford Research Systems

  • DS345: 30 MHz Synthesised Function Generator
  • SR830: 100 kHz Digital Lock-in Amplifier
  • SR844: 200 MHz RF Lock-in Amplifier

Tektronix

  • TDS1000: Digital oscilloscope

Installation

git clone https://github.com/davidgrier/QInstrument
cd QInstrument
python -m venv .qi
source .qi/bin/activate
pip install -r requirements.txt

Quick start

Each instrument widget has a built-in example() entry point. Run it directly from the command line:

python -m QInstrument.instruments.DS345.widget

This finds a connected DS345 and opens its control panel. If no instrument is detected it falls back automatically to a simulated (fake) device so the UI is always usable.

You can also drive the widget from your own application:

from qtpy.QtWidgets import QApplication
from QInstrument.instruments.DS345 import QDS345Widget

app = QApplication([])
widget = QDS345Widget()
widget.show()
app.exec()
DS345 Widget

Using a simulated instrument

When hardware is not available, import the fake class directly:

from QInstrument.instruments.DS345 import QDS345Widget, QFakeDS345

app = QApplication([])
widget = QDS345Widget(device=QFakeDS345())
widget.show()
app.exec()

Architecture

QtCore.QObject
└── QAbstractInstrument      # property/method registry, thread-safe get/set, settings I/O
    └── QSerialInstrument    # holds QSerialInterface; adds open/find/identify
        └── QXxxInstrument   # concrete instrument

QtSerialPort.QSerialPort
└── QSerialInterface         # raw serial I/O (owned by QSerialInstrument)

QWidget
└── QInstrumentWidget        # loads .ui file, auto-binds widgets to registered properties

Each instrument lives in instruments/<Name>/ with three files:

File Purpose
instrument.py Serial communication and property registration
fake.py Simulated instrument for UI development without hardware
widget.py Qt widget, .ui file binding, example() entry point

Development

Run the test suite:

source .qi/bin/activate
pytest tests/

Tests run automatically before every git push via a pre-push hook. To install the hook in a fresh clone:

cp hooks/pre-push .git/hooks/pre-push   # if tracked, else set up manually
chmod +x .git/hooks/pre-push

Acknowledgements

Work on this project at New York University is supported by the National Science Foundation of the United States under award number DMR-2438983.

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

qinstrument-0.4.0.tar.gz (63.8 kB view details)

Uploaded Source

Built Distribution

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

qinstrument-0.4.0-py3-none-any.whl (80.0 kB view details)

Uploaded Python 3

File details

Details for the file qinstrument-0.4.0.tar.gz.

File metadata

  • Download URL: qinstrument-0.4.0.tar.gz
  • Upload date:
  • Size: 63.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qinstrument-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7cf3c4feb987b15e977a289708f8015f81c28f3b213bffd6efb8a6681e00736e
MD5 4ce5ee38de8c2b76ae2eacc65497e68d
BLAKE2b-256 7efb68ac877875f7d1c04cc8e9c99a0d38a1dd7492daa48b82db887ffc025b57

See more details on using hashes here.

Provenance

The following attestation bundles were made for qinstrument-0.4.0.tar.gz:

Publisher: publish.yml on davidgrier/QInstrument

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qinstrument-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: qinstrument-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 80.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qinstrument-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db2a3cb0c3ca2d5e76b97af0769ab2643fd9eb00f3492949e1236e6d6d4975c4
MD5 73f9720d88176c97fbb8ad971339b96a
BLAKE2b-256 85362d58015cfeb6d20147753c699b359aee0485b44c98849db54d37b693c2b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for qinstrument-0.4.0-py3-none-any.whl:

Publisher: publish.yml on davidgrier/QInstrument

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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