adjustments to pipette positioning utils to support rotated plates#441
adjustments to pipette positioning utils to support rotated plates#441ben-ray wants to merge 2 commits intoPyLabRobot:mainfrom
Conversation
| # offsets are in absolute space. | ||
| if resource.get_absolute_rotation().z % 180 == 0: | ||
| min_y = (resource.get_size_y() - channel_space) / 2 | ||
| min_y = (resource.get_absolute_size_y() - channel_space) / 2 | ||
| if min_y < min_spacing_edge: | ||
| raise ValueError("Resource is too small to space channels.") | ||
| offsets = [ | ||
| Coordinate(0, min_y + i * min_spacing_between_channels, 0) for i in range(num_channels) | ||
| ][::-1] | ||
| elif resource.get_absolute_rotation().z % 90 == 0: | ||
| min_x = (resource.get_size_x() - channel_space) / 2 | ||
| min_x = (resource.get_absolute_size_x() - channel_space) / 2 | ||
| offsets = [ |
There was a problem hiding this comment.
does it work with just resource.get_absolute_size_y? why is the special %90 case necessary?
| center_offsets = [Coordinate(x=x_offset, y=c, z=0) for c in centers] | ||
| offsets_relative_to_center = [c - resource.center() for c in center_offsets] | ||
| elif resource.get_absolute_rotation().z % 90 == 0: | ||
| y_offset = resource.get_size_y() / 2 | ||
| center_offsets = [Coordinate(x=c, y=y_offset, z=0) for c in centers] | ||
| x_offset = resource.get_absolute_size_x() / 2 | ||
| center_offsets = [Coordinate(x=x_offset, y=c, z=0) for c in centers] | ||
| offsets_relative_to_center = [c - resource.center() for c in center_offsets] | ||
|
|
||
| # offsets are relative to the center of the resource, but above we computed them wrt lfb | ||
| # so we need to subtract the center of the resource | ||
| return [c - resource.center() for c in center_offsets] | ||
| return offsets_relative_to_center |
There was a problem hiding this comment.
effectively nothing changed here
There was a problem hiding this comment.
correct, we no longer need the %90 case when using get_absolute_size_x
| return [(i + 1) * dim_size / (n + 1) for i in range(n)] | ||
| start = margin | ||
| end = dim_size - margin | ||
| step = (end - start) / (n - 1) if n > 1 else 0 | ||
| return [start + i * step for i in range(n)] |
There was a problem hiding this comment.
since there is enough space in this case, we would rather space the channels equally than putting side channels exactly at the margin. margin is meant to be a minimum margin
There was a problem hiding this comment.
because I can define margin, I expect channels to go narrower when I input a higher margin
There was a problem hiding this comment.
I can instead change the well definition for the same effect, but then the well definition is no longer accurate
There was a problem hiding this comment.
they should not go narrower than margin in any case
this is tested to work fine on both 90deg rotated plates & non-rotated plates, but might move the exact location of the pips from before