From c2a305191bdf9bb84c5b2f3aa219cd4f135fa359 Mon Sep 17 00:00:00 2001 From: Camillo Moschner Date: Wed, 10 Jun 2026 23:20:14 +0100 Subject: [PATCH] `Mix`: add optional `surface_following_distance` Add an optional surface_following_distance (mm) to the Mix dataclass. It is an essential part of a good in-place mix on liquid handlers whose firmware drives Z in parallel with the piston (e.g. the Hamilton STAR), keeping the tip near the surface as the level changes. Backends without that capability ignore it; the default None is no surface following. Optional with a default, so existing Mix construction and serialization are unchanged; no backend behaviour changes here. Co-Authored-By: Claude Opus 4.8 (1M context) --- pylabrobot/liquid_handling/standard.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pylabrobot/liquid_handling/standard.py b/pylabrobot/liquid_handling/standard.py index bc0e9580a50..fdc057b7c94 100644 --- a/pylabrobot/liquid_handling/standard.py +++ b/pylabrobot/liquid_handling/standard.py @@ -74,9 +74,20 @@ class SingleChannelDispense: @dataclass(frozen=True) class Mix: + """Repeated aspirate/dispense cycles to mix the liquid during a transfer. + + Args: + volume: The volume drawn then expelled each cycle. + repetitions: The number of aspirate/dispense cycles. + flow_rate: The flow rate of the mix. + surface_following_distance: The distance (mm) the tip follows the liquid surface each cycle on + backends that support it (e.g. Hamilton STAR); others ignore it. + """ + volume: float repetitions: int flow_rate: float + surface_following_distance: Optional[float] = None @dataclass(frozen=True)