Repository navigation
Add 12x75mm test tube #1657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
har1eyk
wants to merge
8
commits into
PyLabRobot:main
Choose a base branch
from
har1eyk:add-12x75mm-test-tube
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+105
−1
Open
Add 12x75mm test tube #1657
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b93be33
add CAR_32_A00 tube carrier
har1eyk 9937cde
update tube carrier with diameter and z-height
har1eyk f8c4eca
docs: Add SMP_CAR_32_A00 to Hamilton resource catalog
har1eyk d62db0a
feat(resources): add McKesson tube definitions and serialize tube bot…
har1eyk b91320d
Merge branch 'main' into add-12x75mm-test-tube
har1eyk ab0b626
clean up formatting
har1eyk d16f151
Merge remote-tracking branch 'upstream/main' into add-12x75mm-test-tube
har1eyk b559f17
Complete the McKesson 5 mL tube resource
har1eyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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_tube_5mL_Rb` | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from .tubes import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a good test, we should keep it, thanks for adding |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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