Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ library/falcon
library/greiner
library/hamilton
library/imcs
library/mckesson
library/nest
library/opentrons
library/perkin_elmer
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/resources/library/mckesson.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# McKesson

## Tubes

| Description | Image | PLR definition |
|-|-|-|
| McKesson Premium Glass Culture Tube<br>Part no. 177-1505<br>[Manufacturer product page](https://mms.mckesson.com/product/1082085/McKesson-Brand-177-1505) · [Specifications](https://imgcdn.mckesson.com/CumulusWeb/Click_and_learn/premium_glass_culture_tubes_tear_sheet_2018-07.pdf)<br>12 mm OD × 75 mm, 5 mL<br>Round-bottom borosilicate glass with a fire-polished rim<br>Plain, clear, non-sterile, without closure<br>250/box, 4 boxes/case | ![McKesson 177-1505 glass culture tube](img/mckesson/McKesson_tube_5mL_Rb.jpg) | `McKesson_tube_5mL_Rb` |
1 change: 1 addition & 0 deletions pylabrobot/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from .lid import Lid, Liddable
from .liquid import Liquid
from .manipulator import LinkBody
from .mckesson import *
from .n_channel_pipettes import NChannelPipette, TipMountingShaft, TipPickupMode
from .nest import *
from .opentrons import *
Expand Down
1 change: 1 addition & 0 deletions pylabrobot/resources/mckesson/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .tubes import *
39 changes: 39 additions & 0 deletions pylabrobot/resources/mckesson/tubes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Resource definitions for McKesson tubes."""

from pylabrobot.resources.tube import Tube, TubeBottomType


def McKesson_tube_5mL_Rb(name: str) -> Tube:
"""McKesson Premium Glass Culture Tube, manufacturer no. 177-1505.

The uncapped borosilicate tube has a round bottom and a fire-polished rim.
The cavity floor is modeled 1 mm above the outside base.

Liquid heights are approximated by a linear fit in mm above the cavity floor.
The table bounds the fit to the nominal 0–5,000 uL capacity. The positive
height at zero volume is the fit's extrapolated intercept.

Manufacturer specification
https://imgcdn.mckesson.com/CumulusWeb/Click_and_learn/premium_glass_culture_tubes_tear_sheet_2018-07.pdf

Args:
name: Name of the tube.
"""
diameter = 12 # from spec, outside diameter in mm
capacity = 5_000 # from spec, nominal capacity in uL
height_per_volume = 0.01175032 # measured fit, mm/uL
height_intercept = 3.622768533 # measured fit, mm
return Tube(
name=name,
size_x=diameter,
size_y=diameter,
size_z=75, # from spec
material_z_thickness=1.0, # estimated cavity-floor offset in mm
model=McKesson_tube_5mL_Rb.__name__,
max_volume=capacity,
bottom_type=TubeBottomType.U, # from spec
height_volume_data={
height_intercept: 0,
height_intercept + height_per_volume * capacity: capacity,
},
)
21 changes: 21 additions & 0 deletions pylabrobot/resources/mckesson/tubes_tests.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per guide, not tests for resource definitions please!

#1626

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import json
import unittest

from pylabrobot.resources import McKesson_tube_5mL_Rb
from pylabrobot.resources.tube import Tube, TubeBottomType


class McKessonTubeTests(unittest.TestCase):
def test_geometry_and_calibration_survive_json_round_trip(self):
tube = McKesson_tube_5mL_Rb(name="mckesson_tube")
restored = Tube.deserialize(json.loads(json.dumps(tube.serialize())))

self.assertEqual(restored.bottom_type, TubeBottomType.U)
self.assertEqual(restored.get_anchor(z="cavity_bottom").z, 1.0)
self.assertAlmostEqual(restored.compute_height_from_volume(2_500), 32.998568533)
self.assertAlmostEqual(restored.compute_volume_from_height(32.998568533), 2_500)

def test_height_outside_nominal_fit_raises(self):
tube = McKesson_tube_5mL_Rb(name="mckesson_tube")
with self.assertRaises(ValueError):
tube.compute_volume_from_height(0)
7 changes: 6 additions & 1 deletion pylabrobot/resources/tube.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ def __init__(
height_volume_data=height_volume_data,
no_go_zones=no_go_zones,
)
self.bottom_type = bottom_type

def serialize(self) -> dict:
return {**super().serialize(), "max_volume": self.max_volume}
return {
**super().serialize(),
"max_volume": self.max_volume,
"bottom_type": self.bottom_type.value,
}

def set_volume(self, volume: float):
"""Set the volume in the tube.
Expand Down
29 changes: 29 additions & 0 deletions pylabrobot/resources/tube_tests.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good test, we should keep it, thanks for adding

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import unittest

from .tube import Tube, TubeBottomType


class TubeTests(unittest.TestCase):
def test_bottom_type_serialization(self):
tube = Tube(
name="tube",
size_x=10,
size_y=10,
size_z=75,
max_volume=4_000,
bottom_type=TubeBottomType.U,
)

serialized = tube.serialize()
self.assertEqual(serialized["bottom_type"], "U")

restored = Tube.deserialize(serialized)
self.assertEqual(restored.bottom_type, TubeBottomType.U)

def test_deserialize_without_bottom_type(self):
tube = Tube(name="tube", size_x=10, size_y=10, size_z=75, max_volume=4_000)
serialized = tube.serialize()
del serialized["bottom_type"]

restored = Tube.deserialize(serialized)
self.assertEqual(restored.bottom_type, TubeBottomType.UNKNOWN)
Loading