unitelabs.labware.math
Packages
Attributes
- Name
Number
- Type
- Value
= typing.Union[str, int, float, tuple[int, collections.abc.Sequence[int], int], decimal.Decimal]
- Description
- Name
__all__
- Type
- Value
= [ "Number", "Decimal", "is_number", "parse_number", "DecimalField", "Vector", "place", "place_standardized", "Alignment", "Direction", "mm_to_100um", "to_mm", "ul_to_100nl", "to_ul", "c_to_100c", "to_c", "Shape", "ComplexShape", "Stack", "Cuboid", "Pyramid", "Cylinder", "Cone", "ConicalFrustum", "HalfSphere", "SphericalCap", "SphericalSegment", "PyramidalFrustum" ]
- Description
Functions
is_number(value : typing.Any) -> bool
Check whether a value is of numeric type.
Parameters
- Name
value
- Type
- typing.Any
- Default
- Description
The number to check.
Response
- Type
- bool
- Description
to_mm(value : int) -> decimal.Decimal
Convert 0.1mm into mm.
Parameters
- Name
value
- Type
- int
- Default
- Description
The number in 0.1mm to convert.
Response
- Type
- decimal.Decimal
- Description
The value with unit mm.
place(
- cols : int,
- rows : int,
- item : Vector,
- boundary : Vector,
- offset : typing.Optional[Vector],
- direction,
- justify,
- align,
Calculates the location of rows x cols items around the center of the parent's plane.
Parameters
- Name
cols
- Type
- int
- Default
- Description
The number of items along the x axis.
- Name
rows
- Type
- int
- Default
- Description
The number of items along the y axis.
- Name
item
- Type
- Vector
- Default
- Description
Each item's dimension.
- Name
boundary
- Type
- Vector
- Default
- Description
The container's dimension.
- Name
offset
- Type
- typing.Optional[Vector]
- Default
- = None
- Description
Optional offset to apply to the item's location.
- Name
direction
- Type
- Default
- = COLUMN_ROW
- Description
Establishes the direction in which items are placed in the container.
- Name
justify
- Type
- Default
- = CENTER
- Description
Defines the alignment along the x-axis.
- Name
align
- Type
- Default
- = CENTER
- Description
Defines the alignment along the y-axis.
Response
to_c(value : int) -> decimal.Decimal
Convert 0.1°C into °C.
Parameters
- Name
value
- Type
- int
- Default
- Description
The number in 0.1°C to convert.
Response
- Type
- decimal.Decimal
- Description
The value with unit °C.
place_standardized(
- count : typing.Literal[96, 384, 1536],
- boundary_height : typing.Optional[Number],
- item_height : typing.Optional[Number]
Place wells on a plate according to the ANSI / SLAS microplate standard.
Parameters
- Name
count
- Type
- typing.Literal[96, 384, 1536]
- Default
- Description
The number of items to place on the resource.
- Name
boundary_height
- Type
- typing.Optional[Number]
- Default
- = None
- Description
- Name
item_height
- Type
- typing.Optional[Number]
- Default
- = None
- Description
Response
Classes
Decimal
Decimal number for fast correctly rounded decimal floating point arithmetic.
Methods
__set_name__(self, owner : type[object], name : str) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
owner
- Type
- type[object]
- Default
- Description
- Name
name
- Type
- str
- Default
- Description
__get__(self, instance : typing.Optional[object], owner : typing.Optional[type[object]]) -> decimal.Decimal
Parameters
- Name
self
- Type
- Default
- Description
- Name
instance
- Type
- typing.Optional[object]
- Default
- Description
- Name
owner
- Type
- typing.Optional[type[object]]
- Default
- Description
Response
- Type
- decimal.Decimal
- Description
Attributes
- Name
_default_value
- Type
- Value
= default
- Description
- Name
_attr_name
- Type
- Value
= ''
- Description
DecimalField
- Bases
- marshmallow.fields.Field
Methods
_serialize(
- self,
- value : typing.Any,
- attr : typing.Optional[str],
- obj : typing.Any,
- **kwargs
Parameters
- Name
self
- Type
- Default
- Description
- Name
value
- Type
- typing.Any
- Default
- Description
- Name
attr
- Type
- typing.Optional[str]
- Default
- Description
- Name
obj
- Type
- typing.Any
- Default
- Description
- Name
**kwargs
- Type
- Default
- = {}
- Description
_deserialize(
- self,
- value : typing.Any,
- attr : typing.Optional[str],
- data : typing.Optional[typing.Mapping[str, typing.Any]],
- **kwargs
Parameters
- Name
self
- Type
- Default
- Description
- Name
value
- Type
- typing.Any
- Default
- Description
- Name
attr
- Type
- typing.Optional[str]
- Default
- Description
- Name
data
- Type
- typing.Optional[typing.Mapping[str, typing.Any]]
- Default
- Description
- Name
**kwargs
- Type
- Default
- = {}
- Description
Alignment
Defines the alignment and distribution of items along an axis.
- Bases
- enum.Enum
Attributes
- Name
START
- Type
- Value
= enum.auto()
- Description
Items are packed toward the start of the direction.
- Name
END
- Type
- Value
= enum.auto()
- Description
Items are packed toward the end of the direction.
- Name
CENTER
- Type
- Value
= enum.auto()
- Description
Items are centered along the direction.
- Name
SPACE_BETWEEN
- Type
- Value
= enum.auto()
- Description
Items are evenly distributed in the direction; first item is on the start line, last item on the end line.
- Name
SPACE_AROUND
- Type
- Value
= enum.auto()
- Description
Items are evenly distributed in the direction with equal space around them.
- Name
SPACE_EVENLY
- Type
- Value
= enum.auto()
- Description
Items are distributed so that the spacing between any two items (and the space to the edges) is equal.
Direction
Defines the direction in which items are placed in the container.
- Bases
- enum.Enum
Attributes
- Name
COLUMN_ROW
- Type
- Value
= enum.auto()
- Description
Starting at the top left corner, moving from top to bottom, then from left to right.
- Name
COLUMN_REVERSE_ROW
- Type
- Value
= enum.auto()
- Description
Starting at the bottom left corner, moving from bottom to top, then from left to right.
- Name
COLUMN_ROW_REVERSE
- Type
- Value
= enum.auto()
- Description
Starting at the top right corner, moving from top to bottom, then from right to left.
- Name
COLUMN_REVERSE_ROW_REVERSE
- Type
- Value
= enum.auto()
- Description
Starting at the bottom right corner, moving from bottom to top, then from right to left.
- Name
ROW_COLUMN
- Type
- Value
= enum.auto()
- Description
Starting at the top left corner, moving from left to right, then from top to bottom.
- Name
ROW_COLUMN_REVERSE
- Type
- Value
= enum.auto()
- Description
Starting at the bottom left corner, moving from left to right, then from bottom to top.
- Name
ROW_REVERSE_COLUMN
- Type
- Value
= enum.auto()
- Description
Starting at the top right corner, moving from right to left, then from top to bottom.
- Name
ROW_REVERSE_COLUMN_REVERSE
- Type
- Value
= enum.auto()
- Description
Starting at the bottom right corner, moving from right to left, then from bottom to top.
ComplexShape
A shape with with complex dimensions that can be filled with liquid.
- MRO
- Decorators
- dataclasses.dataclass
Methods
__post_init__(self) -> None
Attributes
Cone
A solid shape with a circular base shape, that narrows smoothly from the base to a point at a certain height.
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
ConicalFrustum
A solid shape with 3 faces. A conical frustum is the lower portion or base of a cone that is a result of cutting off the upper portion by a plane parallel to the base of the shape. See: https://math.stackexchange.com/questions/234upper534/relation-between-height-and-volume-of-frustum
- MRO
- Decorators
- dataclasses.dataclass
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
Cuboid
A six-faced solid shape with a rectangular base shape and a certain height.
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
Cylinder
A solid shape with two parallel circular base shapes joined by a curved surface with a certain height.
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
HalfSphere
A solid shape with a circular base shape, that arcs smoothly down from the base to the lowest point at a certain height (equivalent to the radius of the base shape).
- MRO
- ⎿⎽⎽HalfSphere
- Decorators
- dataclasses.dataclass
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
Pyramid
A five-faced solid shape with a rectangular base shape and the lateral surfaces as triangles that meet at a common vertex at a certain height.
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
PyramidalFrustum
A solid shape with 6 faces. A pyramidal frustum is the lower portion or base of a pyramid that is a result of cutting off the upper portion by a plane parallel to the base of the shape. If the width and length of the lower and the upper plane are equal respectively, the pyramidal frustum is called a square frustum.
- Decorators
- dataclasses.dataclass
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
- Name
width_lower
- Type
- Decimal
- Value
= Decimal()
- Description
- Name
depth_lower
- Type
- Decimal
- Value
= Decimal()
- Description
- Name
width_upper
- Type
- Decimal
- Value
= Decimal()
- Description
- Name
depth_upper
- Type
- Decimal
- Value
= Decimal()
- Description
- Name
height
- Type
- Decimal
- Value
= Decimal()
- Description
- Name
max_fitting_volume
- Type
- decimal.Decimal
- Value
= None
- Description
The maximum volume that fits into this shape.
Shape
A 3D solid shape with a certain height that can be filled with liquid.
- Decorators
- dataclasses.dataclass
Methods
__post_init__(self) -> None
volume_for_height(self, height : Number) -> decimal.Decimal
Calculates the volume within this shape for a particular height.
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Number
- Default
- Description
The height within this shape.
Response
- Type
- decimal.Decimal
- Description
The inner shape's volume in µl with the given height.
height_for_volume(self, volume : Number) -> decimal.Decimal
Calculates the height within this shape for a particular volume.
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Number
- Default
- Description
The volume in this shape.
Response
- Type
- decimal.Decimal
- Description
The inner shape's height in mm with the given volume.
Attributes
- Name
height
- Type
- Decimal
- Value
= Decimal()
- Description
- Name
max_fitting_volume
- Type
- decimal.Decimal
- Value
= None
- Description
The maximum volume that fits into this shape.
SphericalCap
A solid shape in form of the cap of a sphere. If the height is equal to the radius of the sphere, the spherical cap turn into a half sphere.
- MRO
- Decorators
- dataclasses.dataclass
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
SphericalSegment
a spherical segment is the solid defined by cutting a sphere or a ball with a pair of parallel planes. It can be thought of as a spherical cap with the top truncated, and so it corresponds to a spherical frustum.
- Decorators
- dataclasses.dataclass
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
Stack
Composition of multiple solid shapes ordered from top to bottom.
Methods
__post_init__(self) -> None
volume_for_height(self, height) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
height
- Type
- Default
- Description
height_for_volume(self, volume) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
volume
- Type
- Default
- Description
Attributes
Vector
Represents coordinates in a Cartesian coordinate system. In the context of robotics, imagine to face the machine's front: the system's origin is the bottom left corner next to you. ``` z ↑ y | ↗ └ - → x ```
- Decorators
- dataclasses.dataclass
Methods
update(self, x : typing.Optional[Number], y : typing.Optional[Number], z : typing.Optional[Number]) -> Vector
Returns a new Vector with the provided coordinate updates.
Parameters
- Name
self
- Type
- Default
- Description
- Name
x
- Type
- typing.Optional[Number]
- Default
- = None
- Description
- Name
y
- Type
- typing.Optional[Number]
- Default
- = None
- Description
- Name
z
- Type
- typing.Optional[Number]
- Default
- = None
- Description
Response
- Type
- Vector
- Description
A new Vector with the updated or same x, y, and z values as the
__bool__(self) -> bool
Response
- Type
- bool
- Description
Attributes
- Name
x
- Type
- Decimal
- Value
= dataclasses.field(metadata={'marshmallow_field': DecimalField()}, default=Decimal(default=0))
- Description
- Name
y
- Type
- Decimal
- Value
= dataclasses.field(metadata={'marshmallow_field': DecimalField()}, default=Decimal(default=0))
- Description
- Name
z
- Type
- Decimal
- Value
= dataclasses.field(metadata={'marshmallow_field': DecimalField()}, default=Decimal(default=0))
- Description