diff --git a/api/src/opentrons/protocol_engine/state/frustum_helpers.py b/api/src/opentrons/protocol_engine/state/frustum_helpers.py index 95753e4f4e7d..604db4bfcf56 100644 --- a/api/src/opentrons/protocol_engine/state/frustum_helpers.py +++ b/api/src/opentrons/protocol_engine/state/frustum_helpers.py @@ -230,39 +230,39 @@ def get_well_volumetric_capacity( for segment in sorted_well: section_volume: Optional[float] = None - if segment.shape == "spherical": + if segment["shape"] == "spherical": if sorted_well[0] != segment: raise InvalidWellDefinitionError( "spherical segment must only be at the bottom of a well." ) - target_height=segment.topHeight, - radius_of_curvature=segment.radiusOfCurvature, section_volume = _volume_from_height_spherical( + target_height=segment["topHeight"], + radius_of_curvature=segment["radiusOfCurvature"], ) - elif segment.shape == "rectangular": - section_height = segment.topHeight - segment.bottomHeight + elif segment["shape"] == "rectangular": + section_height = segment["topHeight"] - segment["bottomHeight"] section_volume = _volume_from_height_rectangular( target_height=section_height, - bottom_length=segment.bottomYDimension, - bottom_width=segment.bottomXDimension, - top_length=segment.topYDimension, - top_width=segment.topXDimension, + bottom_length=segment["bottomYDimension"], + bottom_width=segment["bottomXDimension"], + top_length=segment["topYDimension"], + top_width=segment["topXDimension"], total_frustum_height=section_height, ) - elif segment.shape == "circular": - section_height = segment.topHeight - segment.bottomHeight + elif segment["shape"] == "circular": + section_height = segment["topHeight"] - segment["bottomHeight"] section_volume = _volume_from_height_circular( target_height=section_height, total_frustum_height=section_height, - bottom_radius=(segment.bottomDiameter / 2), - top_radius=(segment.topDiameter / 2), + bottom_radius=(segment["bottomDiameter"] / 2), + top_radius=(segment["topDiameter"] / 2), ) # TODO: implement volume calculations for truncated circular and rounded rectangular segments if not section_volume: raise NotImplementedError( - f"volume calculation for shape: {segment.shape} not yet implemented." + f"volume calculation for shape: {segment['shape']} not yet implemented." ) - well_volume.append((segment.topHeight, section_volume)) + well_volume.append((segment["topHeight"], section_volume)) return well_volume diff --git a/api/tests/opentrons/protocols/geometry/test_frustum_helpers.py b/api/tests/opentrons/protocols/geometry/test_frustum_helpers.py index 98a5f4e91008..48763fa9975c 100644 --- a/api/tests/opentrons/protocols/geometry/test_frustum_helpers.py +++ b/api/tests/opentrons/protocols/geometry/test_frustum_helpers.py @@ -53,7 +53,12 @@ def fake_frusta() -> List[List[Any]]: topHeight=1.0, bottomHeight=1.0, ), - SphericalSegment(shape="spherical", radiusOfCurvature=4.0, topHeight=1.0), + SphericalSegment( + shape="spherical", + radiusOfCurvature=4.0, + topHeight=1.0, + bottomHeight=0.0, + ), ] ) frusta.append( @@ -112,11 +117,23 @@ def fake_frusta() -> List[List[Any]]: topHeight=3.0, bottomHeight=2.0, ), - SphericalSegment(shape="spherical", radiusOfCurvature=3.5, topHeight=2.0), + SphericalSegment( + shape="spherical", + radiusOfCurvature=3.5, + topHeight=2.0, + bottomHeight=0.0, + ), ] ) frusta.append( - [SphericalSegment(shape="spherical", radiusOfCurvature=4.0, topHeight=3.0)] + [ + SphericalSegment( + shape="spherical", + radiusOfCurvature=4.0, + topHeight=3.0, + bottomHeight=0.0, + ) + ] ) frusta.append( [ @@ -129,7 +146,12 @@ def fake_frusta() -> List[List[Any]]: topHeight=3.5, bottomHeight=1.5, ), - SphericalSegment(shape="spherical", radiusOfCurvature=4.0, topHeight=1.5), + SphericalSegment( + shape="spherical", + radiusOfCurvature=4.0, + topHeight=1.5, + bottomHeight=0.0, + ), ] ) return frusta diff --git a/shared-data/python/opentrons_shared_data/labware/types.py b/shared-data/python/opentrons_shared_data/labware/types.py index a491b67bbc94..d975640cc98e 100644 --- a/shared-data/python/opentrons_shared_data/labware/types.py +++ b/shared-data/python/opentrons_shared_data/labware/types.py @@ -126,6 +126,7 @@ class SphericalSegment(TypedDict): shape: Spherical radiusOfCurvature: float topHeight: float + bottomHeight: Literal[0.0] = 0.0 class CircularFrustum(TypedDict):