session
Backend-agnostic fluid-control session for manual operation.
This module is intentionally free of prompt_toolkit and rich
dependencies so it can be imported and unit-tested without those packages
installed. The interactive REPL is in fluid_control.cli.cli.
FluidControlSession
Backend-agnostic session wrapper for manual fluid-control operations.
Wraps a PressureOverLiquidControl
instance (Dispenser or Pipettor) with optional
[Gantry][applied_motion.applied_motion.Gantry] support for mount-arm motion.
Has no dependency on prompt_toolkit or rich; it can be used
programmatically without an interactive terminal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
PressureOverLiquidControl
|
The |
required |
gantry
|
Gantry | None
|
Optional connected [ |
None
|
mount_axis_name
|
str
|
Name of the axis in gantry that acts as the mount arm
(raise/lower axis). Defaults to |
'Z'
|
Attributes:
| Name | Type | Description |
|---|---|---|
component |
The bound fluid-control component. |
|
gantry |
The bound gantry, or |
|
mount_axis_name |
Name of the mount arm axis. |
Source code in src/fluid_control/cli/session.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
__init__(component, gantry=None, mount_axis_name='Z')
Initialise a session for the given fluid-control component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
PressureOverLiquidControl
|
The
|
required |
gantry
|
Gantry | None
|
Optional connected [ |
None
|
mount_axis_name
|
str
|
Name of the mount arm axis in gantry.
Defaults to |
'Z'
|
Source code in src/fluid_control/cli/session.py
aspirate(channel, volume_ul, liquid_class)
Aspirate a volume on a single channel (Pipettor only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
Valve channel ID. |
required |
volume_ul
|
float
|
Volume to aspirate in microlitres. |
required |
liquid_class
|
str
|
Liquid class key matching a calibration entry. |
required |
Returns:
| Type | Description |
|---|---|
OperationResult
|
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the component does not support aspiration
(e.g. a |
Source code in src/fluid_control/cli/session.py
direct(channel_times, pressure)
Send a multi-channel raw valve command, bypassing volume calibration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_times
|
dict[int, int]
|
Mapping of channel ID → opening time in ms. |
required |
pressure
|
int
|
Output pressure in mbar for the operation. |
required |
Returns:
| Type | Description |
|---|---|
OperationResult
|
|
Source code in src/fluid_control/cli/session.py
disable_axes()
Disable the powerstage on the component's disable_axes list.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the component is static (no axes configured). |
Source code in src/fluid_control/cli/session.py
dispense(channel, volume_ul, liquid_class)
Dispense a volume on a single channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
Valve channel ID. |
required |
volume_ul
|
float
|
Volume to dispense in microlitres. |
required |
liquid_class
|
str
|
Liquid class key matching a calibration entry. |
required |
Returns:
| Type | Description |
|---|---|
OperationResult
|
|
Source code in src/fluid_control/cli/session.py
eject_tips()
Eject tips using pneumatic actuation.
Returns:
| Type | Description |
|---|---|
OperationResult
|
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the component does not support tip ejection
(e.g. a |
Source code in src/fluid_control/cli/session.py
enable_axes()
Enable the powerstage on the component's disable_axes list.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the component is static (no axes configured). |
Source code in src/fluid_control/cli/session.py
get_channels()
Return the list of active valve channel IDs.
Returns:
| Type | Description |
|---|---|
list[int]
|
List of active channel integers. |
get_liquid_classes()
Return all available liquid class names.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of liquid class name strings from the current calibration config. |
Source code in src/fluid_control/cli/session.py
get_status()
Return combined fluid-control, pressure, and valve status.
Returns:
| Type | Description |
|---|---|
dict
|
Status dict from |
dict
|
Source code in src/fluid_control/cli/session.py
home()
Home all axes on the gantry.
Raises:
| Type | Description |
|---|---|
GantryNotConfiguredError
|
If no gantry is configured. |
Source code in src/fluid_control/cli/session.py
mix(channel, volume_ul, liquid_class, cycles)
Mix by repeatedly aspirating and dispensing on a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
Valve channel ID. |
required |
volume_ul
|
float
|
Volume per cycle in microlitres. |
required |
liquid_class
|
str
|
Liquid class key matching a calibration entry. |
required |
cycles
|
int
|
Number of aspirate/dispense cycles. |
required |
Returns:
| Type | Description |
|---|---|
OperationResult
|
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the component does not support mixing
(e.g. a static |
Source code in src/fluid_control/cli/session.py
move_axis(axis_name, position_mm, velocity=_DEFAULT_VELOCITY)
Move a gantry axis to an absolute position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis_name
|
str
|
Name of the axis as registered in the gantry. |
required |
position_mm
|
float
|
Target position in mm (absolute). |
required |
velocity
|
float
|
Move speed in mm/s. Defaults to |
_DEFAULT_VELOCITY
|
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Gantry location dict after the move completes. |
Raises:
| Type | Description |
|---|---|
GantryNotConfiguredError
|
If no gantry is configured. |
KeyError
|
If axis_name is not registered with the gantry. |
Source code in src/fluid_control/cli/session.py
pickup_tips(duration)
Pick up tips by driving the mount arm downward until stall detection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Jog duration in seconds per stall-detection cycle. |
required |
Returns:
| Type | Description |
|---|---|
OperationResult
|
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the component is static or does not support
tip pickup (e.g. a |
Source code in src/fluid_control/cli/session.py
raise_arm(delta_mm, velocity=_DEFAULT_VELOCITY)
Move the mount arm by a relative offset from its current position.
TODO: add flag for checking if axis is mounted inverted and support for positioning Reads the current axis position and applies delta_mm as a signed offset. Positive values move the arm in the positive axis direction; negative values move it in the opposite direction.
The raise REPL command passes a positive delta; the lower
command passes a negative delta. Absolute moves can be achieved with
[move_axis][] directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delta_mm
|
float
|
Relative move distance in mm. Positive = higher encoder count; negative = lower encoder count. |
required |
velocity
|
float
|
Move speed in mm/s. Defaults to |
_DEFAULT_VELOCITY
|
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Gantry location dict after the move completes. |
Raises:
| Type | Description |
|---|---|
GantryNotConfiguredError
|
If no gantry is configured. |
Source code in src/fluid_control/cli/session.py
set_pressure(pressure_mbar)
Set output pressure and block until it stabilises.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pressure_mbar
|
int
|
Target pressure in mbar. |
required |
Source code in src/fluid_control/cli/session.py
valve_timed(channel, time_ms, pressure=0)
Open a single valve for a fixed duration.
Wraps PressureOverLiquidControl.direct_command
for the common single-channel case.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
Valve channel ID (must be in active channels). |
required |
time_ms
|
int
|
Valve opening duration in milliseconds. Must be > 0. |
required |
pressure
|
int
|
Output pressure in mbar to hold during the operation.
Defaults to |
0
|
Returns:
| Type | Description |
|---|---|
OperationResult
|
|
Source code in src/fluid_control/cli/session.py
where()
Return the current position of all gantry axes.
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Mapping of axis name → position in mm. |
Raises:
| Type | Description |
|---|---|
GantryNotConfiguredError
|
If no gantry is configured. |
Source code in src/fluid_control/cli/session.py
GantryNotConfiguredError
Bases: AttributeError
Raise when a gantry-dependent method is called without a gantry.
Subclasses [AttributeError][builtins.AttributeError] because the underlying failure is an
attempted attribute access on None (self.gantry is unset), while
remaining precisely catchable by callers that only care about this case.
Source code in src/fluid_control/cli/session.py
require_attr(attr)
Raise GantryNotConfiguredError via this decorator if self.<attr> is None.