Skip to main content

Python library for Daisy laboratory instruments over USB serial

Project description

daisylab

Python library for controlling Daisy laboratory instruments over USB serial.

daisylab discovers Daisy hardware on your serial ports, validates the connected instruments against what your code expects, and gives you a clean, per-instrument API for pumps, valves, and motion stages — with background threads handling the serial protocol for you.

Installation

pip install daisylab

Requires Python 3.9+ and pyserial 3.5+.

Quick start

import daisylab

with daisylab.connect() as lab:
    print("Found ports:", lab.ports)
    print("Instrument types:", lab.instruments_list)

    # Declare the instruments on a port, in physical order, by type code.
    group = daisylab.InstrumentGroup([10, 2])   # Peri T + Multi-Valve
    lab.add_group(group)

    pump  = group.inst[0]   # DaisyPeriT
    valve = group.inst[1]   # DaisyMultiValve

    valve.home()
    pump.run(speed=50.0, volume=10.0, wait=True)   # 50 ml/min, 10 ml
    valve.select_port(3, wait=True)

connect() returns a DaisyInterface (usable as a context manager). Each InstrumentGroup is bound to a serial port in the order you call add_group().

Supported instruments

Instruments are declared by integer type code (the value the firmware reports during roll-call) or by a case-insensitive name substring such as "Peri T" or "gantry".

Code Class Hardware
1 DaisyPeriS Peri pump S
2 DaisyMultiValve 12-port rotary valve
3 DaisySolVal Solenoid valve array (≤8)
4 DaisyPistonPump Piston pump (1 ml)
5 DaisyPeriPumpXL Peri pump XL
6 DaisyMultiValveXL Rotary valve XL
7 DaisySolValXL Solenoid valve array XL
8 DaisyGantry XY Cartesian stage
9 DaisyZStage Z linear stage
10 DaisyPeriT Peri pump T
11 DaisyPeriP Peri pump P
12 DaisyPistonPump Piston pump (5 ml)
13 DaisyProcess Multi-channel pH/sensor

Peristaltic pump speed limits

Peri pumps enforce a per-model maximum motor speed. run(speed, volume) converts the requested flow (ml/min) to RPM using the current calibration and raises ValueError before sending anything if it would exceed the cap:

Model Max RPM
Peri S / Peri P 150
Peri T / Peri Pump XL 300

The cap is calibration-aware: recalibrating the tubing shifts the ml/min ceiling but the motor is always held to its rated RPM.

Examples

Standalone, runnable scripts live in daisylab/examples/:

  • daisy_controller.py — universal interactive controller for any instrument
  • z_stage_controller.py — interactive Z-stage controller
  • z_stage_peri_t_sequence.py — automated dispense sequence (home → lower → pump → raise)

Each supports a --demo flag that runs against simulated hardware (no serial I/O required):

python daisylab/examples/daisy_controller.py --demo

A sample Jupyter notebook is also included in the package at daisylab/jupyter/sample.ipynb. After installing, you can find it at <site-packages>/daisylab/jupyter/sample.ipynb.

Exceptions

