A Python API for the pumps in the Matter Lab.
Project description
matterlab_pumps
matterlab_pumps is a Python package for controlling several syringe and peristaltic pump controllers used in the Matter Lab. It provides shared base classes plus device-specific drivers built on top of matterlab_serial_device.
Supported Devices
SyringePump: shared abstract base class for syringe-style pumpsTecanXCPumpTecanXLPPumpTecanCentrisPumpRunzePumpJKemPumpLongerPeristalticPumpContinuousDualSyringe
Installation
Install the package:
pip install matterlab_pumps
For development:
pip install -e .[dev]
The package depends on matterlab_serial_device, which is installed automatically.
Quick Start
Example with a Tecan XC syringe pump:
from matterlab_pumps import TecanXCPump
pump = TecanXCPump(
com_port="COM5",
address=0,
syringe_volume=1e-3,
num_valve_port=12,
ports={"source": 12, "reactor": 1},
)
pump.draw(0.25, "source", speed=0.5)
pump.dispense(0.25, "reactor")
Core concepts:
syringe_volumeis given in litersdraw(...)anddispense(...)use millilitersportexposes the active valve position- named ports can be supplied through the
portsmapping
Core API
The shared SyringePump base class provides the main high-level workflow methods:
draw(volume, valve_port=None, speed=None)dispense(volume, valve_port=None, speed=None)draw_and_dispense(volume, draw_valve_port, dispense_valve_port, speed=None, wait=0)draw_full(...)dispense_all(...)switch_port(...)
Concrete device classes implement:
portvolumetop_speed_mlset_default_speeds()
Testing
Simulation Tests
Simulation tests are the default validation layer and are safe for CI.
One-click run:
python examples/test_sim.py
Direct pytest run:
pytest tests/test_base_pump.py tests/test_jkem_sim.py tests/test_tecan_xlp_sim.py tests/test_tecan_centris_sim.py tests/test_tecan_xc_sim.py tests/test_runze_sim.py tests/test_longer_peri_sim.py tests/test_continuous_dual_syringe_sim.py
Hardware Tests
Hardware tests are opt-in because real devices may not be connected in every environment.
Available hardware test files:
tests/test_jkem_real.pytests/test_tecan_xlp_real.pytests/test_tecan_centris_real.pytests/test_tecan_xc_real.pytests/test_runze_real.pytests/test_longer_peri_real.pytests/test_continuous_dual_syringe_real.py
They are marked with @pytest.mark.real and are skipped unless --run-real is supplied.
Example:
pytest tests/test_tecan_xc_real.py --run-real --com-port COM5 --address 0 --syringe-volume 1e-3 --num-valve-port 12
You can also provide hardware configuration through environment variables:
PUMP_COM_PORTPUMP_ADDRESSPUMP_SYRINGE_VOLUMEPUMP_NUM_VALVE_PORT
Examples
The examples/ directory contains the recommended entry points:
examples/test_sim.py: one-click simulation-only test runnerexamples/real_devices.py: human-readable examples for all currently supported pump familiesexamples/README.md: short guide to the examples directory
Development
Useful commands:
pytest
ruff check .
ruff format .
The default pytest configuration includes a timeout and colorized output from pyproject.toml.
Package Layout
src/matterlab_pumps/
base_pump.py
jkem_pump.py
runze_pump.py
tecan_centris_pump.py
tecan_xc_pump.py
tecan_xlp_pump.py
longer_peri.py
continuous_dual_syringe.py
tests/
examples/
License
This project is distributed under the MIT License. See LICENSE for details.
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 matterlab_pumps-1.1.0.tar.gz.
File metadata
- Download URL: matterlab_pumps-1.1.0.tar.gz
- Upload date:
- Size: 35.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8519fa70ce6ae28437e77c55eebd290c784cfbd269d617ae3f49840821bdfa51
|
|
| MD5 |
f0a0ee70b7b35500c3ce0a3afc4f530c
|
|
| BLAKE2b-256 |
40f35452d0512e42e87da4150656b0b82fe478c04d601aede5f2cfc012043573
|
File details
Details for the file matterlab_pumps-1.1.0-py3-none-any.whl.
File metadata
- Download URL: matterlab_pumps-1.1.0-py3-none-any.whl
- Upload date:
- Size: 46.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb1b4c517daec280db38bb3d84f5203239fc90ca83371397b6217737a4f7db22
|
|
| MD5 |
fcdcc1398311de9b01d794455442f392
|
|
| BLAKE2b-256 |
84d45722265eb13fc018c975f4e2f74a696188911923f69528780e3d3781fc9c
|