fix(resources): stop transposing a tip spot's size_x and size_y - #1251
Open
MaxFreedomPollard wants to merge 1 commit into
Open
fix(resources): stop transposing a tip spot's size_x and size_y#1251MaxFreedomPollard wants to merge 1 commit into
MaxFreedomPollard wants to merge 1 commit into
Conversation
`TipSpot.__init__` passed its `size_x` to `Resource` as `size_y` and its `size_y` as `size_x`, so a spot whose two sizes differ reported them swapped. Its center landed half the difference off in each axis, and a serialize/deserialize round trip transposed the sizes again instead of reproducing the spot. Every tip spot defined here is square, so the two sizes are equal and the transposition never shows up on them.
BioCam
requested changes
Sep 10, 2026
| fitting_depth=8.0, | ||
| ) | ||
|
|
||
| def test_size_x_and_size_y_are_not_transposed(self): |
Collaborator
There was a problem hiding this comment.
Do you think we really need this now that is fixed? :)
Collaborator
|
This is hilarious, such an innocent bug - thank you for catching! 😅 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A
TipSpotreports the two sizes it was created with swapped.TipSpot.__init__passessize_x=size_y, size_y=size_xup toResource(pylabrobot/resources/tip_rack.py:49-50), so a spot built withsize_x=8.0, size_y=5.0answersget_size_x() == 5.0andget_size_y() == 8.0.center()then returnsCoordinate(2.5, 4.0, 0)instead ofCoordinate(4.0, 2.5, 0), andTipSpot.deserialize(spot.serialize())transposes the sizes a second time rather than reproducing the spot.The constructor's own docstring settles which is which: "size_x: the size of the tip spot in the x direction", "size_y: the size of the tip spot in the y direction", and
Resource.get_size_xis documented as the local size in the x direction. No other resource in the repo transposes its sizes, and nothing downstream compensates: the OT-2 driver targetstip_spot.get_location_wrt(self.robot.deck, "c", "c", "b")(pylabrobot/opentrons/ot2/pipette.py:237) and the STAR and Vantage backends addtip_spot_a1.center(), all of which read those two sizes back, so a non-square spot is approached half the difference off center in each axis.Nothing in the repo trips it because every tip spot defined here is square, so the two sizes are equal. It shows up on a spot whose x and y footprint differ, which is what two separate parameters are for.
The fix passes each size to the axis it names.
TipSpotSizeTestsintip_rack_tests.pybuilds an 8.0 by 5.0 mm spot and checks the reported sizes,center(), and a serialize/deserialize round trip; against the unfixed constructor it fails withAssertionError: 5.0 != 8.0.Verified with
python -m pytest(whole suite green),make lintandmake format-check("All checks passed!"), andmake typecheckclean on the changed files.