Skip to content

Move CentreEllipseMethod to a more common location - #1942

Merged
noemifrisina merged 10 commits into
mainfrom
i19-122_find-beam-centre
Jul 13, 2026
Merged

noemifrisina merged 10 commits into
mainfrom
i19-122_find-beam-centre

Conversation

@noemifrisina

Copy link
Copy Markdown
Collaborator

Needed for i19-bluesky#122

Instructions to reviewer on how to test:

  1. Run tests
  2. Check that all code using this device has been updated

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 Feb 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.16%. Comparing base (e9a073c) to head (684bc38).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1942   +/-   ##
=======================================
  Coverage   99.16%   99.16%           
=======================================
  Files         347      347           
  Lines       13628    13634    +6     
=======================================
+ Hits        13514    13520    +6     
  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 marked this pull request as ready for review February 27, 2026 11:13
@noemifrisina
noemifrisina requested a review from a team as a code owner February 27, 2026 11:13

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

Thanks, minor comment. Could you also add a test that explicitly checks that if you specify a large ROI it gives you the full image? It may be covered by test_get_roi_creates_correct_image_array, if it is then just a comment on one of those cases would be good.

ellipse_fit = self._fit_ellipse(roi_binary)
roi_centre_x = ellipse_fit[0][0]
roi_centre_y = ellipse_fit[0][1]
LOGGER.info(f"Beam centre founf at ({roi_centre_x}, {roi_centre_y})")

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:

Suggested change
LOGGER.info(f"Beam centre founf at ({roi_centre_x}, {roi_centre_y})")
LOGGER.info(f"Beam centre found at ({roi_centre_x}, {roi_centre_y})")

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.

Also, this is the centre in the ROI co-ordinates, I think the full image co-ordinates would be more expected (or specify in the log that they're ROI)

@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!

@noemifrisina
noemifrisina merged commit f94d2fd into main Jul 13, 2026
11 checks passed
@noemifrisina
noemifrisina deleted the i19-122_find-beam-centre branch July 13, 2026 13:24
noemifrisina added a commit that referenced this pull request Oct 20, 2026
* Revert direction to int to allow for values different from 0 or 1

* Add a readable signal for piezo setpoints as readback drifts too much

* Move CentreEllipseMethod to a more common location (#1942)

* First try just leaving everything as is

* Move beam_centre device to a more common location and instantiate on i19-1

* Actually fix tests

* That was not a fix - this hopefully is

* Fix logging message

* Add a comment to the test to specify large ROI

* Beam detect test

* Run pre-commits

* Add some PVs to set up AD plugin chain

* Update docstring

* Add device prefix

* Add a couple of tests

* Get the right value in test

* Fix test

* Actually save all changes

* Make device preparable and set up plugin chain there in place of plan

* Run pre commits

* Add a docstring and make lint happy

* Tidy up a bit

* Use the stat plugin from ophyd-async and use trigger to enable it

* Remove extra obsolete comment

* Better comment to setpoint piezo

* Get plugin names from PVs

* Add more to docstring

* Make device stageable instead of triggerable

* Fix typo
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