Skip to content

Add BioTek EL406 plate washer backend#878

Open
tfehlmann wants to merge 12 commits intoPyLabRobot:mainfrom
tfehlmann:feature/biotek-el406-plate-washer-squashed
Open

Add BioTek EL406 plate washer backend#878
tfehlmann wants to merge 12 commits intoPyLabRobot:mainfrom
tfehlmann:feature/biotek-el406-plate-washer-squashed

Conversation

@tfehlmann
Copy link
Contributor

@tfehlmann tfehlmann commented Feb 5, 2026

Summary

  • Adds a new pylabrobot.plate_washing module with PlateWasher resource and PlateWasherBackend base class
  • Implements BioTekEL406Backend for the BioTek EL406 plate washer, communicating via FTDI USB serial
  • Backend is composed from mixins: Communication, Queries, Actions, and Steps (manifold, peristaltic, syringe, shake)
  • 374 tests covering all operations, wire format encoding, parameter validation, and error handling

Supported operations

Subsystem Operations
Manifold wash, dispense, aspirate, prime, auto-clean
Peristaltic pump prime, dispense, purge (with column/row selection)
Syringe pump dispense, prime (with column selection)
Shake configurable intensity and duration
Queries manifold type, serial number, sensor status, syringe box info
Actions abort, pause, resume, reset, self-check

Architecture

  • Binary protocol with framed messages, ACK/NAK flow control, and async status polling
  • MockFTDI test double enables hardware-free testing
  • 160+ device error codes with descriptive messages
  • Follows existing pylabrobot patterns (mirrors PlateReader/PlateReaderBackend hierarchy)

Test plan

  • 374 unit tests passing (pytest pylabrobot/plate_washing/biotek/)
  • mypy clean (0 errors across all 29 source files)
  • ruff clean (no lint issues)
  • Hardware integration test on physical EL406 device

🤖 Generated with Claude Code

Add a new plate washing module with a backend for the BioTek EL406
plate washer, communicating via FTDI USB serial interface.

Architecture:
- PlateWasher resource and PlateWasherBackend base class
- BioTekEL406Backend composed from mixins: Communication, Queries,
  Actions, and Steps (manifold, peristaltic, syringe, shake)
- Binary protocol with framed messages, ACK/NAK flow control,
  and async status polling for long-running operations

Features:
- Manifold wash/dispense/aspirate/prime/auto-clean operations
- Peristaltic pump prime/dispense/purge with column/row selection
- Syringe pump dispense/prime with column selection
- Plate shaking with configurable intensity and duration
- Device queries (manifold type, serial number, sensor status)
- Action commands (abort, pause, resume, reset, self-check)
- 160+ device error codes with descriptive messages
- MockFTDI test double for hardware-free testing

374 tests covering all operations, wire format encoding, parameter
validation, communication protocol, and error handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tfehlmann tfehlmann force-pushed the feature/biotek-el406-plate-washer-squashed branch from f9b25f5 to 4b77208 Compare February 5, 2026 23:21
tfehlmann and others added 11 commits February 23, 2026 12:17
setup() now resets the instrument and starts batch mode automatically,
so users can issue step commands immediately. stop() runs
cleanup_after_protocol before disconnecting. Both can be skipped via
skip_reset and skip_cleanup flags, following codebase conventions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract EL406TestCase base class into mock_tests.py with shared
  setUp/tearDown, eliminating duplicated boilerplate across all test files
- Patch asyncio.sleep in tests so hardware delays don't slow mock tests
- Replace hardcoded timeouts (5.0, 2.0) in communication.py with
  self.timeout so the configured value is used consistently
- Timeout-specific tests set backend.timeout = 0.01 to test the path fast

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move asyncio.Lock() from __init__ to setup() so it's created inside a
running event loop (required on Python 3.9). Increase mock buffer sizes
and refill buffer before tearDown's stop() so cleanup commands don't
starve.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert all public-facing parameters to PLR standard units (µL for
volume, seconds for time) with internal conversion at the API boundary.
Add unit suffixes (_ms, _min, _ml) to internal builder params that use
wire-format units, so the unit mismatch is always explicit in code.

Also add ValueError for minute-resolution params not divisible by 60,
and clean up test boundary values and comments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace manual bytes([...]) construction, bit manipulation (value & 0xFF,
(value >> 8) & 0xFF), and helpers (encode_volume_16bit, encode_signed_byte)
with Writer's fluent API (w.u8().u16().i8().finish()) across all 9 command
builders and build_framed_message. Absorb _encode_wash_byte_values into
_build_wash_composite_command. Remove now-dead encode_volume_16bit and
encode_signed_byte helpers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace manual LE u16 parsing (data[i] | (data[i+1] << 8)) with
Reader.u16() in communication.py for header data-length, command echo,
and poll state fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Validation functions that were only used in one file now live there
instead of in helpers.py. Wire-format range checks (offset_xy, offset_z,
num_pre_dispenses) removed — the binary Writer will enforce those.
validate_volume inlined at call sites. validate_intensity moved to
_shake.py since intensity is a shake concept.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The build command methods already document wire format and byte layout.
Strip repeated protocol specs from test class/method docstrings and
inline comments across all test files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Inline single-use command codes with keyword arguments across all files
- Move LONG_READ_TIMEOUT to communication.py (used by communication, queries, actions)
- Inline DEFAULT_READ_TIMEOUT (15.0) in backend.py
- Inline ACK_BYTE/NAK_BYTE as 0x06/0x15 in communication.py
- Inline MSG_* protocol constants in protocol.py
- Inline VALID_* sets into their validation functions
- Inline syringe limit constants into validators
- Remove constants re-exports from __init__.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- syringe_to_byte → _syringe.py
- cassette_to_byte, encode_quadrant_mask_inverted → _peristaltic.py
- columns_to_column_mask, encode_column_mask → protocol.py
- TRAVEL_RATE_TO_BYTE, travel_rate_to_byte → _manifold.py
- INTENSITY_TO_BYTE → _shake.py (manifold imports from there)
- get_plate_type_wash_defaults → _manifold.py
- helpers.py now only has plate type defaults and lookup functions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants