Skip to content

Commit 6dd7bd3

Browse files
committed
make 'clean' a part of empty fluid instead of it's own fluid
1 parent 14ba7b8 commit 6dd7bd3

File tree

9 files changed

+29
-50
lines changed

9 files changed

+29
-50
lines changed

api/src/opentrons/protocol_engine/commands/pick_up_tip.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async def execute(
150150
pipette_id=pipette_id,
151151
tip_geometry=e.tip_geometry,
152152
)
153-
.set_fluid_clean(pipette_id=pipette_id)
153+
.set_fluid_empty(pipette_id=pipette_id, clean_tip=True)
154154
.mark_tips_as_used(
155155
pipette_id=pipette_id, labware_id=labware_id, well_name=well_name
156156
)
@@ -188,7 +188,7 @@ async def execute(
188188
.mark_tips_as_used(
189189
pipette_id=pipette_id, labware_id=labware_id, well_name=well_name
190190
)
191-
.set_fluid_clean(pipette_id=pipette_id)
191+
.set_fluid_empty(pipette_id=pipette_id, clean_tip=True)
192192
.set_pipette_ready_to_aspirate(
193193
pipette_id=pipette_id, ready_to_aspirate=True
194194
)

api/src/opentrons/protocol_engine/state/pipettes.py

+7-14
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
Optional,
1212
Tuple,
1313
cast,
14-
Union,
1514
)
1615

1716
from typing_extensions import assert_never
@@ -333,20 +332,18 @@ def _update_ready_for_aspirate(
333332
def _update_volumes(self, state_update: update_types.StateUpdate) -> None:
334333
if state_update.pipette_aspirated_fluid == update_types.NO_CHANGE:
335334
return
336-
# if this is updating to anything but clean mark the tip as unclean
337-
if state_update.pipette_aspirated_fluid.type != "clean":
338-
self._state.has_clean_tips_by_id[
339-
state_update.pipette_aspirated_fluid.pipette_id
340-
] = False
335+
# set the tip state to unclean, if an "empty" update has a clean_tip flag
336+
# it will set it to true
337+
self._state.has_clean_tips_by_id[
338+
state_update.pipette_aspirated_fluid.pipette_id
339+
] = False
341340

342341
if state_update.pipette_aspirated_fluid.type == "aspirated":
343342
self._update_aspirated(state_update.pipette_aspirated_fluid)
344343
elif state_update.pipette_aspirated_fluid.type == "ejected":
345344
self._update_ejected(state_update.pipette_aspirated_fluid)
346345
elif state_update.pipette_aspirated_fluid.type == "empty":
347346
self._update_empty(state_update.pipette_aspirated_fluid)
348-
elif state_update.pipette_aspirated_fluid.type == "clean":
349-
self._update_empty(state_update.pipette_aspirated_fluid)
350347
elif state_update.pipette_aspirated_fluid.type == "unknown":
351348
self._update_unknown(state_update.pipette_aspirated_fluid)
352349
else:
@@ -365,13 +362,9 @@ def _update_aspirated(
365362
def _update_ejected(self, update: update_types.PipetteEjectedFluidUpdate) -> None:
366363
self._fluid_stack_log_if_empty(update.pipette_id).remove_fluid(update.volume)
367364

368-
def _update_empty(
369-
self,
370-
update: Union[
371-
update_types.PipetteEmptyFluidUpdate, update_types.PipetteCleanFluidUpdate
372-
],
373-
) -> None:
365+
def _update_empty(self, update: update_types.PipetteEmptyFluidUpdate) -> None:
374366
self._state.pipette_contents_by_id[update.pipette_id] = fluid_stack.FluidStack()
367+
self._state.has_clean_tips_by_id[update.pipette_id] = update.clean_tip
375368

376369
def _update_unknown(self, update: update_types.PipetteUnknownFluidUpdate) -> None:
377370
self._state.pipette_contents_by_id[update.pipette_id] = None

api/src/opentrons/protocol_engine/state/update_types.py

+3-18
Original file line numberDiff line numberDiff line change
@@ -323,17 +323,10 @@ class PipetteEmptyFluidUpdate:
323323
"""Sets the pipette to be valid and empty."""
324324

325325
pipette_id: str
326+
clean_tip: bool
326327
type: typing.Literal["empty"] = "empty"
327328

328329

329-
@dataclasses.dataclass
330-
class PipetteCleanFluidUpdate:
331-
"""Sets the pipette to be valid and empty and clean."""
332-
333-
pipette_id: str
334-
type: typing.Literal["clean"] = "clean"
335-
336-
337330
@dataclasses.dataclass
338331
class AbsorbanceReaderLidUpdate:
339332
"""An update to an absorbance reader's lid location."""
@@ -441,7 +434,6 @@ class StateUpdate:
441434
| PipetteEjectedFluidUpdate
442435
| PipetteUnknownFluidUpdate
443436
| PipetteEmptyFluidUpdate
444-
| PipetteCleanFluidUpdate
445437
| NoChangeType
446438
) = NO_CHANGE
447439

@@ -785,17 +777,10 @@ def set_fluid_unknown(self: Self, pipette_id: str) -> Self:
785777
)
786778
return self
787779

