Skip to content

Commit

Permalink
fix minimum lld height func
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Jan 28, 2025
1 parent 74622ed commit 136a10a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
22 changes: 19 additions & 3 deletions api/src/opentrons/protocol_api/core/engine/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Optional, TYPE_CHECKING, cast, Union, List, Tuple, NamedTuple, Dict
from typing import Optional, TYPE_CHECKING, cast, Union, List, Tuple, NamedTuple
from opentrons.types import Location, Mount, NozzleConfigurationType, NozzleMapInterface
from opentrons.hardware_control import SyncHardwareAPI
from opentrons.hardware_control.dev_types import PipetteDict
Expand Down Expand Up @@ -1344,10 +1344,26 @@ def detect_liquid_presence(self, well_core: WellCore, loc: Location) -> bool:

return result.z_position is not None

def get_lld_settings(self) -> Optional[Dict[str, Dict[str, float]]]:
return self._engine_client.state.pipettes.get_pipette_lld_settings(
def get_minimum_liquid_sense_height(self) -> float:
attached_tip = self._engine_client.state.pipettes.get_attached_tip(
self._pipette_id
)
if attached_tip:
tip_volume = attached_tip.volume
else:
raise TipNotAttachedError(
"Need to have a tip attached for liquid-sense operations."
)
lld_settings = self._engine_client.state.pipettes.get_pipette_lld_settings(
pipette_id=self.pipette_id
)
if lld_settings:
lld_min_height_for_tip_attached = lld_settings[f"t{tip_volume}"][
"minHeight"
]
return lld_min_height_for_tip_attached
else:
raise ValueError("liquid-level detection settings not found.")

def liquid_probe_with_recovery(self, well_core: WellCore, loc: Location) -> None:
labware_id = well_core.labware_id
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_api/core/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from abc import abstractmethod, ABC
from typing import Any, Generic, Optional, TypeVar, Union, List, Tuple, Dict
from typing import Any, Generic, Optional, TypeVar, Union, List, Tuple

from opentrons import types
from opentrons.hardware_control.dev_types import PipetteDict
Expand Down Expand Up @@ -219,7 +219,7 @@ def get_available_volume(self) -> float:
...

@abstractmethod
def get_lld_settings(self) -> Optional[Dict[str, Dict[str, float]]]:
def get_minimum_liquid_sense_height(self) -> float:
...

@abstractmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import logging
from typing import TYPE_CHECKING, Optional, Union, List, Tuple, Dict
from typing import TYPE_CHECKING, Optional, Union, List, Tuple

from opentrons import types
from opentrons.hardware_control import CriticalPoint
Expand Down Expand Up @@ -638,8 +638,8 @@ def nozzle_configuration_valid_for_lld(self) -> bool:
"""Check if the nozzle configuration currently supports LLD."""
return False

def get_lld_settings(self) -> Optional[Dict[str, Dict[str, float]]]:
return {}
def get_minimum_liquid_sense_height(self) -> float:
return 0.0

def estimate_liquid_height(
self,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import logging
from typing import TYPE_CHECKING, Optional, Union, List, Tuple, Dict
from typing import TYPE_CHECKING, Optional, Union, List, Tuple

from opentrons import types
from opentrons.hardware_control.dev_types import PipetteDict
Expand Down Expand Up @@ -558,8 +558,8 @@ def nozzle_configuration_valid_for_lld(self) -> bool:
"""Check if the nozzle configuration currently supports LLD."""
return False

def get_lld_settings(self) -> Optional[Dict[str, Dict[str, float]]]:
return {}
def get_minimum_liquid_sense_height(self) -> float:
return 0.0

def estimate_liquid_height(
self,
Expand Down
10 changes: 3 additions & 7 deletions api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,9 @@ def default_speed(self, speed: float) -> None:
self._core.set_default_speed(speed)

@requires_version(2, 21)
def pipette_min_lld_height(self, tip_volume: int) -> float:
lld_settings = self._core.get_lld_settings()
if lld_settings:
tip_min_height = lld_settings[f"t{tip_volume}"]["minHeight"]
return tip_min_height
else:
raise ValueError("liquid-level detection settings not found.")
def get_minimum_liquid_sense_height(self) -> float:
"""Get the minimum allowed height for liquid-level detection."""
return self._core.get_minimum_liquid_sense_height()

@requires_version(2, 0)
def aspirate(
Expand Down

0 comments on commit 136a10a

Please sign in to comment.