Skip to content

Commit

Permalink
updates to relax WellLocation contraints based on PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoegenburg committed Oct 11, 2024
1 parent 05a075c commit 97858d8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 28 deletions.
5 changes: 0 additions & 5 deletions api/src/opentrons/protocol_engine/commands/aspirate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
SuccessData,
)
from ..errors.error_occurrence import ErrorOccurrence
from ..errors import InvalidAspirateLocationError

from opentrons.hardware_control import HardwareControlAPI

Expand Down Expand Up @@ -116,10 +115,6 @@ async def execute(self, params: AspirateParams) -> _ExecuteReturn:
well_location = params.wellLocation
if well_location.origin == WellOrigin.MENISCUS:
well_location.volumeOffset = "operationVolume"
if well_location.offset.z > 0.0:
raise InvalidAspirateLocationError(
f"Cannot specify a meniscus-relative Aspirate with a positive z-offset (specified {well_location.offset.z})"
)

position = await self._movement.move_to_well(
pipette_id=pipette_id,
Expand Down
2 changes: 0 additions & 2 deletions api/src/opentrons/protocol_engine/commands/dispense.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ async def execute(self, params: DispenseParams) -> _ExecuteReturn:
well_name = params.wellName
volume = params.volume

if well_location.origin == WellOrigin.MENISCUS:
well_location.volumeOffset = 0.0
self._state_view.geometry.validate_dispense_volume_into_well(
labware_id=labware_id,
well_name=well_name,
Expand Down
16 changes: 0 additions & 16 deletions api/src/opentrons/protocol_engine/errors/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,19 +1095,3 @@ def __init__(
) -> None:
"""Build an OperationLocationNotInWellError."""
super().__init__(ErrorCodes.GENERAL_ERROR, message, details, wrapping)


class InvalidAspirateLocationError(ProtocolEngineError):
"""Raised when a meniscus-relative Aspirate's z-offset is greater than 0.0.
This would result in aspiration above the meniscus (in air), which should not be allowed.
"""

def __init__(
self,
message: Optional[str] = None,
details: Optional[Dict[str, Any]] = None,
wrapping: Optional[Sequence[EnumeratedError]] = None,
) -> None:
"""Build an InvalidAspirateLocationError."""
super().__init__(ErrorCodes.GENERAL_ERROR, message, details, wrapping)
13 changes: 8 additions & 5 deletions api/src/opentrons/protocol_engine/state/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,18 +437,21 @@ def validate_well_position(
Primarily this checks if there is not enough liquid in a well to do meniscus-relative static aspiration.
"""
invalid = False
if well_location.origin == WellOrigin.MENISCUS:
assert pipette_id is not None
lld_min_height = self._pipettes.get_current_tip_lld_settings(
pipette_id=pipette_id
)
if z_offset < lld_min_height:
invalid = True
if isinstance(well_location, PickUpTipWellLocation):
raise OperationLocationNotInWellError(
f"Specifying {well_location.origin} with an offset of {well_location.offset} results in an operation location that could be below the bottom of the well"
)
else:
raise OperationLocationNotInWellError(
f"Specifying {well_location.origin} with an offset of {well_location.offset} and a volume offset of {well_location.volumeOffset} results in an operation location that could be below the bottom of the well"
)
elif z_offset < 0:
invalid = True

if invalid:
if isinstance(well_location, PickUpTipWellLocation):
raise OperationLocationNotInWellError(
f"Specifying {well_location.origin} with an offset of {well_location.offset} results in an operation location below the bottom of the well"
Expand Down
1 change: 1 addition & 0 deletions api/src/opentrons/protocol_engine/state/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ def get_well_geometry(
self, labware_id: str, well_name: Optional[str] = None
) -> InnerWellGeometry:
"""Get a well's inner geometry by labware and well name."""
# TODO(pbm, 10-11-24): wordsmith this error
labware_def = self.get_definition(labware_id)
if labware_def.innerLabwareGeometry is None:
raise errors.InvalidWellDefinitionError(
Expand Down

0 comments on commit 97858d8

Please sign in to comment.