Skip to content

Commit

Permalink
mostly works except detect_liquid_presence errors on empty well inste…
Browse files Browse the repository at this point in the history
…ad of returning False
  • Loading branch information
aaron-kulkarni committed Jul 11, 2024
1 parent 0daaabf commit 8855fa3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 47 deletions.
76 changes: 32 additions & 44 deletions api/lldfunctionexamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,61 +33,49 @@ def run(ctx: protocol_api.ProtocolContext):


# ####### FIRST CYCLE, SHOULD NOT DO LLD #######
# pipette.pick_up_tip(tiprack["A1"])

# # Liquid presence detection does not take place in the following aspirate command
# # because the pipette was loaded in with liquid_presence_detection = False
# pipette.aspirate(5, reservoir["A1"])
# pipette.dispense(5, plate["A1"])

# #Make sure to get a new tip each time before attempting liquid presence detection
# pipette.drop_tip(trash_bin)





# ####### SECOND CYCLE, SHOULD NOT DO LLD #######
# pipette.pick_up_tip(tiprack["A2"])

# print(pipette.liquid_detection) #should be: False
# pipette.liquid_detection = True
# print(pipette.liquid_detection) #should be: True
# pipette.aspirate(5, reservoir["A2"])
# pipette.dispense(5, plate["A1"])
# pipette.drop_tip(trash_bin)
pipette.pick_up_tip(tiprack["A1"])
pipette.aspirate(100, reservoir["A1"])
pipette.dispense(100, plate["B2"])
pipette.drop_tip(trash_bin)


####### SECOND CYCLE, SHOULD DO LLD #######
pipette.liquid_detection = True
pipette.pick_up_tip(tiprack["A2"])
pipette.aspirate(100, reservoir["A2"])
pipette.dispense(100, plate["A10"])
pipette.drop_tip(trash_bin)


####### THIRD CYCLE, SHOULD DO LLD #######
####### THIRD CYCLE, SHOULD NOT DO LLD #######
pipette.liquid_detection = False
pipette.pick_up_tip(tiprack["A3"])

print(pipette.liquid_detection) #should be: False
pipette.require_liquid_presence(plate["A5"]) #should run without error
pipette.aspirate(100, reservoir["A3"])
pipette.dispense(100, plate["A11"])
pipette.drop_tip(trash_bin)

###### FOURTH CYCLE, SHOULD DO LLD #######
pipette.pick_up_tip(tiprack["A4"])
pipette.require_liquid_presence(plate["A6"]) #should run without error
pipette.drop_tip(trash_bin)


####### FIFTH CYCLE, SHOULD TRY TO DO LLD #######
pipette.pick_up_tip(tiprack["A5"])
pipette.require_liquid_presence(plate["D10"]) #should error because no liquid in there but provide chance for recovery
pipette.drop_tip(trash_bin)

# ####### FOURTH CYCLE, SHOULD TRY TO DO LLD #######
# pipette.pick_up_tip(tiprack["A4"])

# pipette.require_liquid_presence(plate["A2"]) #should error because no liquid in there but provide chance for recovery

# pipette.drop_tip(trash_bin)



# ####### FIFTH CYCLE, SHOULD DO LLD #######
# pipette.pick_up_tip(tiprack["A5"])

# assert pipette.detect_liquid_presence(plate["A1"]) == True

# pipette.drop_tip(trash_bin)
# pipette.pick_up_tip(tiprack["A6"])
####### SIXTH CYCLE, SHOULD DO LLD #######
pipette.pick_up_tip(tiprack["A6"])
assert pipette.detect_liquid_presence(plate["A2"]) is True
pipette.drop_tip(trash_bin)

# #assert pipette.detect_liquid_presence(plate["A2"]) == False

# pipette.drop_tip(trash_bin)
####### SEVENTH CYCLE, SHOULD DO LLD #######
pipette.pick_up_tip(tiprack["A7"])
if pipette.detect_liquid_presence(plate["H7"]) is False:
pipette.drop_tip(trash_bin)
### THE BELOW LINE IS A PROBLEM
# assert pipette.detect_liquid_presence(plate["H7"]) is False

1 change: 0 additions & 1 deletion api/src/opentrons/protocol_api/core/engine/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,6 @@ def liquid_probe_without_recovery(self, well_core: WellCore) -> float:
pipetteId=self.pipette_id,
)
)

#TODO: fix this. i'm not even sure what set_last_location is used for
self._protocol_core.set_last_location(location=Location(well_core.get_top(0), "Well"), mount=self.get_mount())

Expand Down
6 changes: 5 additions & 1 deletion api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ def aspirate(

well: Optional[labware.Well] = None
move_to_location: types.Location

last_location = self._get_last_location_by_api_version()
try:
target = validation.validate_location(
Expand Down Expand Up @@ -259,6 +258,11 @@ def aspirate(
else:
c_vol = self._core.get_available_volume() if not volume else volume
flow_rate = self._core.get_aspirate_flow_rate(rate)

if self.api_version >= APIVersion(2, 20) and well is not None:
if self._core.get_liquid_presence_detection():
self.require_liquid_presence(well=well)
self.prepare_to_aspirate()

with publisher.publish_context(
broker=self.broker,
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_engine/commands/liquid_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def execute(self, params: LiquidProbeParams) -> _ExecuteReturn:
try:
z_pos = await self._pipetting.liquid_probe_in_place(
pipette_id=pipette_id, labware_id=labware_id, well_name=well_name
)
)
except PipetteLiquidNotFoundError as e:
return DefinedErrorData(
public=LiquidNotFoundError(
Expand Down

0 comments on commit 8855fa3

Please sign in to comment.