Skip to content

Commit

Permalink
update meniscus methods to utilize volume
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoegenburg committed Sep 20, 2024
1 parent 5b95da5 commit aeae324
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
21 changes: 8 additions & 13 deletions api/src/opentrons/protocol_api/core/engine/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def set_default_speed(self, speed: float) -> None:

def aspirate(
self,
location: Union[Location, WellLocation],
location: Location,
well_core: Optional[WellCore],
volume: float,
rate: float,
Expand All @@ -129,7 +129,6 @@ def aspirate(
"""
if well_core is None:
if not in_place:
assert isinstance(location, Location)
self._engine_client.execute_command(
cmd.MoveToCoordinatesParams(
pipetteId=self._pipette_id,
Expand All @@ -151,17 +150,14 @@ def aspirate(
else:
well_name = well_core.get_name()
labware_id = well_core.labware_id
if isinstance(location, WellLocation):
well_location = location
location = Location(well_core.get_meniscus(z_offset=location.offset.z))
else:
well_location = (
self._engine_client.state.geometry.get_relative_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,
)
)
deck_conflict.check_safe_for_pipette_movement(
engine_state=self._engine_client.state,
pipette_id=self._pipette_id,
Expand All @@ -180,7 +176,6 @@ def aspirate(
)
)

assert isinstance(location, Location)
self._protocol_core.set_last_location(location=location, mount=self.get_mount())

def dispense(
Expand Down
6 changes: 4 additions & 2 deletions api/src/opentrons/protocol_api/core/engine/well.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from opentrons_shared_data.labware.constants import WELL_NAME_PATTERN

from opentrons.protocol_engine import WellLocation, WellOrigin, WellOffset
from opentrons.protocol_engine import WellLocation, WellOrigin, WellOffset, WellVolumeOffset
from opentrons.protocol_engine import commands as cmd
from opentrons.protocol_engine.clients import SyncClient as EngineClient
from opentrons.protocols.api_support.util import UnsupportedAPIError
Expand Down Expand Up @@ -126,15 +126,17 @@ def get_center(self) -> Point:
well_location=WellLocation(origin=WellOrigin.CENTER),
)

def get_meniscus(self, z_offset: float) -> Point:
def get_meniscus(self, z_offset: float, operation_volume: Optional[float] = None) -> Point:
"""Get the coordinate of the well's meniscus, with a z-offset."""
return self._engine_client.state.geometry.get_well_position(
well_name=self._name,
labware_id=self._labware_id,
well_location=WellLocation(
origin=WellOrigin.MENISCUS,
offset=WellOffset(x=0, y=0, z=z_offset),
volumeOffset=WellVolumeOffset(volumeOffset="operationVolume"),
),
operational_volume=operation_volume,
)

def load_liquid(
Expand Down
9 changes: 4 additions & 5 deletions api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def aspirate(
command=cmds.aspirate(
instrument=self,
volume=c_vol,
location=move_to_location, # need a Location?!
location=move_to_location,
flow_rate=flow_rate,
rate=rate,
),
Expand Down Expand Up @@ -2141,10 +2141,9 @@ def _determine_aspirate_move_to_location(
offset_from_meniscus_mm=offset_from_meniscus_mm,
volume=volume,
):
move_to_location = WellLocation(
origin=WellOrigin.MENISCUS,
offset=WellOffset(x=0, y=0, z=offset_from_meniscus_mm),
# volumeOffset=WellVolumeOffset(volumeOffset="operationVolume"),
move_to_location = target.well.meniscus(
z=offset_from_meniscus_mm,
operation_volume=volume,
)
if isinstance(target, validation.PointTarget):
move_to_location = target.location
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_api/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ def center(self) -> Location:
return Location(self._core.get_center(), self)

@requires_version(2, 21)
def meniscus(self, z: float = 0.0) -> Location:
def meniscus(self, z: float = 0.0, operation_volume: Optional[float] = None) -> Location:
"""
:param z: An offset on the z-axis, in mm. Positive offsets are higher and
negative offsets are lower.
:return: A :py:class:`~opentrons.types.Location` corresponding to the
absolute position of the meniscus-center of the well, plus the ``z`` offset
(if specified).
"""
return Location(self._core.get_meniscus(z_offset=z), self)
return Location(self._core.get_meniscus(z_offset=z, operation_volume=operation_volume), self)

@requires_version(2, 8)
def from_center_cartesian(self, x: float, y: float, z: float) -> Point:
Expand Down

0 comments on commit aeae324

Please sign in to comment.