Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): change liquid_probe to respect min well height #15488

Merged
merged 12 commits into from
Jun 26, 2024
Prev Previous commit
Next Next commit
lint
  • Loading branch information
aaron-kulkarni committed Jun 24, 2024
commit 1c40bd39e4ffdd501760c67c50910f601f9a0715
34 changes: 18 additions & 16 deletions api/src/opentrons/protocol_engine/state/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,24 +424,26 @@ def get_well_min_height(self, labware_id: str, well_name: str) -> float:
Returns:
A single float representing the distance, in millimeters.
"""
well_definition = self.get_definition(labware_id)
default_val = 0
try:
height_reqs = well_definition.liquidProbeParameters.minimumHeight
if len(height_reqs) == 0:
return default_val
if len(height_reqs) == 1:
return height_reqs[0].value
for entry in height_reqs:
if well_name in entry.applicableWells:
return entry.value
if (
entry.applicableWells == []
): # A "custom" default value will have "applicableWells" set to []
default_val = entry.value
labware_definition = self.get_definition(labware_id)
default_val = 0.0
if (
labware_definition.liquidProbeParameters is None
or labware_definition.liquidProbeParameters.minimumHeight is None
):
return default_val
except AttributeError as e: # will occur when well does not have liquidProbeParameters
height_reqs = labware_definition.liquidProbeParameters.minimumHeight
if len(height_reqs) == 0:
return default_val
if len(height_reqs) == 1:
return float(height_reqs[0]["value"])
for entry in height_reqs:
if well_name in entry["applicableWells"]:
return float(entry["value"])
if (
entry["applicableWells"] == []
): # A "custom" default value will have "applicableWells" set to []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it? or will it have applicableWells set to a list of all the wells?

default_val = float(entry["value"])
return default_val

def get_well_definition(
self,
Expand Down
Loading