Skip to content

Include pmac trigger logic as visr device#1952

Open
gkalua wants to merge 4 commits intomainfrom
include-pmac-trigger-logic-as-visr-device
Open

Include pmac trigger logic as visr device#1952
gkalua wants to merge 4 commits intomainfrom
include-pmac-trigger-logic-as-visr-device

Conversation

@gkalua
Copy link

@gkalua gkalua commented Mar 3, 2026

Instructions to reviewer on how to test:

  1. Updates the visr detectors suffices
  2. Includes Pmac Trigger Logic as a device for Visr.

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • If a new device has been added does it follow the standards
  • If changing the API for a pre-existing device, ensure that any beamlines using this device have updated their Bluesky plans accordingly
  • Have the connection tests for the relevant beamline(s) been run via dodal connect ${BEAMLINE}

@gkalua gkalua requested a review from a team as a code owner March 3, 2026 17:21
@gkalua gkalua requested a review from shihab-dls March 3, 2026 17:22
@gkalua gkalua self-assigned this Mar 3, 2026
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.08%. Comparing base (8dfcdaa) to head (ebd5690).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1952   +/-   ##
=======================================
  Coverage   99.08%   99.08%           
=======================================
  Files         314      314           
  Lines       11804    11807    +3     
=======================================
+ Hits        11696    11699    +3     
  Misses        108      108           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@shihab-dls shihab-dls left a comment

Choose a reason for hiding this comment

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

Looks good. Just one suggestion for the docstring, feel free to merge in after addressing.

Co-authored-by: Shihab S <162436767+shihab-dls@users.noreply.github.com>
@gkalua gkalua requested a review from abbiemery March 5, 2026 08:47
Copy link
Contributor

@abbiemery abbiemery left a comment

Choose a reason for hiding this comment

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

Why do we want a trigger logic as a device? It looks like I have missed a lot of context here with the changes to ophyd-async and what constitutes a TriggerLogic. What I knew as TriggerLogic, which contained the required state and logic to prepare a detector, appears to now be a DetectorTriggerLogic. This being set up via plans/stubs to set detectors up how we want.

Seeing a PmacTrajectoryTriggerLogic as a flyable device in its own right felt initially odd but this is going to be down to the fact i've not been involved in this project for a long while. Feel free to point me to an ADR on these changes or anything pmac related, or we can have a chat about how this works, as I would be interested to know. However, since I don't understand why this might be needed, I'm no help for reviewing.

@gkalua
Copy link
Author

gkalua commented Mar 9, 2026

Currently, PmacTrajectoryTriggerLogic must be registered as a beamline device in dodal rather than instantiated inside a plan.

It is an ophyd-async Device that takes ownership of PmacIO as a child. Constructing it ad-hoc inside a plan means a new instance is created on every call; on back-to-back fly scans this raises 'Cannot set the parent of PmacIO to be PmacTrajectoryTriggerLogic because it is already PmacTrajectoryTriggerLogic', since ophyd-async does not permit a device to be re-parented.

Note: the current ownership model (PmacTrajectoryTriggerLogic owning PmacIO) is a workaround and will be revised in bluesky/ophyd-async#1220

@gkalua gkalua requested a review from DominicOram March 9, 2026 16:32
@coretl
Copy link
Collaborator

coretl commented Mar 10, 2026

I suggest you add the Pmac as a Reference to the (temporarily badly named) Logic class to opt out of the parent-child relationship so it doesn't need to be added to dodal:
https://github.com/bluesky/ophyd-async/blob/dfc2fccff9c045fdf7565dfe206ea34655738d22/src/ophyd_async/core/_utils.py#L372-L378

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