Skip to content

Commit

Permalink
change snake_case mm_to_edge to mm_from_edge
Browse files Browse the repository at this point in the history
  • Loading branch information
jbleon95 committed Jan 21, 2025
1 parent 316efeb commit 9e11bfd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
26 changes: 13 additions & 13 deletions api/src/opentrons/protocol_api/_liquid_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class TouchTipProperties:

_enabled: bool
_z_offset: Optional[float]
_mm_to_edge: Optional[float]
_mm_from_edge: Optional[float]
_speed: Optional[float]

@property
Expand All @@ -137,10 +137,10 @@ def enabled(self) -> bool:
def enabled(self, enable: bool) -> None:
validated_enable = validation.ensure_boolean(enable)
if validated_enable and (
self._z_offset is None or self._mm_to_edge is None or self._speed is None
self._z_offset is None or self._mm_from_edge is None or self._speed is None
):
raise ValueError(
"z_offset, mm_to_edge and speed must be set before enabling touch tip."
"z_offset, mm_from_edge and speed must be set before enabling touch tip."
)
self._enabled = validated_enable

Expand All @@ -154,13 +154,13 @@ def z_offset(self, new_offset: float) -> None:
self._z_offset = validated_offset

@property
def mm_to_edge(self) -> Optional[float]:
return self._mm_to_edge
def mm_from_edge(self) -> Optional[float]:
return self._mm_from_edge

@mm_to_edge.setter
def mm_to_edge(self, new_mm: float) -> None:
@mm_from_edge.setter
def mm_from_edge(self, new_mm: float) -> None:
validated_mm = validation.ensure_float(new_mm)
self._mm_to_edge = validated_mm
self._mm_from_edge = validated_mm

