Different liquids pipette differently. Viscous liquids, volatile solvents, and surfactant-containing solutions all behave differently from water — and even the same liquid behaves differently at different volumes. The result is systematic pipetting error that is hard to correct by hand, and different for different systems.
DispenseRITE automatically calibrates pipetting parameters for a specific liquid class using multi-objective Bayesian optimization. You tell it what liquid you are pipetting, what volumes you care about, and how to measure delivered volume. It then searches over your hardware's parameter space (speeds, wait times, air gaps, blowout, overaspirate volume) and returns a per-volume recipe optimized for accuracy, precision, and time. The result is a CSV of calibrated parameters you can load and use directly in your pipetting protocols.
The decision layer is purely software — no specific robot or balance is
required. You plug in a protocol module that implements four functions
(initialize, measure, wrapup, get_parameter_constraints) and the
optimizer takes it from there. A simulated protocol is bundled so you can run
the entire pipeline end-to-end with no hardware at all.
The standard measurement approach is gravimetric — dispense onto a balance and convert mass to volume using the liquid's density. Any measurement method that returns a delivered volume works, including fluorescence, imaging, or conductivity, as long as your protocol translates it into a volume in mL.
flowchart TD
CFG["experiment_config.yaml\n─────────────────\nLiquid, volumes, parameter\nbounds, objectives, budgets"]
EXP["experiment.py\n─────────────────\nOrchestrates the run:\nscreening → optimization\n→ analysis per volume"]
BAY["bayesian_recommender.py\n─────────────────\nAx/BoTorch optimizer\nSuggests next parameters\nto try"]
PROTO["Your Protocol\n─────────────────\ninitialize(cfg)\nmeasure(state, volume, params)\nwrapup(state)"]
HW["Hardware\n─────────────────\nRobot + balance\n(or simulation)"]
OUT["output/ directory\n─────────────────\nOptimized parameters CSV\nPlots, raw measurements\nRun summary"]
CFG --> EXP
EXP -->|"next params to test"| BAY
BAY -->|"suggested params"| EXP
EXP -->|"volume + params"| PROTO
PROTO -->|"measured volumes + timings"| EXP
PROTO <-->|"hardware calls"| HW
EXP -->|"results"| OUT
Swap hardware by changing one line in the config (
hardware_protocol). The optimizer and analysis pipeline are unchanged.
- Hardware Abstraction — swap protocols by editing one line of YAML
- Bayesian Optimization — multi-objective search via the Ax platform (qNEHVI, GPEI)
- Adaptive Measurements — optional extra replicates on noisy trials
- Volume-Dependent Parameters — re-optimize per target volume with transfer learning
- Two-Point Overaspirate Correction — a final linear correction of the overaspirate volume per target volume
- Configuration in one YAML file — every option is commented inline
- External Data Bootstrapping — seed the optimizer from prior experiments (optional)
Requires Python 3.10, 3.11 or 3.12.
git clone https://github.com/AccelerationConsortium/dispense-rite.git
cd dispense-rite
pip install -e .To reproduce the exact package versions used for the paper, install
requirements.txt first (pip install -r requirements.txt), then pip install -e ..
The example config in examples/ runs in simulation (experiment.simulate: true),
so this needs no hardware:
dispense-rite-calibrate examples/experiment_config.yamlResults land in examples/output/<run_name>/ (paths in the config are relative
to the config file) — CSV summaries, optimized-parameter
files, and plots. No hardware needed. Simulated run folders end in _SIMULATED
and their summaries record simulation_mode: true, so they can't be mistaken
for real calibrations. Set output.save_files: false to keep simulated runs in
memory only.
Validation re-tests a calibration result with fresh measurements. The example
config points validation.optimal_conditions_file at
examples/optimal_conditions_water_example.csv, a real water calibration
(5-50 µL) from the North Robot:
dispense-rite-validate examples/experiment_config.yamlIn simulation this checks that the pipeline works end to end. The simulator is not the robot those parameters were tuned on, so a FAIL here says nothing about the calibration. The command exits with code 1 when no volume passes.
To validate your own run, point validation.optimal_conditions_file at its
optimal_conditions_<liquid>.csv.
- Start with simulation — copy
examples/experiment_config.yamland rundispense-rite-calibrate experiment_config.yaml - Inspect outputs — look at
output/<run_name>/for plots and CSVs - Adjust parameter bounds — tune
hardware_parametersfor your setup - Write your protocol — copy the template (see Writing your own protocol)
- Run on hardware — set
experiment.simulate: falseand run again - Validate — point
validation.optimal_conditions_fileat the run's CSV and rundispense-rite-validate experiment_config.yaml
The optimizer handles replication, transfer learning between volumes, and produces analysis outputs (plots, feature importance, statistical summaries) automatically.
examples/ holds a complete real run from the North Robotics robot with a
balance: water calibrated at 50, 20, 10 and 5 µL (28 trials, 93 measurements),
then validated with fresh measurements at 5, 10, 25 and 50 µL. Use it to see what
your own data should look like before you run any hardware.
examples/example_calibration_run/: the calibration: result, every trial, every measurement, and plotsexamples/example_validation_run/: its validation, exactly as written bydispense-rite-validate
Every trial the optimizer tried. Each point is one parameter set: its time per dispense against its deviation from the target. Screening trials scatter widely. Later trials crowd toward low deviation, and the small volumes converge in a few trials because they start from the larger volume's best parameters.
Every measurement in order, against its target (dashed line):
The result (optimal_conditions_water.csv, parameters abbreviated):
| volume_target_ul | volume_measured_ul | deviation_pct | precision_cv_pct | duration_s | calibration_overaspirate_vol (mL) | aspirate_speed | dispense_speed |
|---|---|---|---|---|---|---|---|
| 50 | 50.36 | 0.72 | 0.11 | 16.0 | 0.0031 | 15 | 6 |
| 20 | 19.96 | 0.60 | 0.76 | 15.7 | 0.0023 | 15 | 6 |
| 10 | 9.89 | 1.88 | 3.04 | 15.6 | 0.0019 | 15 | 6 |
| 5 | 4.72 | 5.60 | 0.95 | 15.3 | 0.0019 | 15 | 6 |
Validation. Measured against target volume, and accuracy and precision per volume against tolerance (dashed lines). 25 µL was never calibrated; its parameters were interpolated. 25 and 50 µL pass their 3% tolerance. 5 and 10 µL miss their 5% tolerance, which is the kind of result validation exists to catch.
To redraw a run's plots from its CSVs, for example after editing them:
python -m dispense_rite.visualization examples/example_calibration_runThe optimizer never sees your raw instrument readings, only the volume your
protocol works out from them. For each dispense your protocol's measure() returns:
{'replicate': 1, 'volume': 0.04976, 'elapsed_s': 15.8} # volume in mLWith a balance, volume is the mass change divided by the liquid's density
(49.66 mg of water at 0.998 g/mL is 0.04976 mL). Any instrument works as long as
you convert its reading to a delivered volume in mL. elapsed_s is the time the
dispense took and is one of the three objectives. Everything else in the output
files is computed from these values.
Each calibration run creates a timestamped folder under output/. The key file
is optimal_conditions_<liquid>.csv — this is the end product of calibration.
| File | What it contains |
|---|---|
optimal_conditions_<liquid>.csv |
The calibration result. One row per target volume with the best parameter set found and its achieved accuracy, precision, and timing. |
optimal_conditions.json |
Same data as the CSV, in JSON format |
trial_results.csv |
Every parameter combination tried during the run with its measured outcomes — useful for understanding the search |
raw_measurements.csv |
Individual replicate measurements for every trial |
analysis_report.txt |
Human-readable summary of the best results per volume |
experiment_summary.json |
Full run metadata (config, timings, counts) |
experiment_config_used.yaml |
Snapshot of the exact config used — useful for reproducing the run |
The optimal_conditions_<liquid>.csv has one row per calibrated volume. Key columns:
volume_target_ml — target volume
deviation_pct — achieved accuracy (lower is better)
precision_cv_pct — achieved precision as CV% (lower is better)
duration_s — average time per pipetting operation
status — "success" or "failed" against your tolerances
calibration_overaspirate_vol — the key correction volume
hardware_parameters_* — one column per tuned hardware parameter
PipettingWizard reads the optimal_conditions_*.csv files in a folder and
returns the right parameters for any target volume, interpolating the
overaspirate volume between calibrated points if needed:
from dispense_rite.pipetting_wizard import PipettingWizard
wizard = PipettingWizard(search_directory="examples/")
params = wizard.get_pipetting_parameters(0.03, liquid="water") # 30 uL
# params is a dict of {parameter_name: value} ready to pass to your hardwareBefore using calibrated parameters in production, validate them with an independent set of measurements:
dispense-rite-validate experiment_config.yamlConfigure the validation target in experiment_config.yaml:
validation:
optimal_conditions_file: output/<run_name>/optimal_conditions_water.csv
volumes_ml: [0.05]
replicates_per_volume: 5All behavior is controlled by experiment_config.yaml.
The file is organized into commented sections: experiment,
calibration_parameters, hardware_parameters, optimization, output,
validation, screening, tolerances, adaptive_measurement. Skim it once
— the inline comments explain each block.
experiment:
liquid: water # label, propagated to outputs
volume_targets_ml: [0.005, 0.01, 0.025, 0.05] # volumes to calibrate
simulate: true # false = run on real hardware
hardware_protocol: calibration_protocol_myrobot # your protocol (used when simulate: false)
simulation_protocol: calibration_protocol_simulated
name: my_calibration_run
description: Testing accuracy across four volumes
random_seed: 30
max_total_measurements: 96 # See "Measurement budget" below
num_screening_trials: 8Every trial consumes physical resources — tips, liquid, and time. The
max_total_measurements setting caps the total number of individual pipetting
measurements across the entire run. This matters because:
- Tips are finite — a tip rack typically holds 96 tips; once they are gone the run must stop
- Slow hardware — if each measurement takes 30–60 seconds, 96 measurements is already a 1–3 hour run
- Multiple volumes — the budget is shared across all volumes in
volume_targets_ml; calibrating 4 volumes with 96 measurements means roughly 24 measurements per volume
A typical starting point is 96 measurements (one full tip rack). Increase it if you have more tips available and want the optimizer to search more thoroughly; decrease it for quick exploratory runs.
Each entry in hardware_parameters defines one dimension of the search:
hardware_parameters:
aspirate_speed:
bounds: [2, 30]
default: 10
type: integer
round_to_nearest: 1
description: Aspiration speed (relative units).
aspirate_wait_time:
bounds: [0.0, 30.0]
default: 10.0
type: float
round_to_nearest: 0.1
description: Wait time after aspiration (seconds).Any parameter listed under experiment.fixed_parameters is held at the given
value and excluded from the search space, while its hardware_parameters
block (bounds/default/description) stays intact. Toggle a parameter in or out
of the optimizer by adding or removing its entry in fixed_parameters —
no need to rewrite the parameter definition.
experiment:
fixed_parameters:
post_asp_air_vol: 0 # held constant; not tuned
retract_speed: 5.0 # held constant; not tunedoptimization:
objectives:
# weights must sum to 1.0
accuracy_weight: 0.4
precision_weight: 0.5
time_weight: 0.1
optimizer:
type: multi_objective # or single_objective
backend: qNEHVI # first-stage screening backend
backend_subsequent: GPEI # backend for subsequent volumesYour protocol lives in your own folder; you don't edit the package. Copy the template next to your config and fill in the TODO sections:
mkdir my_protocols
cp src/dispense_rite/protocols/calibration_protocol_template.py my_protocols/calibration_protocol_myrobot.pyThe template is a minimal, annotated example of exactly what to implement.
For a complete real-world protocol, see
src/dispense_rite/protocols/calibration_protocol_northrobot.py (North Robotics
robot plus balance; it only runs inside the lab's Lash-E codebase).
Then point the config at it:
experiment:
hardware_protocol: calibration_protocol_myrobot # filename without .py
protocol_search_paths: [my_protocols] # relative to this config file
simulation_protocol: calibration_protocol_simulated
simulate: falseProtocol names are looked up in the bundled protocols first, then in
protocol_search_paths, then in the folders listed in the
DISPENSE_RITE_PROTOCOL_PATH environment variable. A dotted module path
(my_lab.protocols.myrobot) is imported directly.
Your protocol must implement these four methods:
- Initialize hardware
- Return a state dictionary — a plain dict of whatever your hardware needs to track across the calibration run (robot handles, vial positions, measurement counters, etc.)
- State is passed unchanged to every
measure()andwrapup()call; the framework never inspects its contents cfgcontainsexperiment(the config's experiment section),random_seed, andhardware(an optional top-levelhardwaresection of the config, for your own settings)- See the template for suggested state keys
- Perform pipetting measurements
paramsis a dict of parameter values chosen by the optimizer — keys match exactly the names defined inhardware_parametersin the config (e.g.aspirate_speedin config →params.get('aspirate_speed', 10)in your protocol)overaspirate_volis always present inparamsand must be used to increase the aspirated volume- Return list of measurement dictionaries, one per replicate (the engine calls with
replicates=1and adds replicates itself) - Each result must have:
replicate,volume(measured in mL),elapsed_s - Optional:
measurement_budget_consumed(default 1), if one result used more than one unit of the measurement budget (for example, a retried attempt) - Echo
**paramsinto each result dict so the optimizer can log what parameter values were tested
- Clean up hardware resources
- Move to safe positions, close connections, etc.
- Return
None; returningFalselogs a warning that cleanup had problems
- Return hardware-specific optimization constraints
- Called for each target volume during optimization
- Return empty list
[]if no constraints apply - Constraints must be linear (
a + b <= c,2*a - b <= c). A constraint that can't be read stops the run rather than being ignored
Each measurement result must include:
{
'replicate': 1, # Replicate number (1-based)
'volume': 0.0089, # Measured volume in mL
'elapsed_s': 3.2, # Time taken in seconds
'target_volume_mL': 0.01, # Target volume
# Plus any parameters you want to echo back
'my_hardware_param': 15.5, # Your hardware-specific parameter
'my_timing_param': 2.0, # Your hardware-specific timing
# etc.
}Define hardware-specific parameter relationships in your protocol file:
def get_parameter_constraints(self, target_volume_ml: float) -> List[str]:
"""Return constraint strings for the optimizer."""
constraints = []
# Example: Tip volume constraint
tip_volume_ml = 1.0 # Your tip capacity
available_volume = tip_volume_ml - target_volume_ml
constraints.append(f"my_air_param + overaspirate_vol <= {available_volume}")
# Example: Hardware limits (linear only)
constraints.append("my_speed1 + my_speed2 <= 40")
return constraintsLoad existing calibration data to bootstrap the optimizer — this replaces the initial screening phase with real historical results instead of random trials, so the optimizer starts from a better position.
The CSV must contain these columns:
target_volume_ml— the target volume for each measurementmeasured_volume_ml— the actual measured volumemeasurement_time_s— how long the measurement took- One column per hardware parameter you want to seed (names must match your
hardware_parametersconfig keys exactly)
See examples/input_data/external_calibration_data.csv for a complete working example.
screening:
external_data:
enabled: true
data_path: "input_data/external_calibration_data.csv"
volume_filter_ml: 0.05 # Only use rows matching this target volume (optional)
liquid_filter: water # Only use rows matching this liquid type (optional)Control when additional replicates are performed:
adaptive_measurement:
enabled: true
base_replicates: 1 # baseline replicate count per trial
deviation_threshold_pct: 30.0 # add replicates only while deviation <= this
penalty_variability_pct: 100.0 # variability assigned to trials too inaccurate to replicateA promising trial (deviation at or below deviation_threshold_pct) gets extra
replicates, up to experiment.max_replicates_per_trial, so its precision can be
measured. A trial with a larger deviation is not replicated; its variability is
recorded as penalty_variability_pct instead.
dispense-rite/
├── pyproject.toml # Package metadata; installs the two commands
├── requirements.txt # Exact versions used for the paper
├── examples/
│ ├── experiment_config.yaml # Annotated example config (simulation)
│ ├── optimal_conditions_water_example.csv # Real calibration result, for validation
│ ├── example_calibration_run/ # A real calibration: CSVs and plots
│ ├── example_validation_run/ # Its real validation
│ └── input_data/external_calibration_data.csv # Example prior data for bootstrapping
├── src/dispense_rite/
│ ├── run_calibration.py # dispense-rite-calibrate
│ ├── run_validation.py # dispense-rite-validate
│ ├── experiment.py # Calibration loop: screening, optimization, two-point, per volume
│ ├── bayesian_recommender.py # Ax/BoTorch optimizer and hardware constraints
│ ├── constraint_calibration.py # Two-point overaspirate correction
│ ├── parameter_constraints.py # Linear constraint handling with fixed parameters
│ ├── analysis.py # Per-trial scoring (accuracy, precision, time)
│ ├── config_manager.py # Reads experiment_config.yaml
│ ├── data_structures.py, optimization_structures.py # Data types
│ ├── protocol_loader.py # Finds and loads protocols
│ ├── pipetting_wizard.py # Look up calibrated parameters for any volume
│ ├── external_data.py # Bootstrap from prior measurements
│ ├── experiment_analysis.py # End-of-run analysis (incl. SHAP importance)
│ ├── visualization.py, csv_export.py # Plots (python -m dispense_rite.visualization RUN_DIR) and CSVs
│ └── protocols/
│ ├── calibration_protocol_base.py # The interface every protocol implements
│ ├── calibration_protocol_template.py # Start here for new hardware
│ ├── calibration_protocol_simulated.py # Simulated hardware
│ └── calibration_protocol_northrobot.py # North Robotics reference (needs Lash-E)
├── tools/post_optimization_dashboard.py # Summary figure from a finished run
└── tests/
Protocol not found: the error lists every protocol it can see. Check that
the name in the config matches the filename (without .py) and that the folder
is in experiment.protocol_search_paths.
Constraint error at start-up: a constraint from get_parameter_constraints
couldn't be read. Only linear constraints are supported.
No hardware yet: set experiment.simulate: true; the simulated protocol
stands in for the robot and balance.
The calibration and validation datasets behind the paper are archived on Zenodo:
DOI to be added. This repository ships one complete example, a water
calibration and its validation, in examples/.
If you use DispenseRITE, please cite the paper (see CITATION.cff).
Owen A. Melville, Enrui Lin, Ilya Yakakets, Yimu Zhao
Acceleration Consortium, University of Toronto
DispenseRITE was developed at the intersection of self-driving lab research and hardware automation.



