Skip to content

Commit

Permalink
pull hemisphere out
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Aug 14, 2024
1 parent 8dd5c20 commit cd01d61
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 46 deletions.
37 changes: 23 additions & 14 deletions api/tests/opentrons/protocol_runner/test_json_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
WellDefinition,
BoundedSection,
TopCrossSection,
InnerLabwareGeometry,
Hemisphere,
)
from opentrons_shared_data.protocol.models import (
protocol_schema_v6,
Expand Down Expand Up @@ -687,23 +689,30 @@ def _load_labware_definition_data() -> LabwareDefinition:
},
dimensions=Dimensions(yDimension=85.5, zDimension=100, xDimension=127.75),
cornerOffsetFromSlot=CornerOffsetFromSlot(x=0, y=0, z=0),
innerWellGeometry=[
BoundedSection(
geometry=TopCrossSection(
shape="hemisphere",
diameter=25,
innerWellGeometry=InnerLabwareGeometry(
frusta=[
BoundedSection(
geometry=TopCrossSection(
shape="rectangular",
xDimension=7.6,
yDimension=8.5,
),
top_height=45,
),
top_height=10,
),
BoundedSection(
geometry=TopCrossSection(
shape="rectangular",
xDimension=5.6,
yDimension=6.5,
BoundedSection(
geometry=TopCrossSection(
shape="rectangular",
xDimension=5.6,
yDimension=6.5,
),
top_height=20,
),
top_height=45,
],
bottom_shape=Hemisphere(
diameter=6,
depth=10,
),
],
),
brand=BrandData(brand="foo"),
metadata=Metadata(
displayName="Foo 8 Well Plate 33uL",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,33 @@ class Config:
)


class Hemisphere(BaseModel):
diameter: _NonNegativeNumber = Field(
...,
description="diameter of bottom subsection of wells",
)
depth: _NonNegativeNumber = Field(
..., description="The depth of a hemispherical bottom of a well"
)


class TopCrossSection(BaseModel):
shape: Literal["rectangular", "circular", "hemisphere"] = Field(
shape: Literal["rectangular", "circular"] = Field(
...,
description="Shape of a cross-section of a well used to determine how "
"to calculate area",
)
xDimension: Optional[_NonNegativeNumber] = Field(
None,
description="x dimension of rectangular wells",
description="x dimension of a subsection of wells",
)
yDimension: Optional[_NonNegativeNumber] = Field(
None,
description="y dimension of rectangular wells",
description="y dimension of a subsection of wells",
)
diameter: Optional[_NonNegativeNumber] = Field(
None,
description="diameter of circular wells",
description="diameter of a subsection of wells",
)


Expand Down Expand Up @@ -282,6 +292,16 @@ class Group(BaseModel):
)


class InnerLabwareGeometry(BaseModel):
frusta: List[BoundedSection] = Field(
...,
description="A list of all of the sections of the well that have a contiguous shape",
)
bottom_shape: Optional[Hemisphere] = Field(
None, description="An optional non-frustum shape at the bottom of a well"
)


class LabwareDefinition(BaseModel):
schemaVersion: Literal[1, 2] = Field(
..., description="Which schema version a labware is using"
Expand Down Expand Up @@ -356,7 +376,7 @@ class LabwareDefinition(BaseModel):
default_factory=None,
description="Force, in Newtons, with which the gripper should grip the labware.",
)
innerWellGeometry: Optional[List[BoundedSection]] = Field(
innerWellGeometry: Optional[InnerLabwareGeometry] = Field(
None,
description="A list of bounded sections describing the geometry of the inside of the wells.",
)
58 changes: 31 additions & 27 deletions shared-data/python/opentrons_shared_data/labware/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
types in this file by and large require the use of typing_extensions.
this module shouldn't be imported unless typing.TYPE_CHECKING is true.
"""
from typing import Dict, List, NewType, Union
from typing import Dict, List, NewType, Union, Optional
from typing_extensions import Literal, TypedDict


Expand Down Expand Up @@ -37,7 +37,6 @@

Circular = Literal["circular"]
Rectangular = Literal["rectangular"]
Hemisphere = Literal["hemisphere"]
WellShape = Union[Circular, Rectangular]


Expand Down Expand Up @@ -118,6 +117,35 @@ class WellGroup(TypedDict, total=False):
brand: LabwareBrandData


class CircularArea(TypedDict):
shape: Circular
diameter: float


class RectangularArea(TypedDict):
shape: Rectangular
xDimension: float
yDimension: float


TopCrossSection = Union[CircularArea, RectangularArea]


class Hemisphere(TypedDict):
diameter: float
depth: float


class BoundedSection(TypedDict):
geometry: TopCrossSection
top_height: float


class InnerLabwareGeometry(TypedDict):
frusta: List[BoundedSection]
bottom_shape: Optional[Hemisphere]


class _RequiredLabwareDefinition(TypedDict):
schemaVersion: Literal[2]
version: int
Expand All @@ -139,28 +167,4 @@ class LabwareDefinition(_RequiredLabwareDefinition, total=False):
gripperOffsets: Dict[str, GripperOffsets]
gripForce: float
gripHeightFromLabwareBottom: float


class CircularArea(TypedDict):
shape: Circular
diameter: float


class RectangularArea(TypedDict):
shape: Rectangular
xDimension: float
yDimension: float


class HemisphereDimensions(TypedDict):
shape: Hemisphere
diameter: float


# This will either be a 2-Dimensional cross-section or a hemisphere
TopCrossSection = Union[CircularArea, RectangularArea, HemisphereDimensions]


class BoundedSection(TypedDict):
geometry: TopCrossSection
top_height: float
innerWellGeometry: Optional[InnerLabwareGeometry]

0 comments on commit cd01d61

Please sign in to comment.