Every error the library raises derives from DaisyError, so a single except daisylab.DaisyError is a complete catch-all for any instrument:

  • DaisyTimeoutError — no OK / a BAD reply within the timeout
  • DaisyConnectionError — no devices found / connection failure
  • DaisyInstrumentMismatchError — software list ≠ hardware roll-call
  • DaisyValueError — invalid argument or value (e.g. speed above a pump's MAX_RPM, unknown type code, malformed device response). Also subclasses the built-in ValueError, so existing except ValueError handlers keep working.

Stopping safely

stop_all() halts every instrument across all groups (best-effort — one instrument's failure won't block the others); ports stay open so you can recover. safe_session() wraps a command sequence and stops everything if any exception propagates:

with lab.safe_session():
    pump.run(speed=50, volume=10, wait=True)
    gantry.run(100, 150, wait=True)   # if this raises, the pump is stopped
# the original exception is re-raised after the stop

lab.stop_all()          # or halt everything manually (alias: lab.emergency_stop())
group.stop_all()        # or just one group

Development

git clone https://github.com/ScalablesLab/daisy-python-library
cd daisy-python-library
pip install -e ".[test]"
pytest

The test suite is hardware-free — tests/fakes.py provides a synchronous FakeSerialManager that synthesises device replies, so the real drivers run end to end without any instruments attached.

License

Apache License 2.0 — see LICENSE. Copyright Scalables, LLC.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

daisylab-0.3.12-cp314-cp314-win_amd64.whl (556.3 kB view details)

Uploaded CPython 3.14Windows x86-64

daisylab-0.3.12-cp314-cp314-macosx_11_0_x86_64.whl (725.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ x86-64

daisylab-0.3.12-cp314-cp314-macosx_11_0_arm64.whl (699.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

daisylab-0.3.12-cp313-cp313-win_amd64.whl (542.4 kB view details)

Uploaded CPython 3.13Windows x86-64

daisylab-0.3.12-cp313-cp313-macosx_11_0_x86_64.whl (726.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

daisylab-0.3.12-cp313-cp313-macosx_11_0_arm64.whl (701.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

daisylab-0.3.12-cp312-cp312-win_amd64.whl (547.9 kB view details)

Uploaded CPython 3.12Windows x86-64

daisylab-0.3.12-cp312-cp312-macosx_11_0_x86_64.whl (730.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

daisylab-0.3.12-cp312-cp312-macosx_11_0_arm64.whl (704.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

daisylab-0.3.12-cp311-cp311-win_amd64.whl (547.9 kB view details)

Uploaded CPython 3.11Windows x86-64

daisylab-0.3.12-cp311-cp311-macosx_11_0_x86_64.whl (650.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

daisylab-0.3.12-cp311-cp311-macosx_11_0_arm64.whl (629.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

daisylab-0.3.12-cp310-cp310-win_amd64.whl (546.0 kB view details)

Uploaded CPython 3.10Windows x86-64

daisylab-0.3.12-cp310-cp310-macosx_11_0_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

daisylab-0.3.12-cp310-cp310-macosx_11_0_arm64.whl (634.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

daisylab-0.3.12-cp39-cp39-win_amd64.whl (549.0 kB view details)

Uploaded CPython 3.9Windows x86-64

daisylab-0.3.12-cp39-cp39-macosx_11_0_x86_64.whl (664.9 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

daisylab-0.3.12-cp39-cp39-macosx_11_0_arm64.whl (637.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file daisylab-0.3.12-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: daisylab-0.3.12-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 556.3 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for daisylab-0.3.12-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a1724b1109ce611c61f46924d7b5ae216579854bd39d0c4430bf80cb277617c9
MD5 db7dbc0089108d7cf9d9a2cfe0587d7a
BLAKE2b-256 b1eb6e7b53ecf5268d485a9064a2ec916340068e4d12a52d5e548439a2ac55b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp314-cp314-win_amd64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp314-cp314-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 ec60acf5b5371e8fd4d4a3bad6fb96008c90e5b579e33a962da3b77035151394
MD5 21d28a01d78e37d547473febb1d98272
BLAKE2b-256 f170aa776c6353f8eec07050c9e24f8305c5f6c06d5da099eb38b353506e42bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp314-cp314-macosx_11_0_x86_64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff0e7bf01bf63da08dd41a0f858447ed7102cb884f35615b3065cb69b7708766
MD5 e5d7e75f3fdb4e1d3e7b9c96c7acae6f
BLAKE2b-256 b0bf1879f10b6b9f2e9ef1dc281ad658fa3fca1bb604cb27b26e2ae60b5069dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: daisylab-0.3.12-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 542.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for daisylab-0.3.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b8599d48af3add8d4ed6e6b55a78e39a3301b180b06806f030495bcd0141809e
MD5 372c75ec7da88c28cecc49e950ce059b
BLAKE2b-256 c496172050250c795d4a1b7fa39272a904d31485307fec33cbb0a3bdd038fce1

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9ee409fe405ddd201fb29d4e8ec5b9e96fa464e9e873aafb6122c14a48484164
MD5 3459408c64b6bcf189fa039d1b23c9da
BLAKE2b-256 99727b64ab2f4b9ac92bca65e9fd7bb60b60f4cc82c0962d5c5d07d844a7b018

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp313-cp313-macosx_11_0_x86_64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efe52f48e5666928f1bdebedf661ba9fe617ed5fc28fd4b0a1d7e7000b4651e6
MD5 66b27cc8211d90256d0f4aeee23842b9
BLAKE2b-256 cb85f57bdc4a1ad32c0ad9a5b0ce9454952a3a0a42b7c615069fe857227f2fb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: daisylab-0.3.12-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 547.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for daisylab-0.3.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b6a1d77c1cc8716ab689348114677c375b3a084828c9754d4dcf2042b364ac3a
MD5 d2b7e49b20528f6f2b09fb5829173f43
BLAKE2b-256 1f5f4d56bf6b4ee433dfce0131558789ff162976edb2b2f889d1f4c2e7e3c3b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e371a1f227a2e13a8820fcb7cfee393344407c0ba4422874eee5f22b1d01cde9
MD5 c7ac9772e410b420ce9330a07ec7a459
BLAKE2b-256 ea1fe820c2607475bfa2879d5276c9acc210927a21825b7ed413b0cf8c8d871e

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp312-cp312-macosx_11_0_x86_64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 068ab30b9279f15a6a3c16e1a0b9951aba4b579d66cb3617abc617963791c846
MD5 4bdfa514c4e57890bbbf89dbbf9c2c01
BLAKE2b-256 8de3d5f8e448048314a1515be0054d007e389e0f4f81b4e8e41ae119ada791d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: daisylab-0.3.12-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 547.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for daisylab-0.3.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a29dacc77202d75f645844cddc55e4c280182c2c1eadfcbf217cab27569dbb0a
MD5 696a2b840a10cd38750b0d661bba3369
BLAKE2b-256 0fe38ae62a4e3b1c77190b80ada0c227a845863226f001cc4aef750a913462bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 aec7923d9bcb4e8848cbb1916278cf5f87bba237b68d9672916099a90799bb85
MD5 cd9f82d97c76b5e50b462e9956001f42
BLAKE2b-256 6961cb57477551395827e6737788cd386a49e0fac64f1accbb0371a7509b9b1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp311-cp311-macosx_11_0_x86_64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ad4a7abc0174d8e19f0665bc7fdc43ba9ff00e7d9d9fa06905ceb183b61d201
MD5 a98a2f8f0b68fee57b1afbc7249297f3
BLAKE2b-256 2471be98375a4b2b6b3f1ea2a96f275ad295d40f84a379fe9dc9ee331bbb9ef5

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: daisylab-0.3.12-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 546.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for daisylab-0.3.12-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c2bdd004792f00f8c5169a2b15a559efaf127b6915777b7be71e20382acc33be
MD5 a86031d9dec88ac998ca91efe174b0a4
BLAKE2b-256 6ddd287bcff4562f70df7736e18a9666f44d05f756d30a5cf69f38d68b108bda

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c90494f9157c76354e32ca966afa4d4d267621d584ba0202b087719a09bbbbda
MD5 abed0603ec2776ca53cdcf73d5f984f3
BLAKE2b-256 a0ecf3bfcca3a5a6ca83d35d5419e96cbbec5e2449c359bfc39831795587a265

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp310-cp310-macosx_11_0_x86_64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a6dac7b7d640b4652dee77980c55c9e21bb535196e801a8a74edaf6e24c60da
MD5 c78a9939e6bbd910a2043cfe856fe3a7
BLAKE2b-256 01e260552580ca70de6a89257d3ac22d7941f213f9b82a083c2ecafa19f56579

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: daisylab-0.3.12-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 549.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for daisylab-0.3.12-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e66d7bf7c1e8f101782d184cc1cb6e8721f79c09619ee632d411660663cbc900
MD5 3941941c5b1dddec1671ba9af0adf3d7
BLAKE2b-256 6656daeb9fb753a61ff24a0ffa3e4cb5eb59a3470770130c90fa2ba7210fc4a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp39-cp39-win_amd64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 2ccadb511882e39992eda47c7e3113d4420ea837c117e6daa5265d1afa5be817
MD5 1129b2ce2887f728c49cd34fc250cd1c
BLAKE2b-256 7686cdada8342e1770385f641e95bc439e507f5030ac70ea34354acc4e3a8d31

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp39-cp39-macosx_11_0_x86_64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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

File details

Details for the file daisylab-0.3.12-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.12-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b3c006fee46415e696e286c05bc8a2a181798eb84d7d74f1f0ff727559abfa6
MD5 59c6021f4253d0869bfa15756f300165
BLAKE2b-256 9d7e6805f576b5d50544a0739a0f404c5cd38419e542af04e4399344b3dbb3af

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.12-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: wheels.yml on ScalablesLab/daisy-library

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