unitelabs.labware.math.shapes

Attributes

  • Name
    Number
    Type
    Value

    = typing.Union[str, int, float, tuple[int, collections.abc.Sequence[int], int], decimal.Decimal]

    Description

  • Name
    PI
    Type
    Value

    = parse_number(math.pi)

    Description

  • Name
    ROUNDING_ERROR
    Type
    Value

    = decimal.Decimal('1e-12')

    Description

Functions

  • parse_number(value : Number) -> decimal.Decimal

    Convert any valid number to a decimal value.

    Parameters

    • Name
      value
      Type
      Number
      Default
      Description

      The number to convert.

    Response

    Type
    decimal.Decimal
    Description

    The decimal value.

Classes

  • Shape

    A 3D solid shape with a certain height that can be filled with liquid.

    Decorators
    dataclasses.dataclass

    Methods

    • __init__(self, height : Decimal) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

    • __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.

  • Stack

    Composition of multiple solid shapes ordered from top to bottom.

    MRO
    Decorators
    dataclasses.dataclass

    Methods

    • __init__(self, height : Decimal, sections : list[Shape]) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        sections
        Type
        list[Shape]
        Default
        Description

    • __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
      sections
      Type
      list[Shape]
      Value

      = dataclasses.field(default_factory=list)

      Description

    • Name
      height
      Type
      Decimal
      Value

      = dataclasses.field(init=False, default=Decimal())

      Description

    • Name
      max_fitting_volume
      Type
      decimal.Decimal
      Value

      = None

      Description

      The maximum volume that fits into this shape.

  • ComplexShape

    A shape with with complex dimensions that can be filled with liquid.

    Decorators
    dataclasses.dataclass

    Methods

    • __init__(self, height : Decimal, factor : Decimal) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        factor
        Type
        Decimal
        Default
        Description

    • volume_for_height(self, height : Number) -> decimal.Decimal

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Number
        Default
        Description

      Response

      Type
      decimal.Decimal
      Description

    • height_for_volume(self, volume : Number) -> decimal.Decimal

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        volume
        Type
        Number
        Default
        Description

      Response

      Type
      decimal.Decimal
      Description

    • __post_init__(self) -> None

    Attributes

    • Name
      factor
      Type
      Decimal
      Value

      = Decimal()

      Description

    • Name
      max_fitting_volume
      Type
      decimal.Decimal
      Value

      = None

      Description

      The maximum volume that fits into this shape.

    • Name
      height
      Type
      Decimal
      Value

      = Decimal()

      Description

  • Cuboid

    A six-faced solid shape with a rectangular base shape and a certain height.

    MRO
    Decorators
    dataclasses.dataclass

    Methods

    • __init__(
        self,
      ) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        width
        Type
        Decimal
        Default
        Description

      • Name
        depth
        Type
        Decimal
        Default
        Description

    • __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
      Type
      Decimal
      Value

      = Decimal()

      Description

    • Name
      depth
      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.

  • 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.

    MRO
    Decorators
    dataclasses.dataclass

    Methods

    • __init__(
        self,
      ) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        width
        Type
        Decimal
        Default
        Description

      • Name
        depth
        Type
        Decimal
        Default
        Description

    • __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
      Type
      Decimal
      Value

      = Decimal()

      Description

    • Name
      depth
      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.

  • 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

    • __init__(
        self,
      ) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        width_lower
        Type
        Decimal
        Default
        Description

      • Name
        depth_lower
        Type
        Decimal
        Default
        Description

      • Name
        width_upper
        Type
        Decimal
        Default
        Description

      • Name
        depth_upper
        Type
        Decimal
        Default
        Description

    • __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.

  • Cylinder

    A solid shape with two parallel circular base shapes joined by a curved surface with a certain height.

    MRO
    Decorators
    dataclasses.dataclass

    Methods

    • __init__(self, height : Decimal, radius : Decimal) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        radius
        Type
        Decimal
        Default
        Description

    • __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
      radius
      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.

  • Cone

    A solid shape with a circular base shape, that narrows smoothly from the base to a point at a certain height.

    MRO
    Decorators
    dataclasses.dataclass

    Methods

    • __init__(self, height : Decimal, radius : Decimal) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        radius
        Type
        Decimal
        Default
        Description

    • __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
      radius
      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.

  • 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

    Decorators
    dataclasses.dataclass

    Methods

    • __init__(
        self,
      ) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        radius_lower
        Type
        Decimal
        Default
        Description

      • Name
        radius_upper
        Type
        Decimal
        Default
        Description

    • __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
      radius_lower
      Type
      Decimal
      Value

      = Decimal()

      Description

    • Name
      radius_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.

  • 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.

    Decorators
    dataclasses.dataclass

    Methods

    • __init__(self, height : Decimal, radius : Decimal) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        radius
        Type
        Decimal
        Default
        Description

    • __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
      radius
      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.

  • 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
    Decorators
    dataclasses.dataclass

    Methods

    • __init__(self, height : Decimal, radius : Decimal) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        radius
        Type
        Decimal
        Default
        Description

    • __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
      radius
      Type
      Decimal
      Value

      = dataclasses.field(init=False, default=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.

  • 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

    • __init__(
        self,
      ) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        height
        Type
        Decimal
        Default
        Description

      • Name
        radius_lower
        Type
        Decimal
        Default
        Description

      • Name
        radius_upper
        Type
        Decimal
        Default
        Description

    • __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
      radius_lower
      Type
      Decimal
      Value

      = Decimal()

      Description

    • Name
      radius_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.

Copyright © 2024