Skip to content

Add pumps as ophyd-async devices and pump bluesky plans - #23

Merged
Tj Barrett (Tj-Barrett) merged 11 commits into
mainfrom
pumps
Oct 16, 2026
Merged

Tj Barrett (Tj-Barrett) merged 11 commits into
mainfrom
pumps

Conversation

@thopkins32

@thopkins32 Thomas Hopkins (thopkins32) commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Assisted-by: oh-my-pi:gpt-6-sol

Summary

Ports over the pump device implementations from https://github.com/NSLS2/xpd-profile-collection in order to use ophyd-async and proper bluesky plans for controlling them.

@thopkins32
Thomas Hopkins (thopkins32) marked this pull request as ready for review October 15, 2026 16:00
Copilot AI balanced review requested due to automatic review settings October 15, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Status-timeout handling, delayed shutdown, and nonfinite equilibrium waits leave unresolved operational risks.

3 open findings
What changed in this PR

Adds ophyd-async syringe-pump devices and Bluesky plans for configuration, operation, and cleanup.

Changes:

  • Introduces DDS and Ultra devices with syringe validation and unit conversion.
  • Adds pump-control plans and offline tests.
  • Updates the locked ophyd-async revision.
File Description
uv.lock Updates ophyd-async revision.
tests/​test_pumps.py Tests device readings and syringe validation.
tests/​test_pump_plans.py Tests control plans and cleanup behavior.
src/​xpd_tools/​pumps.py Defines pump devices and configuration limits.
src/​xpd_tools/​pump_plans.py Adds configuration, operation, and cleanup plans.
pyproject.toml Normalizes dependency extras formatting.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/xpd_tools/pump_plans.py Outdated
Comment thread src/xpd_tools/pump_plans.py
Comment thread src/xpd_tools/pump_plans.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 14:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Stop-confirmation failures can be discarded, allowing cleanup to report success without confirming that flow stopped.

3 open findings
1 resolved since last review

🧠 Review effort: Balanced

Comment thread src/xpd_tools/pump_plans.py Outdated
Refactor wait_for call to store tasks and process results.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 14:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Unresolved startup-status failures can allow acquisition to proceed without confirmed pump flow.

2 open findings
1 resolved since last review

🧠 Review effort: Balanced

Refactor wait_for to use tasks for handling pump status.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Sequential stop-confirmation waits can delay stopping the remaining pumps during cleanup.

0 open findings

2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Low severity Add nonzero equilibrium test coverage with mixed flows

tests/​test_pump_plans.py:246

The only successful equilibrium test uses zero tubing length, so it cannot detect incorrect residence-time arithmetic, combined pump flow, or ratio scaling. Add a nonzero case with known geometry, mixed-unit flows, and a non-unit ratio. Assert both the returned duration and the requested sleep, replacing the sleep with a no-op so the test does not wait.

🧠 Review effort: Balanced

Co-authored-by: Tj-Barrett <71855260+Tj-Barrett@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The equilibrium test’s expected-time calculation is incorrect and needs validation across multiple flow rates.

1 open finding

🧠 Review effort: Balanced

Comment thread tests/test_pump_plans.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Sequential shutdown confirmation can delay STOP commands to other pumps during cleanup.

1 open finding

🧠 Review effort: Balanced

Co-authored-by: Tj-Barrett <71855260+Tj-Barrett@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Shutdown sequencing needs correction, and hardware mappings and cleanup safety require human validation beyond mock tests.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread src/xpd_tools/pump_plans.py Outdated
Co-authored-by: Tj-Barrett <71855260+Tj-Barrett@users.noreply.github.com>

@Tj-Barrett Tj Barrett (Tj-Barrett) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

More explicit handling of pump tasks for STOP, infusing, and withdrawing and subsequent tests

@Tj-Barrett
Tj Barrett (Tj-Barrett) merged commit 6565588 into main Oct 16, 2026
9 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Hardware-control cleanup needs stronger failure-path coverage and human validation beyond the mock tests.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Ensure test verifies STOP command is sent to the second pump

tests/​test_pump_plans.py:230

second is already Idle after the preceding session cleanup, so this assertion passes even if its STOP command is never sent. Set it to Infusing before calling stop_pumps so the test verifies that a failed first STOP does not leave another pump running.

🧠 Review effort: Balanced

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