Laboratory hardware support Pieces for the puzzlepiece GUI & automation framework
Project description
Laboratory hardware support Pieces for the puzzlepiece GUI & automation framework.
Puzzlepiece is a GUI-forward Python framework for automating experimental setups and rapid user interface creation. You can find its documentation and tutorial at https://puzzlepiece.readthedocs.io. This library provides “Pieces” (GUI components) for commonly used laboratory hardware, so that you can easily assemble your automation application (a “Puzzle”) out of them.
Documentation: https://pzp-hardware.readthedocs.io
Repository: https://github.com/jdranczewski/pzp-hardware
Installation
You can install this package from pip:
pip install pzp-hardware
If you would like to develop your own Pieces and contribute changes to this library, you may choose to clone the repository instead, and install a local, editable copy:
git clone https://github.com/jdranczewski/pzp-hardware.git cd pzp-hardware pip install -e .
Once installed, you can use the Pieces provided like you would any other Piece in puzzlepiece:
import puzzlepiece as pzp
from puzzlepiece.extras import hardware_tools as pht
from pzp_hardware.thorlabs import camera, apt_stage
# Create a Qt app, the backend that will run our GUI
app = pzp.QApp()
# Create a Puzzle, the main window of the application.
# We prompt the user whether they want to launch in debug mode, which doesn't talk to hardware.
# We use the Puzzle as a context manager, so that if any of the Pieces raise exceptions while
# being added, the Puzzle can clean up other APIs and exit cleanly.
with pzp.Puzzle(name="Test", debug=pht.debug_prompt()) as puzzle:
puzzle.add_piece("camera", camera.Piece, row=0, column=0)
puzzle.add_piece("stage", apt_stage.Piece, row=0, column=1)
# Display the Puzzle and execute the Qt app
puzzle.show()
app.exec()
Check out Getting started for more details!
Structure
The library consists of a number of manufacturer folders, each containing Python files that each interface with a specific hardware/software provided by that manufacturer. The library contains all files on installation, but they need to be specifically imported, so that you never have to import the full library, just the parts you require:
from pzp_hardware.thorlabs import camera, apt_stage from pzp_hardware.vialux import dmd
See Modules for all currently supported hardware.
Development and contributing
Puzzlepiece provides a unified API for all of your devices, so the best laboratory automation experience is if you have Pieces for all of your hardware. If your hardware is not supported by pzp-hardware, you can create a Piece yourself – puzzlepiece aims to make that as easy as possible! You can create a fork of the main repository, install it locally as shown above to allow development, and we welcome pull requests adding support for new hardware.
Your Piece should broadly follow the same conventions as the ones currently in the repository. For example, image-based Pieces like cameras, DMDs, or SLMs should have an image param, allowing you to use the standard preview layouts provided in pzp_hardware.generic.mixins.image_preview. Your Piece should work reliably in debug mode to allow testing. You can use puzzlepiece.extras.hardware_tools to make integration with manufacturer APIs and DLLs easier, and in particular you should indicate requirements specific to your Piece with puzzlepiece.extras.hardware_tools.requirements (these are automatically parsed to appear in this documentation).
Documentation is key to your users being able to find, install, and use the Piece. Pull requests that don’t include at least basic documentation for the new Piece will not be merged. Documentation should be included in your Piece’s Python file, mostly as a docstring at the top, with docstrings in the Pieces that you want exposed in the docs. It’s also recommended to include a screenshot of your Piece, but an explicit list of params is not required, as the user can inspect this in debug mode. Check out the Piece file template on GitHub .
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 pzp_hardware-0.2.0.tar.gz.
File metadata
- Download URL: pzp_hardware-0.2.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e7fba1f1073dbfe030f30d4cfcd5cb60d5e2432c376e97ffa06aadaf14427a5
|
|
| MD5 |
719063944156c778b44e9ae23baa9108
|
|
| BLAKE2b-256 |
08cbabb0511075eb5c3e9e3456d2ee3dfaac3e88eb1fa99ca006fafe91609d95
|
Provenance
The following attestation bundles were made for pzp_hardware-0.2.0.tar.gz:
Publisher:
python-publish.yml on jdranczewski/pzp-hardware
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pzp_hardware-0.2.0.tar.gz -
Subject digest:
5e7fba1f1073dbfe030f30d4cfcd5cb60d5e2432c376e97ffa06aadaf14427a5 - Sigstore transparency entry: 659443291
- Sigstore integration time:
-
Permalink:
jdranczewski/pzp-hardware@2e629c5def472f9ae72be1693d53ee7d1387a90f -
Branch / Tag:
refs/tags/v0.2.0real - Owner: https://github.com/jdranczewski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2e629c5def472f9ae72be1693d53ee7d1387a90f -
Trigger Event:
release
-
Statement type:
File details
Details for the file pzp_hardware-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pzp_hardware-0.2.0-py3-none-any.whl
- Upload date:
- Size: 51.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dd1a6238e0a182ecd0acd6839f51fda8933fc18b49628d3cb7043a2aa23a068
|
|
| MD5 |
4ffd80bb433c24a828977f282809f321
|
|
| BLAKE2b-256 |
4a826aeee831c9360bf76e03c4a3bb60bce043022691552107f287eaa31e32ae
|
Provenance
The following attestation bundles were made for pzp_hardware-0.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on jdranczewski/pzp-hardware
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pzp_hardware-0.2.0-py3-none-any.whl -
Subject digest:
1dd1a6238e0a182ecd0acd6839f51fda8933fc18b49628d3cb7043a2aa23a068 - Sigstore transparency entry: 659443303
- Sigstore integration time:
-
Permalink:
jdranczewski/pzp-hardware@2e629c5def472f9ae72be1693d53ee7d1387a90f -
Branch / Tag:
refs/tags/v0.2.0real - Owner: https://github.com/jdranczewski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2e629c5def472f9ae72be1693d53ee7d1387a90f -
Trigger Event:
release
-
Statement type: