Skip to content
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

[rotations] add ResourceHolderMixin to fix placement in a number of resources #239

Merged
merged 38 commits into from
Sep 18, 2024

Conversation

jkhales
Copy link
Contributor

@jkhales jkhales commented Sep 10, 2024

No description provided.

@jkhales
Copy link
Contributor Author

jkhales commented Sep 10, 2024

@rickwierenga this fails for ResourceStack curious how you want to handle that

@rickwierenga
Copy link
Contributor

why does it fail

@jkhales
Copy link
Contributor Author

jkhales commented Sep 11, 2024

why does it fail

my guess is that because ResourceStack doesn't use the automatic location calculation in assign_child_resources that PlateCarrierSite does. Wondering if this should be added to a parent class somewhere instead of playing whack a mole.

@rickwierenga
Copy link
Contributor

yes, i guess in that case we should also automatically find the best location of the plate, similar to what we do with CarrierSite

@jkhales jkhales changed the title [rotations] add test for idempotent rotations [rotations] fix placement of rotated resources on ResourceStack Sep 11, 2024
@jkhales jkhales changed the title [rotations] fix placement of rotated resources on ResourceStack [rotations] add ResourceHolderMixin to fix placement in a number of resources Sep 12, 2024
Comment on lines 40 to 41
model: Optional[str] = None,
**_kwargs
Copy link
Contributor

Choose a reason for hiding this comment

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

kwargs seems not needed here, but maybe an artifact of using mixins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When you have a bunch of subclasses with different args, they get passed up the MRO chain. This is the standard way to "ignore them"

Copy link
Contributor

Choose a reason for hiding this comment

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

this feels like bad design. why is it necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, it feels weird, but I believe it's just how python does things

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤖 also agrees image

pylabrobot/plate_reading/plate_reader.py Outdated Show resolved Hide resolved
pylabrobot/resources/plate.py Show resolved Hide resolved
pylabrobot/resources/resource_holder.py Outdated Show resolved Hide resolved
pylabrobot/resources/carrier.py Show resolved Hide resolved
@jkhales
Copy link
Contributor Author

jkhales commented Sep 18, 2024

bumping this

Comment on lines 238 to 241
z_sinking_depth = get_plate_sinking_depth(first_child)
resource.register_did_assign_resource_callback(self._update_resource_stack_location)
self.register_did_unassign_resource_callback(self._deregister_resource_stack_callback)
return -Coordinate(z=z_sinking_depth)
Copy link
Contributor

Choose a reason for hiding this comment

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

_get_sinking_depth should not handle callbacks

Copy link
Contributor

Choose a reason for hiding this comment

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

made an issue for this: #246

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'll add the issue to the code in a comment as well

Comment on lines 100 to 102
def get_resource_stack_size(self) -> Coordinate:
if self.direction == "x":
resource_location = Coordinate(self.get_size_x(), 0, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

potentially just put this in get_default_child_location. It seems incorrect to have a get_size method return a coordinate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's used in the assign lid to resource stack special case. I can rename to something if you don't like the size word.

Copy link
Contributor

Choose a reason for hiding this comment

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

for this particular function i don't like it :)

pylabrobot/resources/resource_stack.py Outdated Show resolved Hide resolved
@rickwierenga rickwierenga merged commit 68d1027 into PyLabRobot:main Sep 18, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants