Skip to content

Commit

Permalink
Created PickUpTipWellOrigin without MENISCUS enum and updated BlowOut…
Browse files Browse the repository at this point in the history
… command to use WellLocation
  • Loading branch information
pmoegenburg committed Oct 14, 2024
1 parent 029ecea commit 38235fe
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 54 deletions.
10 changes: 6 additions & 4 deletions api/src/opentrons/protocol_api/core/engine/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,12 @@ def blow_out(
well_name = well_core.get_name()
labware_id = well_core.labware_id

well_location = self._engine_client.state.geometry.get_relative_liquid_handling_well_location(
labware_id=labware_id,
well_name=well_name,
absolute_point=location.point,
well_location = (
self._engine_client.state.geometry.get_relative_well_location(
labware_id=labware_id,
well_name=well_name,
absolute_point=location.point,
)
)
pipette_movement_conflict.check_safe_for_pipette_movement(
engine_state=self._engine_client.state,
Expand Down
2 changes: 2 additions & 0 deletions api/src/opentrons/protocol_engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
DropTipWellLocation,
WellOrigin,
DropTipWellOrigin,
PickUpTipWellOrigin,
WellOffset,
ModuleModel,
ModuleDefinition,
Expand Down Expand Up @@ -116,6 +117,7 @@
"DropTipWellLocation",
"WellOrigin",
"DropTipWellOrigin",
"PickUpTipWellOrigin",
"WellOffset",
"ModuleModel",
"ModuleDefinition",
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_engine/commands/blow_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .pipetting_common import (
PipetteIdMixin,
FlowRateMixin,
LiquidHandlingWellLocationMixin,
WellLocationMixin,
DestinationPositionResult,
)
from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData
Expand All @@ -25,7 +25,7 @@
BlowOutCommandType = Literal["blowout"]


class BlowOutParams(PipetteIdMixin, FlowRateMixin, LiquidHandlingWellLocationMixin):
class BlowOutParams(PipetteIdMixin, FlowRateMixin, WellLocationMixin):
"""Payload required to blow-out a specific well."""

pass
Expand Down
4 changes: 3 additions & 1 deletion api/src/opentrons/protocol_engine/state/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,9 @@ def convert_pick_up_tip_well_location(
self, well_location: PickUpTipWellLocation
) -> WellLocation:
"""Convert PickUpTipWellLocation to WellLocation."""
return WellLocation(origin=well_location.origin, offset=well_location.offset)
return WellLocation(
origin=WellOrigin(well_location.origin.value), offset=well_location.offset
)

# TODO(jbl 11-30-2023) fold this function into get_ancestor_slot_name see RSS-411
def _get_staging_slot_name(self, labware_id: str) -> str:
Expand Down
19 changes: 17 additions & 2 deletions api/src/opentrons/protocol_engine/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ class WellOrigin(str, Enum):
TOP: the top-center of the well
BOTTOM: the bottom-center of the well
CENTER: the middle-center of the well
MENISCUS: the meniscus-center of the well
"""

TOP = "top"
Expand All @@ -213,6 +214,20 @@ class WellOrigin(str, Enum):
MENISCUS = "meniscus"


class PickUpTipWellOrigin(str, Enum):
"""The origin of a PickUpTipWellLocation offset.
Props:
TOP: the top-center of the well
BOTTOM: the bottom-center of the well
CENTER: the middle-center of the well
"""

TOP = "top"
BOTTOM = "bottom"
CENTER = "center"


class DropTipWellOrigin(str, Enum):
"""The origin of a DropTipWellLocation offset.
Expand Down Expand Up @@ -260,7 +275,7 @@ class LiquidHandlingWellLocation(BaseModel):
offset: WellOffset = Field(default_factory=WellOffset)
volumeOffset: Union[float, Literal["operationVolume"]] = Field(
default=0.0,
description="""A volume of liquid, in µL, to offset the z-axis offset. When "operationVolume" is specified, this volume is pulled from the volume command parameter.""",
description="""A volume of liquid, in µL, to offset the z-axis offset. When "operationVolume" is specified, this volume is pulled from the command volume parameter.""",
)


Expand All @@ -270,7 +285,7 @@ class PickUpTipWellLocation(BaseModel):
To be used for picking up tips.
"""

origin: WellOrigin = WellOrigin.TOP
origin: PickUpTipWellOrigin = PickUpTipWellOrigin.TOP
offset: WellOffset = Field(default_factory=WellOffset)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
PickUpTipWellLocation,
WellOffset,
WellOrigin,
PickUpTipWellOrigin,
DropTipWellLocation,
DropTipWellOrigin,
)
Expand Down Expand Up @@ -266,7 +267,9 @@ def test_pick_up_tip(
absolute_point=Point(1, 2, 3),
)
).then_return(
PickUpTipWellLocation(origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1))
PickUpTipWellLocation(
origin=PickUpTipWellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)
)
)

subject.pick_up_tip(
Expand All @@ -288,7 +291,7 @@ def test_pick_up_tip(
labware_id="labware-id",
well_name="well-name",
well_location=PickUpTipWellLocation(
origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)
origin=PickUpTipWellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)
),
),
mock_engine_client.execute_command(
Expand All @@ -297,7 +300,7 @@ def test_pick_up_tip(
labwareId="labware-id",
wellName="well-name",
wellLocation=PickUpTipWellLocation(
origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)
origin=PickUpTipWellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)
),
)
),
Expand Down Expand Up @@ -620,14 +623,10 @@ def test_blow_out_to_well(
)

decoy.when(
mock_engine_client.state.geometry.get_relative_liquid_handling_well_location(
mock_engine_client.state.geometry.get_relative_well_location(
labware_id="123abc", well_name="my cool well", absolute_point=Point(1, 2, 3)
)
).then_return(
LiquidHandlingWellLocation(
origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)
)
)
).then_return(WellLocation(origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)))

subject.blow_out(location=location, well_core=well_core, in_place=False)

Expand All @@ -646,7 +645,7 @@ def test_blow_out_to_well(
pipetteId="abc123",
labwareId="123abc",
wellName="my cool well",
wellLocation=LiquidHandlingWellLocation(
wellLocation=WellLocation(
origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)
),
flowRate=6.7,
Expand Down
6 changes: 2 additions & 4 deletions api/tests/opentrons/protocol_engine/commands/test_blow_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from opentrons.types import Point
from opentrons.protocol_engine import (
LiquidHandlingWellLocation,
WellLocation,
WellOrigin,
WellOffset,
DeckPoint,
Expand Down Expand Up @@ -38,9 +38,7 @@ async def test_blow_out_implementation(
pipetting=pipetting,
)

location = LiquidHandlingWellLocation(
origin=WellOrigin.BOTTOM, offset=WellOffset(x=0, y=0, z=1)
)
location = WellLocation(origin=WellOrigin.BOTTOM, offset=WellOffset(x=0, y=0, z=1))

data = BlowOutParams(
pipetteId="pipette-id",
Expand Down
4 changes: 2 additions & 2 deletions api/tests/opentrons/protocol_engine/state/command_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,15 @@ def create_blow_out_command(
flow_rate: float,
labware_id: str = "labware-id",
well_name: str = "A1",
well_location: Optional[LiquidHandlingWellLocation] = None,
well_location: Optional[WellLocation] = None,
destination: DeckPoint = DeckPoint(x=0, y=0, z=0),
) -> cmd.BlowOut:
"""Get a completed BlowOut command."""
params = cmd.BlowOutParams(
pipetteId=pipette_id,
labwareId=labware_id,
wellName=well_name,
wellLocation=well_location or LiquidHandlingWellLocation(),
wellLocation=well_location or WellLocation(),
flowRate=flow_rate,
)
result = cmd.BlowOutResult(position=destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
pipetteId="pipette-id-1",
labwareId="labware-id-2",
wellName="A1",
wellLocation=LiquidHandlingWellLocation(
wellLocation=WellLocation(
origin=WellOrigin.BOTTOM,
offset=WellOffset(x=0, y=0, z=7.89),
),
Expand Down
62 changes: 34 additions & 28 deletions shared-data/command/schemas/10.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"definitions": {
"WellOrigin": {
"title": "WellOrigin",
"description": "Origin of WellLocation offset.\n\nProps:\n TOP: the top-center of the well\n BOTTOM: the bottom-center of the well\n CENTER: the middle-center of the well",
"description": "Origin of WellLocation offset.\n\nProps:\n TOP: the top-center of the well\n BOTTOM: the bottom-center of the well\n CENTER: the middle-center of the well\n MENISCUS: the meniscus-center of the well",
"enum": ["top", "bottom", "center", "meniscus"],
"type": "string"
},
Expand Down Expand Up @@ -344,7 +344,7 @@
},
"volumeOffset": {
"title": "Volumeoffset",
"description": "A volume of liquid, in \u00b5L, to offset the z-axis offset. When \"operationVolume\" is specified, this volume is pulled from the volume command parameter.",
"description": "A volume of liquid, in \u00b5L, to offset the z-axis offset. When \"operationVolume\" is specified, this volume is pulled from the command volume parameter.",
"default": 0.0,
"anyOf": [
{
Expand Down Expand Up @@ -933,6 +933,30 @@
},
"required": ["params"]
},
"WellLocation": {
"title": "WellLocation",
"description": "A relative location in reference to a well's location.",
"type": "object",
"properties": {
"origin": {
"default": "top",
"allOf": [
{
"$ref": "#/definitions/WellOrigin"
}
]
},
"offset": {
"$ref": "#/definitions/WellOffset"
},
"volumeOffset": {
"title": "Volumeoffset",
"description": "A volume of liquid, in \u00b5L, to offset the z-axis offset.",
"default": 0.0,
"type": "number"
}
}
},
"BlowOutParams": {
"title": "BlowOutParams",
"description": "Payload required to blow-out a specific well.",
Expand All @@ -953,7 +977,7 @@
"description": "Relative well location at which to perform the operation",
"allOf": [
{
"$ref": "#/definitions/LiquidHandlingWellLocation"
"$ref": "#/definitions/WellLocation"
}
]
},
Expand Down Expand Up @@ -2019,30 +2043,6 @@
},
"required": ["params"]
},
"WellLocation": {
"title": "WellLocation",
"description": "A relative location in reference to a well's location.",
"type": "object",
"properties": {
"origin": {
"default": "top",
"allOf": [
{
"$ref": "#/definitions/WellOrigin"
}
]
},
"offset": {
"$ref": "#/definitions/WellOffset"
},
"volumeOffset": {
"title": "Volumeoffset",
"description": "A volume of liquid, in \u00b5L, to offset the z-axis offset.",
"default": 0.0,
"type": "number"
}
}
},
"MoveToWellParams": {
"title": "MoveToWellParams",
"description": "Payload required to move a pipette to a specific well.",
Expand Down Expand Up @@ -2448,6 +2448,12 @@
},
"required": ["params"]
},
"PickUpTipWellOrigin": {
"title": "PickUpTipWellOrigin",
"description": "The origin of a PickUpTipWellLocation offset.\n\nProps:\n TOP: the top-center of the well\n BOTTOM: the bottom-center of the well\n CENTER: the middle-center of the well",
"enum": ["top", "bottom", "center"],
"type": "string"
},
"PickUpTipWellLocation": {
"title": "PickUpTipWellLocation",
"description": "A relative location in reference to a well's location.\n\nTo be used for picking up tips.",
Expand All @@ -2457,7 +2463,7 @@
"default": "top",
"allOf": [
{
"$ref": "#/definitions/WellOrigin"
"$ref": "#/definitions/PickUpTipWellOrigin"
}
]
},
Expand Down

0 comments on commit 38235fe

Please sign in to comment.