Skip to content

Expose STARBackend.move_channel_probe_z()#961

Open
BioCam wants to merge 10 commits intoPyLabRobot:mainfrom
BioCam:Expose-STARBackend.move_channel_probe_z()
Open

Expose STARBackend.move_channel_probe_z()#961
BioCam wants to merge 10 commits intoPyLabRobot:mainfrom
BioCam:Expose-STARBackend.move_channel_probe_z()

Conversation

@BioCam
Copy link
Collaborator

@BioCam BioCam commented Mar 25, 2026

No description provided.

BioCam added 3 commits March 25, 2026 10:09
Bypasses the C0 master module (KZ) by sending ZA directly to the pip channel, enabling Z moves with configurable speed/acceleration even when the firmware's tip-picked-up flag is incorrectly set.
Also updates `move_channel_z` docstring.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR exposes a new low-level per-channel Z movement API on the Hamilton STAR backend, intended to bypass master-module routed Z moves when the instrument’s internal “tip picked up” state causes incorrect behavior.

Changes:

  • Clarifies move_channel_z semantics in its docstring (tip-dependent reference point).
  • Adds STARBackend.move_channel_probe_z() to move an individual channel’s probe Z-drive directly via the channel module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

BioCam and others added 2 commits March 25, 2026 12:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BioCam
Copy link
Collaborator Author

BioCam commented Mar 25, 2026

@rickwierenga, @ben-ray, @cmoscy, @jrast

Should we call this STARBackend.move_channel_stop_disc_z() and apply "stop_disc" naming for everything that refers to it?
It seems clearer to me than "probe" because very little Hamilton documentation references "probe", as opposed to "stop disc":

Screenshot 2026-01-01 at 14 52 20

Comment on lines 4532 to 4547
async def move_channel_z(self, channel: int, z: float):
"""Move a channel in the z direction."""
"""Move a channel in the Z direction.

The Hamilton firmware interprets this Z position based on its internal
"tip mounted" state for the specified channel. When the firmware state
indicates that no tip is mounted, the absolute Z position refers to the
bottom of the stop disc. In that case, this command is effectively
equivalent to :meth:`move_channel_probe_z` for the same numeric Z value.

When the firmware state indicates that a tip is mounted on the channel,
the same Z position instead refers to the physical end of the tip. In
this case, the numeric Z value used with this method may differ from the
probe Z position used with :meth:`move_channel_probe_z` for the same
physical height above the deck.
"""
await self.position_single_pipetting_channel_in_z_direction(
Copy link
Member

Choose a reason for hiding this comment

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

should we make this only for the case when tips are mounted, and ask people to use move_channel_probe_z for other cases? this conditional method behavior is confusing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I think you're right - should be a separate PR though

Copy link
Member

Choose a reason for hiding this comment

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

Lets do it here since they go nicely together

Also we can consider renaming tips method to move tip bottom or something to make it extra clear

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are you sure?

STARBackend. move_channel_z() is a core method and will therefore require an extended deprecation period away from currently expected behaviour

I use it in every aP

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not uncommon to account for the length of a mounted tool/effector when calling move commands on other hardware too. So it seems like STARBackend. move_channel_z() is plenty clear if it stays with it's current behavior/naming.

It is great to have the STARBackend.move_channel_probe_z() as a clear way to explicitly move wrt the stop disc though, regardless of tip state.

Just my 2c

Copy link
Member

Choose a reason for hiding this comment

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

sounds ambiguous to me to have move_channel_z and move_channel_probe_z. It's a bad API. We can cleanly transition this in the v1 change through the legacy module if we add this to v1b1. But also a simple deprecation warning for a method rename is easy enough

Copy link
Contributor

@cmoscy cmoscy Mar 26, 2026

Choose a reason for hiding this comment

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

Fair enough, maybe something like adding an arg with_respect_to ['end','stopdisc']. 1 function, with a clear callout of what you're moving the channel with respect to?

Copy link
Member

Choose a reason for hiding this comment

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

I generally like separate functions better than parameters fundamentally changing a functions behavior

Copy link
Member

Choose a reason for hiding this comment

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

@BioCam can you rename+depr then merge?

Comment on lines +4551 to 4560
warnings.warn(
"move_channel_z is deprecated. Use move_channel_stop_disk_z() for moves without a tip attached "
"or move_channel_tool_z() when a tip/tool is attached.",
DeprecationWarning,
stacklevel=2,
)
await self.position_single_pipetting_channel_in_z_direction(
pipetting_channel_index=channel + 1, z_position=round(z * 10)
)

Copy link
Member

Choose a reason for hiding this comment

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

why not use the method you tell people to use?

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.

4 participants