Skip to content

Add a device to allow i19 hutches to change the energy#2079

Open
noemifrisina wants to merge 7 commits into
mainfrom
2075_access-controlled-energy-device
Open

Add a device to allow i19 hutches to change the energy#2079
noemifrisina wants to merge 7 commits into
mainfrom
2075_access-controlled-energy-device

Conversation

@noemifrisina

Copy link
Copy Markdown
Collaborator

Create an access controlled device that i19-1 and i19-2 can use to change the energy on the beamline.

Fixes #2075

Instructions to reviewer on how to test:

  1. Verify tests pass
  2. Run dodal connect i19-{1,2} and check it works

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}

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.14%. Comparing base (d55ff73) to head (536790f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2079   +/-   ##
=======================================
  Coverage   99.14%   99.14%           
=======================================
  Files         343      344    +1     
  Lines       13317    13359   +42     
=======================================
+ Hits        13203    13245   +42     
  Misses        114      114           

☔ View full report in Codecov by Harness.
📢 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.

@noemifrisina noemifrisina changed the title Add a device to allow i19 hutched to change the energy Add a device to allow i19 hutches to change the energy Jun 1, 2026
@noemifrisina noemifrisina marked this pull request as ready for review June 1, 2026 16:49
@noemifrisina noemifrisina requested a review from a team as a code owner June 1, 2026 16:49

@DominicOram DominicOram 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.

Great, thanks. Couple of minor things



I19_1_COMMISSIONING_INSTR_SESSION: str = "cm40638-5"
I19_1_COMMISSIONING_INSTR_SESSION: str = "cm44168-3"

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.

Should: Do we have a longer term solution to having to keep changing this? Can we make a ticket and reference it here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There was a ticket in blueapi to enable passing this information to it - can dig it out.
For the moment I started trying to at least half automate the change of commissioning directory in a separate branch - although apparently it could be any string and the REST call would not complain

from dodal.devices.beamlines.i19.mirror_stripes import StripeChoice


class OutOfRangeEnergyRequestError(Exception):

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.

Nit: It's probably a OutOfRangeEnergyRequestError(ValueError) but doesn't really matter

Comment on lines +74 to +79
if 5 <= energy_in_kev < 10:
stripe = Stripes.SI
elif 10 <= energy_in_kev < 20:
stripe = Stripes.RH
elif 20 <= energy_in_kev < 30:
stripe = Stripes.PT

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.

Could: It would be nice if these were in a config file I think

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think there may be one, or there used to be (with just le lower limits in though - but that's fine, they can be worked out if that's the case), will check

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.

Add devices to I19 to set the energy

2 participants