788-
def set_fluid_empty(self: Self, pipette_id: str) -> Self:
780+
def set_fluid_empty(self: Self, pipette_id: str, clean_tip: bool = False) -> Self:
789781
"""Update record of fluid held inside a pipette. See `PipetteEmptyFluidUpdate`."""
790782
self.pipette_aspirated_fluid = PipetteEmptyFluidUpdate(
791-
type="empty", pipette_id=pipette_id
792-
)
793-
return self
794-
795-
def set_fluid_clean(self: Self, pipette_id: str) -> Self:
796-
"""Update record of fluid held inside a pipette and mark tip as clean. See `PipetteEmptyFluidUpdate`."""
797-
self.pipette_aspirated_fluid = PipetteCleanFluidUpdate(
798-
type="clean", pipette_id=pipette_id
783+
type="empty", pipette_id=pipette_id, clean_tip=clean_tip
799784
)
800785
return self
801786

api/tests/opentrons/protocol_engine/commands/test_blow_out.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async def test_blow_out_implementation(
9797
new_deck_point=DeckPoint(x=1, y=2, z=3),
9898
),
9999
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
100-
pipette_id="pipette-id"
100+
pipette_id="pipette-id", clean_tip=False
101101
),
102102
ready_to_aspirate=update_types.PipetteAspirateReadyUpdate(
103103
pipette_id="pipette-id", ready_to_aspirate=False

api/tests/opentrons/protocol_engine/commands/test_blow_out_in_place.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def test_blow_out_in_place_implementation(
6161
public=BlowOutInPlaceResult(),
6262
state_update=update_types.StateUpdate(
6363
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
64-
pipette_id="pipette-id"
64+
pipette_id="pipette-id", clean_tip=False
6565
),
6666
ready_to_aspirate=update_types.PipetteAspirateReadyUpdate(
6767
pipette_id="pipette-id", ready_to_aspirate=False

api/tests/opentrons/protocol_engine/commands/test_pick_up_tip.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ async def test_success(
107107
tips_used=update_types.TipsUsedUpdate(
108108
pipette_id="pipette-id", labware_id="labware-id", well_name="A3"
109109
),
110-
pipette_aspirated_fluid=update_types.PipetteCleanFluidUpdate(
111-
pipette_id="pipette-id"
110+
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
111+
pipette_id="pipette-id", clean_tip=True
112112
),
113113
ready_to_aspirate=update_types.PipetteAspirateReadyUpdate(
114114
pipette_id="pipette-id", ready_to_aspirate=True
@@ -192,8 +192,8 @@ async def test_tip_physically_missing_error(
192192
pipette_tip_state=update_types.PipetteTipStateUpdate(
193193
pipette_id="pipette-id", tip_geometry=sentinel.tip_geometry
194194
),
195-
pipette_aspirated_fluid=update_types.PipetteCleanFluidUpdate(
196-
pipette_id="pipette-id"
195+
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
196+
pipette_id="pipette-id", clean_tip=True
197197
),
198198
tips_used=update_types.TipsUsedUpdate(
199199
pipette_id="pipette-id", labware_id="labware-id", well_name="well-name"

api/tests/opentrons/protocol_engine/commands/test_prepare_to_aspirate.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ async def test_prepare_to_aspirate_implementation(
5353
public=PrepareToAspirateResult(),
5454
state_update=update_types.StateUpdate(
5555
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
56-
pipette_id="some id"
56+
pipette_id="some id",
57+
clean_tip=False,
5758
),
5859
ready_to_aspirate=update_types.PipetteAspirateReadyUpdate(
5960
pipette_id="some id", ready_to_aspirate=True

api/tests/opentrons/protocol_engine/commands/unsafe/test_unsafe_blow_out_in_place.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def test_blow_out_in_place_implementation(
4646
public=UnsafeBlowOutInPlaceResult(),
4747
state_update=update_types.StateUpdate(
4848
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
49-
pipette_id="pipette-id"
49+
pipette_id="pipette-id", clean_tip=False
5050
),
5151
ready_to_aspirate=update_types.PipetteAspirateReadyUpdate(
5252
pipette_id="pipette-id", ready_to_aspirate=False

api/tests/opentrons/protocol_engine/state/test_pipette_store_old.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def test_handles_pick_up_and_drop_tip(subject: PipetteStore) -> None:
282282
tip_geometry=TipGeometry(volume=42, length=101, diameter=8.0),
283283
),
284284
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
285-
pipette_id="abc"
285+
pipette_id="abc", clean_tip=True
286286
),
287287
),
288288
)
@@ -338,7 +338,7 @@ def test_handles_drop_tip_in_place(subject: PipetteStore) -> None:
338338
tip_geometry=TipGeometry(volume=42, length=101, diameter=8.0),
339339
),
340340
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
341-
pipette_id="xyz"
341+
pipette_id="xyz", clean_tip=False
342342
),
343343
),
344344
)
@@ -393,7 +393,7 @@ def test_handles_unsafe_drop_tip_in_place(subject: PipetteStore) -> None:
393393
tip_geometry=TipGeometry(volume=42, length=101, diameter=8.0),
394394
),
395395
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
396-
pipette_id="xyz"
396+
pipette_id="xyz", clean_tip=False
397397
),
398398
),
399399
)
@@ -455,7 +455,7 @@ def test_aspirate_adds_volume(subject: PipetteStore) -> None:
455455
tip_geometry=TipGeometry(volume=42, length=101, diameter=8.0),
456456
),
457457
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
458-
pipette_id="pipette-id"
458+
pipette_id="pipette-id", clean_tip=True
459459
),
460460
),
461461
)
@@ -512,7 +512,7 @@ def test_dispense_subtracts_volume(subject: PipetteStore) -> None:
512512
tip_geometry=TipGeometry(volume=47, length=101, diameter=8.0),
513513
),
514514
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
515-
pipette_id="pipette-id"
515+
pipette_id="pipette-id", clean_tip=True
516516
),
517517
),
518518
)
@@ -569,7 +569,7 @@ def test_blow_out_clears_volume(subject: PipetteStore) -> None:
569569
tip_geometry=TipGeometry(volume=47, length=101, diameter=8.0),
570570
),
571571
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
572-
pipette_id="pipette-id"
572+
pipette_id="pipette-id", clean_tip=True
573573
),
574574
),
575575
)
@@ -739,7 +739,7 @@ def test_prepare_to_aspirate_marks_pipette_ready(
739739
tip_geometry=TipGeometry(volume=42, length=101, diameter=8.0),
740740
),
741741
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
742-
pipette_id="xyz"
742+
pipette_id="xyz", clean_tip=True
743743
),
744744
),
745745
)
@@ -754,7 +754,7 @@ def test_prepare_to_aspirate_marks_pipette_ready(
754754
command=dummy_command,
755755
state_update=update_types.StateUpdate(
756756
pipette_aspirated_fluid=update_types.PipetteEmptyFluidUpdate(
757-
pipette_id="pipette-id"
757+
pipette_id="pipette-id", clean_tip=False
758758
)
759759
),
760760
)

0 commit comments

Comments
 (0)