@property
def speed(self) -> Optional[float]:
Expand All @@ -175,12 +175,12 @@ def _get_shared_data_params(self) -> Optional[SharedDataTouchTipParams]:
"""Get the touch tip params in schema v1 shape."""
if (
self._z_offset is not None
and self._mm_to_edge is not None
and self._mm_from_edge is not None
and self._speed is not None
):
return SharedDataTouchTipParams(
zOffset=self._z_offset,
mmFromEdge=self._mm_to_edge,
mmFromEdge=self._mm_from_edge,
speed=self._speed,
)
else:
Expand Down Expand Up @@ -591,16 +591,16 @@ def _build_touch_tip_properties(
) -> TouchTipProperties:
if touch_tip_properties.params is not None:
z_offset = touch_tip_properties.params.zOffset
mm_to_edge = touch_tip_properties.params.mmFromEdge
mm_from_edge = touch_tip_properties.params.mmFromEdge
speed = touch_tip_properties.params.speed
else:
z_offset = None
mm_to_edge = None
mm_from_edge = None
speed = None
return TouchTipProperties(
_enabled=touch_tip_properties.enable,
_z_offset=z_offset,
_mm_to_edge=mm_to_edge,
_mm_from_edge=mm_from_edge,
_speed=speed,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@ def retract_after_aspiration(self, volume: float) -> None:
assert (
touch_tip_props.speed is not None
and touch_tip_props.z_offset is not None
and touch_tip_props.mm_to_edge is not None
and touch_tip_props.mm_from_edge is not None
)
self._instrument.touch_tip(
location=retract_location,
well_core=self._target_well,
radius=1,
z_offset=touch_tip_props.z_offset,
speed=touch_tip_props.speed,
mm_from_edge=touch_tip_props.mm_to_edge,
mm_from_edge=touch_tip_props.mm_from_edge,
)
self._instrument.move_to(
location=retract_location,
Expand Down Expand Up @@ -458,7 +458,7 @@ def _do_touch_tip_and_air_gap(
assert (
touch_tip_props.speed is not None
and touch_tip_props.z_offset is not None
and touch_tip_props.mm_to_edge is not None
and touch_tip_props.mm_from_edge is not None
)
# TODO:, check that when blow out is a non-dest-well,
# whether the touch tip params from transfer props should be used for
Expand All @@ -471,7 +471,7 @@ def _do_touch_tip_and_air_gap(
radius=1,
z_offset=touch_tip_props.z_offset,
speed=touch_tip_props.speed,
mm_from_edge=touch_tip_props.mm_to_edge,
mm_from_edge=touch_tip_props.mm_from_edge,
)
except TouchTipDisabledError:
# TODO: log a warning
Expand Down
18 changes: 9 additions & 9 deletions api/tests/opentrons/protocol_api/test_liquid_class_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_build_aspirate_settings() -> None:
}
assert aspirate_properties.retract.touch_tip.enabled is True
assert aspirate_properties.retract.touch_tip.z_offset == 2
assert aspirate_properties.retract.touch_tip.mm_to_edge == 1
assert aspirate_properties.retract.touch_tip.mm_from_edge == 1
assert aspirate_properties.retract.touch_tip.speed == 50
assert aspirate_properties.retract.delay.enabled is True
assert aspirate_properties.retract.delay.duration == 1
Expand Down Expand Up @@ -87,8 +87,8 @@ def test_aspirate_settings_overrides() -> None:
assert aspirate_properties.retract.touch_tip.enabled is False
aspirate_properties.retract.touch_tip.z_offset = 2.34
assert aspirate_properties.retract.touch_tip.z_offset == 2.34
aspirate_properties.retract.touch_tip.mm_to_edge = 4.56
assert aspirate_properties.retract.touch_tip.mm_to_edge == 4.56
aspirate_properties.retract.touch_tip.mm_from_edge = 4.56
assert aspirate_properties.retract.touch_tip.mm_from_edge == 4.56
aspirate_properties.retract.touch_tip.speed = 501
assert aspirate_properties.retract.touch_tip.speed == 501
aspirate_properties.retract.delay.enabled = False
Expand Down Expand Up @@ -140,7 +140,7 @@ def test_build_single_dispense_settings() -> None:
}
assert single_dispense_properties.retract.touch_tip.enabled is True
assert single_dispense_properties.retract.touch_tip.z_offset == 2
assert single_dispense_properties.retract.touch_tip.mm_to_edge == 1
assert single_dispense_properties.retract.touch_tip.mm_from_edge == 1
assert single_dispense_properties.retract.touch_tip.speed == 50
assert single_dispense_properties.retract.blowout.enabled is True
assert single_dispense_properties.retract.blowout.location is not None
Expand Down Expand Up @@ -200,8 +200,8 @@ def test_single_dispense_settings_override() -> None:
assert single_dispense_properties.retract.touch_tip.enabled is False
single_dispense_properties.retract.touch_tip.z_offset = 2.34
assert single_dispense_properties.retract.touch_tip.z_offset == 2.34
single_dispense_properties.retract.touch_tip.mm_to_edge = 1.11
assert single_dispense_properties.retract.touch_tip.mm_to_edge == 1.11
single_dispense_properties.retract.touch_tip.mm_from_edge = 1.11
assert single_dispense_properties.retract.touch_tip.mm_from_edge == 1.11
single_dispense_properties.retract.touch_tip.speed = 543
assert single_dispense_properties.retract.touch_tip.speed == 543
single_dispense_properties.retract.blowout.enabled = False
Expand Down Expand Up @@ -259,7 +259,7 @@ def test_build_multi_dispense_settings() -> None:
}
assert multi_dispense_properties.retract.touch_tip.enabled is True
assert multi_dispense_properties.retract.touch_tip.z_offset == 2
assert multi_dispense_properties.retract.touch_tip.mm_to_edge == 1
assert multi_dispense_properties.retract.touch_tip.mm_from_edge == 1
assert multi_dispense_properties.retract.touch_tip.speed == 50
assert multi_dispense_properties.retract.blowout.enabled is False
assert multi_dispense_properties.retract.blowout.location is None
Expand Down Expand Up @@ -318,8 +318,8 @@ def test_multi_dispense_settings_override() -> None:
assert multi_dispense_properties.retract.touch_tip.enabled is False
multi_dispense_properties.retract.touch_tip.z_offset = 2.34
assert multi_dispense_properties.retract.touch_tip.z_offset == 2.34
multi_dispense_properties.retract.touch_tip.mm_to_edge = 1.11
assert multi_dispense_properties.retract.touch_tip.mm_to_edge == 1.11
multi_dispense_properties.retract.touch_tip.mm_from_edge = 1.11
assert multi_dispense_properties.retract.touch_tip.mm_from_edge == 1.11
multi_dispense_properties.retract.touch_tip.speed = 543
assert multi_dispense_properties.retract.touch_tip.speed == 543
multi_dispense_properties.retract.blowout.enabled = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ async def test_touch_tip_implementation(
)


async def test_touch_tip_implementation_with_mm_to_edge(
async def test_touch_tip_implementation_with_mm_from_edge(
decoy: Decoy,
mock_state_view: StateView,
mock_movement_handler: MovementHandler,
Expand Down

0 comments on commit 9e11bfd

Please sign in to comment.