Skip to content

Commit

Permalink
fix flow_rate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Aug 26, 2022
1 parent f6230df commit c2d013c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
12 changes: 4 additions & 8 deletions api/src/opentrons/protocol_runner/legacy_command_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,8 @@ def _build_liquid_handling_commands(
pipette: LegacyPipetteContext = command["payload"]["instrument"]
location = command["payload"]["location"]
volume = command["payload"]["volume"]
flow_rate = command["payload"]["rate"]
if isinstance(location, Location) and location.labware.is_empty is False:
if location.labware.is_well:
well = location.labware.as_well()
if isinstance(location, Location) and location.labware.is_well:
well = location.labware.as_well()
slot = DeckSlotName(location.labware.first_parent())
parent_module_id = self._module_id_by_slot.get(slot)
labware_id = (
Expand All @@ -364,8 +362,7 @@ def _build_liquid_handling_commands(
pipette_id = self._pipette_id_by_mount[mount]

if command["name"] == legacy_command_types.ASPIRATE:
if flow_rate == 1.0:
flow_rate = command["payload"]["rate"] * pipette.flow_rate.aspirate
flow_rate = command["payload"]["rate"] * pipette.flow_rate.aspirate
return pe_commands.Aspirate.construct(
id=command_id,
key=command_id,
Expand All @@ -381,8 +378,7 @@ def _build_liquid_handling_commands(
),
)
else:
if flow_rate == 1.0:
flow_rate = command["payload"]["rate"] * pipette.flow_rate.dispense
flow_rate = command["payload"]["rate"] * pipette.flow_rate.dispense
return pe_commands.Dispense.construct(
id=command_id,
key=command_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def run(ctx):
pipette_left.pick_up_tip()
pipette_left.aspirate(
volume=40,
rate=130,
rate=1.0,
location=module_plate_1["A1"],
)
pipette_left.dispense(
volume=35,
rate=130,
rate=1.2,
location=well_plate_1["B1"],
)
pipette_left.aspirate(
Expand All @@ -97,9 +97,11 @@ def run(ctx):
pipette_left.dispense()
pipette_left.blow_out()
pipette_left.move_to(Location(point=Point(100, 100, 10),labware=None))
pipette_left.aspirate()
pipette_left.blow_out()
pipette_left.aspirate(50, well_plate_1["D1"].bottom().move(point=Point(100, 10, 0)))
pipette_left.dispense(50, well_plate_1["F1"].top().move(point=Point(10, 10, 0)))
pipette_left.aspirate(50, Location(point=Point(100, 100, 10), labware=None))
pipette_left.drop_tip(
location=tip_rack_1.wells_by_name()["A1"]
)
Expand Down Expand Up @@ -135,7 +137,7 @@ async def test_legacy_commands(legacy_commands_protocol_file: Path) -> None:
pipette_left_result_captor = matchers.Captor()
pipette_right_result_captor = matchers.Captor()

assert len(commands_result) == 27
assert len(commands_result) == 29

assert commands_result[0] == commands.LoadLabware.construct(
id=matchers.IsA(str),
Expand Down Expand Up @@ -317,7 +319,7 @@ async def test_legacy_commands(legacy_commands_protocol_file: Path) -> None:
labwareId=module_plate_1_id,
wellName="A1",
volume=40,
flowRate=130,
flowRate=150,
),
result=commands.AspirateResult(volume=40),
)
Expand All @@ -333,7 +335,7 @@ async def test_legacy_commands(legacy_commands_protocol_file: Path) -> None:
labwareId=well_plate_1_id,
wellName="B1",
volume=35,
flowRate=130,
flowRate=360,
),
result=commands.DispenseResult(volume=35),
)
Expand Down

0 comments on commit c2d013c

Please sign in to comment.