Skip to content

Commit 721d082

Browse files
committed
clearer error message on lh param len mismatch
1 parent 9c98fe6 commit 721d082

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

pylabrobot/liquid_handling/liquid_handler.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,18 @@ async def aspirate(
860860
raise ValueError("Aspirating from a well with a lid is not supported.")
861861

862862
self._make_sure_channels_exist(use_channels)
863-
assert len(resources) == len(vols) == len(offsets) == len(flow_rates) == len(liquid_height)
863+
for n, l in [
864+
("resources", resources),
865+
("vols", vols),
866+
("offsets", offsets),
867+
("flow_rates", flow_rates),
868+
("liquid_height", liquid_height),
869+
("blow_out_air_volume", blow_out_air_volume),
870+
]:
871+
if len(l) != len(use_channels):
872+
raise ValueError(
873+
f"Length of {n} must match length of use_channels: {len(l)} != {len(use_channels)}"
874+
)
864875

865876
# If the user specified a single resource, but multiple channels to use, we will assume they
866877
# want to space the channels evenly across the resource. Note that offsets are relative to the
@@ -1102,7 +1113,18 @@ async def dispense(
11021113
if isinstance(resource.parent, Plate) and resource.parent.has_lid():
11031114
raise ValueError("Dispensing to plate with lid")
11041115

1105-
assert len(vols) == len(offsets) == len(flow_rates) == len(liquid_height)
1116+
for n, l in [
1117+
("resources", resources),
1118+
("vols", vols),
1119+
("offsets", offsets),
1120+
("flow_rates", flow_rates),
1121+
("liquid_height", liquid_height),
1122+
("blow_out_air_volume", blow_out_air_volume),
1123+
]:
1124+
if len(l) != len(use_channels):
1125+
raise ValueError(
1126+
f"Length of {n} must match length of use_channels: {len(l)} != {len(use_channels)}"
1127+
)
11061128

11071129
# liquid(s) for each channel. If volume tracking is disabled, use None as the liquid.
11081130
if does_volume_tracking():

0 commit comments

Comments
 (0)