Skip to content

i15-1: add goniometer interlock #2019

Merged
DominicOram merged 8 commits into
mainfrom
ea/add_i15-1_gonio
Apr 28, 2026
Merged

i15-1: add goniometer interlock #2019
DominicOram merged 8 commits into
mainfrom
ea/add_i15-1_gonio

Conversation

@EmsArnold
Copy link
Copy Markdown
Contributor

Fixes crystallography_bluesky #26

Instructions to reviewer on how to test:

  1. Do thing x
  2. Confirm thing y happens

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
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (334d34d) to head (c356c90).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2019   +/-   ##
=======================================
  Coverage   99.11%   99.11%           
=======================================
  Files         327      328    +1     
  Lines       12761    12774   +13     
=======================================
+ Hits        12648    12661   +13     
  Misses        113      113           

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

@EmsArnold EmsArnold force-pushed the ea/add_i15-1_gonio branch from 44e81f0 to 7472108 Compare April 21, 2026 14:56
@EmsArnold EmsArnold marked this pull request as ready for review April 21, 2026 15:01
@EmsArnold EmsArnold requested a review from a team as a code owner April 21, 2026 15:01
Copy link
Copy Markdown
Contributor

@jacob720 jacob720 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 a small comment and question

async def shutter_safe_to_operate(self) -> bool:
"""Description."""
interlock_state = await self.status.get_value()
return isclose(float(interlock_state), GONIO_SAFE_FOR_OPERATIONS, abs_tol=5e-2)
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.

Out of interest, why do we convert to float and have a tolerance here? The comment about 16 bits makes it sound like the self.status is a 16 bit value

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 emulating the hutch interlock logic to check if the device is safe to operate. In practice, I think the conversion to float is necessary, as the other day during testing I did get an AssertionError that 65535 was not equal to 65535 before I added this in to my check.

With regards to the 16 bits, 65535 is simply the float equivalent of the binary 1111111111111111 - or all 16 flags of the interlock being healthy. This may be something that we ask controls to look at, to see if this can return an enum like some other interlocks.

)

async def shutter_safe_to_operate(self) -> bool:
"""Description."""
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: Fill out the docstring or remove

@DominicOram
Copy link
Copy Markdown
Contributor

I am partway through reviewing this but ended up gettign sidetracked, more comments incoming...

Copy link
Copy Markdown
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Thanks. As I said in the other PR, I think #2022 might help with this?

GONIO_SAFE_FOR_OPERATIONS = 65535 # All 16 bits are true


class GonioInterlock(BaseHutchInterlock):
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: BaseHutchInterlock implies that it's only for interlocks on the hutch. I think this is expanding it so maybe we should rename to BaseInterlock

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 agree, though I think this could also be expanded to the other interlocks as well - for example PLCShutterInterlock would also be useful for fast vacuum valves. I would lean towards re-naming these all at the same time.

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.

Sure, feel free to spin into a new issue if you'd rather

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.

Will do - I think it would also warrant moving the interlocks out of hutch_shutter.py with similar reasoning. I wouldn't immediately look in hutch_shutter if I only needed an interlock.

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.

Agreed

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.

For archaeology, issue is #2024

@EmsArnold EmsArnold force-pushed the ea/add_i15-1_gonio branch from b366281 to ba0dd68 Compare April 23, 2026 16:57
@EmsArnold
Copy link
Copy Markdown
Contributor Author

Thanks. As I said in the other PR, I think #2022 might help with this?

That's all done now - updated to use interlock.is_safe

Copy link
Copy Markdown
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Great, thanks. Might make sense to wait until DiamondLightSource/crystallography-bluesky#31 is approved to merge both at the same time.

@EmsArnold EmsArnold force-pushed the ea/add_i15-1_gonio branch from ba4b507 to 740a95b Compare April 27, 2026 13:07
@DominicOram DominicOram enabled auto-merge (squash) April 28, 2026 16:03
@DominicOram DominicOram merged commit d4c4ae9 into main Apr 28, 2026
7 checks passed
@DominicOram DominicOram deleted the ea/add_i15-1_gonio branch April 28, 2026 16:14
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.

3 participants