Skip to content

Mbs analyser slits#2074

Open
oliwenmandiamond wants to merge 11 commits into
mbs_detectorfrom
mbs_analyser_slits
Open

Mbs analyser slits#2074
oliwenmandiamond wants to merge 11 commits into
mbs_detectorfrom
mbs_analyser_slits

Conversation

@oliwenmandiamond
Copy link
Copy Markdown
Contributor

@oliwenmandiamond oliwenmandiamond commented May 28, 2026

Fixes #2069

Instructions to reviewer on how to test:

  1. Check implementation makes sense
  2. Check tests pass

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}

@oliwenmandiamond oliwenmandiamond changed the base branch from main to mbs_detector May 28, 2026 12:48
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.14%. Comparing base (153fde4) to head (685f269).

Additional details and impacted files
@@              Coverage Diff              @@
##           mbs_detector    #2074   +/-   ##
=============================================
  Coverage         99.14%   99.14%           
=============================================
  Files               342      343    +1     
  Lines             13281    13338   +57     
=============================================
+ Hits              13167    13224   +57     
  Misses              114      114           

☔ 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.

@oliwenmandiamond oliwenmandiamond self-assigned this May 28, 2026
@oliwenmandiamond oliwenmandiamond marked this pull request as ready for review May 28, 2026 14:29
@oliwenmandiamond oliwenmandiamond requested a review from a team as a code owner May 28, 2026 14:29
Comment thread src/dodal/devices/electron_analyser/mbs/mbs_analyser_slits.py Outdated
Comment thread src/dodal/devices/electron_analyser/mbs/mbs_analyser_slits.py Outdated
Comment thread src/dodal/beamlines/i05.py Outdated
Comment on lines +65 to +69
config_sigs = (
analyser_slits.direction,
analyser_slits.size,
analyser_slits.shape,
analyser_slits.setting,
Copy link
Copy Markdown
Contributor

@Villtord Villtord Jun 2, 2026

Choose a reason for hiding this comment

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

It looks good, but I worry about users who will be tempted to make changes like:
analyser_slits.size.set(300)
in their terminal, then because you have only one directional syncing in EntranceSlitInformationDevice layer this soft signal will fall back to Epics value.
Maybe those soft signals should not be exposed at all?

Copy link
Copy Markdown
Contributor Author

@oliwenmandiamond oliwenmandiamond Jun 2, 2026

Choose a reason for hiding this comment

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

These signals are read only. The write signals are all private. From blueapi side, I believe it doesn't expose private signals. They can only change it via epics (which is how it should be done). The read only config sigs are then given to the detector to record the data at the start of the scan whenever data collection is done. It is also impossible (very hard to do) to sync in the opposite direction as the valid combinations are defined by the epics enums.

energy_source: SignalR[float],
shutter: GenericFastShutter | None = None,
source_selector: SourceSelector | None = None,
config_sigs: Sequence[SignalR] = (),
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.

why allow here any arbitrary config signals, is there a use case for it or is it not a final class?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is reflecting how StandardDetector adds config_sigs https://github.com/bluesky/ophyd-async/blob/main/src/ophyd_async/core/_detector.py#L421C2-L421C3

and AreaDetector API https://github.com/bluesky/ophyd-async/blob/1e07267fb12ff511b248a77a5ed5b6ac50364ad9/src/ophyd_async/epics/adcore/_detector.py#L17

The electron analyser detectors currently use StandardDetector, but I am going to move to use AreaDetector soon. I was waiting for stable release of ophyd-async first to make it easier so was waiting for this to be merged first bluesky/ophyd-async#1268

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.

OK, but I mean you could specify here analyser_slit as input parameter and pass down all it's soft signals to

config_sigs = (
            analyser_slit.direction,
            analyser_slit.setting,
            analyser_slit.size,
            analyser_slit.shape,
            self.driver.region_name,
            self.driver.energy_mode,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could, but then it makes it less generic when I can reuse what it already does rather than adding it to the constructor to do the exact same thing

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