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.14-cp314-cp314-win_amd64.whl (561.3 kB view details)

Uploaded CPython 3.14Windows x86-64

daisylab-0.3.14-cp314-cp314-macosx_11_0_x86_64.whl (731.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ x86-64

daisylab-0.3.14-cp314-cp314-macosx_11_0_arm64.whl (705.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

daisylab-0.3.14-cp313-cp313-win_amd64.whl (547.7 kB view details)

Uploaded CPython 3.13Windows x86-64

daisylab-0.3.14-cp313-cp313-macosx_11_0_x86_64.whl (732.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

daisylab-0.3.14-cp313-cp313-macosx_11_0_arm64.whl (707.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

daisylab-0.3.14-cp312-cp312-win_amd64.whl (553.3 kB view details)

Uploaded CPython 3.12Windows x86-64

daisylab-0.3.14-cp312-cp312-macosx_11_0_x86_64.whl (736.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

daisylab-0.3.14-cp312-cp312-macosx_11_0_arm64.whl (710.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

daisylab-0.3.14-cp311-cp311-win_amd64.whl (553.0 kB view details)

Uploaded CPython 3.11Windows x86-64

daisylab-0.3.14-cp311-cp311-macosx_11_0_x86_64.whl (656.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

daisylab-0.3.14-cp311-cp311-macosx_11_0_arm64.whl (634.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

daisylab-0.3.14-cp310-cp310-win_amd64.whl (551.3 kB view details)

Uploaded CPython 3.10Windows x86-64

daisylab-0.3.14-cp310-cp310-macosx_11_0_x86_64.whl (667.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

daisylab-0.3.14-cp310-cp310-macosx_11_0_arm64.whl (639.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

daisylab-0.3.14-cp39-cp39-win_amd64.whl (554.3 kB view details)

Uploaded CPython 3.9Windows x86-64

daisylab-0.3.14-cp39-cp39-macosx_11_0_x86_64.whl (671.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

daisylab-0.3.14-cp39-cp39-macosx_11_0_arm64.whl (643.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for daisylab-0.3.14-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9c97a349b5a4b410cc24aa8d49cb6750645e1efeb548c39f24a726e55c2a86bf
MD5 4fd0fcb6f4d8815fcf588951b9748c1d
BLAKE2b-256 7d72b9ce28d5f5847481c74e15a9d394e4fca48252ec92bc5e91893247208f12

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp314-cp314-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 19cb451350d6350058e3c0dc122383bb19abd0b8720e00b7b1e355166770b8b4
MD5 7959deb643940df2ba513bf9dbfc08b4
BLAKE2b-256 050b4bca7ad2646a9b7f39bc2c89a996ca5790002e3a68969fadcb22c8b9fb87

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0b6fa028ef664759c69baf5af77a78f2121f78e48d29271db71d7b1f47d50b5
MD5 4555a8d9638836a0b3f2136dbf9c250d
BLAKE2b-256 36bb7e7db3d3b1233f8cad5ccf22d1251ddd63794fa25d6683b0d64b15fddab9

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp313-cp313-win_amd64.whl.

File metadata

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

File hashes

Hashes for daisylab-0.3.14-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8695cf73aa3335dcd2a93fea7a02665dc7c6eb0bab5f71faffd28f6b109a065f
MD5 2791e0d74f5f5d8b8cf24a2e74405bc8
BLAKE2b-256 b4a1016c9dd92dc6587fea52f7d490a88add677348a629a5549b5266632916fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e1d500bdbad821e30ae38045bb6e72f7d5736ad1afea8b02d1c117e106adcd08
MD5 f858744598fbfcf97e7412af9af75d00
BLAKE2b-256 5f1e5dfde379fa53c8bef57a063b5bdd3ecffd02f43ddd738077b1b9a0215424

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad0add965f3b1f33e21d6c005c4f9a701334d8a3630ffe615f28a5fb25fd87f9
MD5 35541777ddca2430477e3d77c70b0377
BLAKE2b-256 d40e958eba44cf5dcea3495897dc916df9adeec0587eb54047a003ed88a95277

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp312-cp312-win_amd64.whl.

File metadata

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

File hashes

Hashes for daisylab-0.3.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5f0a47b9a653de7579bdbf49ca9b0f834965a8f42cf2cd58e888f1e654640a38
MD5 5b1bbbeb204fa53613273d313b83f563
BLAKE2b-256 de452991fe24fca2dbf3221787c475d965b92729d81c05d0bd96022f03a19d2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 48469193df1e2d983b51e88f611d00a0e3462f02f616c3c96e0820aae5cc2e47
MD5 82dacf9428cd8896afb0cce9c3351149
BLAKE2b-256 0a19aed352796a58c747da1bc25202853d43c5271d262178572d0845246fa840

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7166dcb9d416c33efa362eaac27b27047fb693f6f14ae03111a9cc411c20d435
MD5 17a9e8bed8ad1a1851de818432250ff5
BLAKE2b-256 fa0c1cf47dad88855a76823c7d0e7b09281794925dbffaa72c1f0a57fa4a2cbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp311-cp311-win_amd64.whl.

File metadata

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

File hashes

Hashes for daisylab-0.3.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 01e4afb41f046249f98f1b05f7ff537b993482518f235fc0d506cdb0b0031f8f
MD5 b69456a00f6678e84970e8f90b325d5a
BLAKE2b-256 5bead092cb3a133074577e5761aa6d91f0e3d38029688ea9681c397f7f3d4552

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c1a275c9210ecc96adede178a2d767fdf392fb044e650af1cf555f957fd70171
MD5 3e106a91dfb5c53789d66b5f475ce712
BLAKE2b-256 684c9d198686a43d8fd188d0e0e7be439b381ade01ea49f83154ae1972c3e64e

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c2f044ff88e7281393b26df3d18909f2006093d499e924daa1ad93e41942e010
MD5 d8272b59f6fb45eea26e73da6679ef16
BLAKE2b-256 ee413bedd8a645066b7080b15280c6de9d181e4ca5236dd4edf5f24ddd398b44

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp310-cp310-win_amd64.whl.

File metadata

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

File hashes

Hashes for daisylab-0.3.14-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e4f9aecbf734b82501724dff19aae5ef412a9e17ccb45a80266eae9dcba6d5c7
MD5 579bb2a46a81cb90399c4a23daf467b0
BLAKE2b-256 29d7abd0ba5cc2e5a7f8c5609262ff3351bf88c2d8a97b1a99c9067e3ca944c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a19fd01ee098a59c3ede5a7f50cf4663c395805b2a9d2838f01ec496dccbcfce
MD5 8806cab68a04d0a643905855907d1d7e
BLAKE2b-256 6fe05d30555cad0b50e5ccb6695665b4fdd04a7c15b1e9e991da14bc4bb41033

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dcfecd04bc37182295c854d81be37613e25fbfad63be35ca189085687bd09e26
MD5 55eeb224e03c6aef79b68d90b5275c3e
BLAKE2b-256 f2d88577c00ee64c6f00e156b9c78c0997651c0c57b19d903bfd530384d5c563

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp39-cp39-win_amd64.whl.

File metadata

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

File hashes

Hashes for daisylab-0.3.14-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bd447c81e1dd0be5aca3b5bebbf5cf8a6e33afe029b0f8ebed12361b47c7ca46
MD5 52baeb02caf99755f0253607895ac0b5
BLAKE2b-256 08a0d7452655f115fdb91dd406a720bcab3bd9fb5ced714c0ff7cd039bd75c0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4ef75478ad54e177ca5ff1fb9e5ce563f941b41e957080fa4a37d73685bcfd18
MD5 17d5cae4092c504ea9639b934007c03f
BLAKE2b-256 1a0fc55ad95e52214754a43f7abd4570439aa434f924fb569d770e5dbc586c07

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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.14-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daisylab-0.3.14-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c8b1974c653ca04964320cffd6a9cba300e7030f9ced1ca3a34e22d2b9439e8
MD5 7afaf2158640846529a3f4893eccef4a
BLAKE2b-256 1da0073acf97839b018420759d9756353ca5b1144b7950d4f17077f06a29eb14

See more details on using hashes here.

Provenance

The following attestation bundles were made for daisylab-0.3.14-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