Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions api/src/opentrons/protocol_api/core/engine/well.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,19 @@ def get_liquid_volume(self) -> LiquidTrackingType:
return self._engine_client.state.geometry.get_current_well_volume(
labware_id=labware_id, well_name=well_name
)

def height_from_volume(self, volume: LiquidTrackingType) -> LiquidTrackingType:
"""Return the height in a well corresponding to a given volume."""
labware_id = self.labware_id
well_name = self._name
return self._engine_client.state.geometry.get_well_height_at_volume(
labware_id=labware_id, well_name=well_name, volume=volume
)

def volume_from_height(self, height: LiquidTrackingType) -> LiquidTrackingType:
"""Return the volume contained in a well at any height."""
labware_id = self.labware_id
well_name = self._name
return self._engine_client.state.geometry.get_well_volume_at_height(
labware_id=labware_id, well_name=well_name, height=height
)
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ def get_liquid_volume(self) -> LiquidTrackingType:
"""Get the current well volume."""
return 0.0

def height_from_volume(self, volume: LiquidTrackingType) -> LiquidTrackingType:
"""Return the height in a well corresponding to a given volume."""
return 0.0

def volume_from_height(self, height: LiquidTrackingType) -> LiquidTrackingType:
"""Return the volume contained in a well at any height."""
return 0.0

# TODO(mc, 2022-10-28): is this used and/or necessary?
def __repr__(self) -> str:
"""Use the well's display name as its repr."""
Expand Down
8 changes: 8 additions & 0 deletions api/src/opentrons/protocol_api/core/well.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,13 @@ def current_liquid_height(self) -> LiquidTrackingType:
def get_liquid_volume(self) -> LiquidTrackingType:
"""Get the current volume within a well."""

@abstractmethod
def height_from_volume(self, volume: LiquidTrackingType) -> LiquidTrackingType:
"""Return the height in a well corresponding to a given volume."""

@abstractmethod
def volume_from_height(self, height: LiquidTrackingType) -> LiquidTrackingType:
"""Return the volume contained in a well at any height."""


WellCoreType = TypeVar("WellCoreType", bound=AbstractWellCore)
10 changes: 10 additions & 0 deletions api/src/opentrons/protocol_api/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,16 @@ def current_liquid_volume(self) -> LiquidTrackingType:
"""Get the current liquid volume in a well."""
return self._core.get_liquid_volume()

@requires_version(2, 24)
def volume_from_height(self, height: LiquidTrackingType) -> LiquidTrackingType:
"""Return the volume contained in a well at any height."""
return self._core.volume_from_height(height)

@requires_version(2, 24)
def height_from_volume(self, volume: LiquidTrackingType) -> LiquidTrackingType:
"""Return the height in a well corresponding to a given volume."""
return self._core.height_from_volume(volume)

@requires_version(2, 21)
def estimate_liquid_height_after_pipetting(
self,
Expand Down