Skip to content

Conversation

@JamesDoingStuff
Copy link
Contributor

@JamesDoingStuff JamesDoingStuff commented Apr 7, 2025

Fixes DiamondLightSource/mx-bluesky#979

This functionality overlaps with #1215, but for reasons detailed in that PR, they are remaining separate at this time.

Instructions to reviewer on how to test:

  1. Confirm dodal connect aithre still connects the goniometer
  2. Check new 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}

@codecov
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.97%. Comparing base (33b9815) to head (870e0ed).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1164   +/-   ##
=======================================
  Coverage   97.97%   97.97%           
=======================================
  Files         199      199           
  Lines        7637     7649   +12     
=======================================
+ Hits         7482     7494   +12     
  Misses        155      155           

☔ 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

@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. Some comments in code. Additionally, would you be able to make this into something generic and reuse it to do #1168 at the same time?

Comment on lines 22 to 28
async def test_vertical_position_set(goniometer: Goniometer):
await goniometer._set(value=5)
assert await goniometer.vertical_position.get_value() == 5


async def test_vertical_position_get(goniometer: Goniometer):
assert goniometer._get(math.sqrt(3), 1, 30) == pytest.approx(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: I think rather than use the _get and _set (which are private) we should use the signals themselves. i.e. goniometer.vertical_position.set(...). I think we need a few more tests too:

  • Test a getting and setting at few more angles/positions (pytest.mark.parametrize might help you here)
  • Test that setting the vertical actually changes the underlying signals as expected

self.sampy = Motor(prefix + "SAMPY")
self.sampz = Motor(prefix + "SAMPZ")
self.omega = Motor(prefix + "OMEGA")
self.vertical_position = derived_signal_rw(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: I think some docstrings on what vertical_position means would be good.

Copy link
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, thank you!

@JamesDoingStuff JamesDoingStuff merged commit 1deaf91 into main May 21, 2025
19 checks passed
@JamesDoingStuff JamesDoingStuff deleted the mxb_931_gonio_vertical_position branch May 21, 2025 14:01
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.

Device logic for vertical sample movement on Aithre

3 participants