Skip to content

Build lh.probe_tip_presence_via_pickup() #524

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
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

BioCam
Copy link
Contributor

@BioCam BioCam commented May 27, 2025

Hi everyone,

In this PR I am proposing the addition of the "atomic command" for tip_probing:

  async def probe_tip_presence_via_pickup(
    self,
    tip_spots: List[TipSpot],
    use_channels: Optional[List[int]] = None
) -> List[int]:
    """
    Probe tip presence by attempting pickup on each TipSpot.

    Args:
        tip_spots: TipSpots to probe.
        use_channels: Channels to use (must match tip_spots length).

    Returns:
        List[int]: 1 if tip is present, 0 otherwise.
    """

This is step 1 of a multi-feature generation process:

Build lh.probe_tip_presence_via_pickup()
Build measured_tip_inventory = lh.probe_tip_inventory(probing_mode=lh.probe_tip_presence_via_pickup)
Build lh.update_tip_inventory(measured_tip_inventory)
Build lh.consolidate_tip_inventory()

For further details please see the user & developer forum thread:
https://discuss.pylabrobot.org/t/liquid-handler-auto-detection-of-real-tip-presence/212/3

Comment on lines +2283 to +2293
) -> List[int]:
"""
Probe tip presence by attempting pickup on each TipSpot.

Args:
tip_spots: TipSpots to probe.
use_channels: Channels to use (must match tip_spots length).

Returns:
List[int]: 1 if tip is present, 0 otherwise.
"""
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't you want to return a bool?

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 found it doesn't matter: The important point is that the returns of this method (a list of True/False or 1/0) will be used in simple array/matrix additions/subtractions.
For that purpose True/False or 1/0 are equivalent.

I am happy to change it to True / False :)

Comment on lines +2340 to +2344
successful = [
(spot, ch) for spot, ch, i in cluster
if presence_flags[i] == 1
]
if successful:
Copy link
Member

Choose a reason for hiding this comment

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

maybe if any(successful) so it's more readable

Comment on lines +2351 to +2353
)
except Exception as e:
print(f"Warning: drop_tips failed for cluster at x={cluster[0][0].location.x}: {e}")
Copy link
Member

Choose a reason for hiding this comment

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

how do you know it's this cluster?

Comment on lines +2327 to +2328
await self.pick_up_tips(
list(tip_subset),
Copy link
Member

Choose a reason for hiding this comment

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

is list conversion necessary?

@rickwierenga
Copy link
Member

very nice and clever feature addition!

atomic command

i wouldn't call this an atomic command since it uses the atomic command pick_up_tips. (it requires no changes to the backend! - any backend in PLR that raises the appropriate error will get this functionality for free)

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.

2 participants