Skip to content

Conversation

@oliwenmandiamond
Copy link
Contributor

@oliwenmandiamond oliwenmandiamond commented Jan 16, 2026

Remove the generics from the analysers by implementing analyser models for each analyser type. This will also allow for beamline specific behaviour to be later implemented on an analyser.

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

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.15%. Comparing base (07c1416) to head (9e1108e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1821   +/-   ##
=======================================
  Coverage   99.14%   99.15%           
=======================================
  Files         304      307    +3     
  Lines       11509    11549   +40     
=======================================
+ Hits        11411    11451   +40     
  Misses         98       98           

☔ 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 marked this pull request as ready for review January 19, 2026 11:58
@oliwenmandiamond oliwenmandiamond requested a review from a team as a code owner January 19, 2026 11:58
Copy link
Contributor

@Villtord Villtord left a comment

Choose a reason for hiding this comment

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

Nice! Surprisingly it is less code that I expected for moving away from more generics classes.

shutter: FastShutter | None = None,
name: str = "",
):
driver = B07SpecsAnalyserDriverIO(prefix)
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens when you later call super().init(...) i? will it then overwrite this driver object with self.driver = controller.driver from ElectronAnalyserDetector class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The scope of driver in this class is only inside __init__ as it isn't saved to self and is passed directly to the parent class. Inside the parent class it will save it as self.driver so is accessible via analyser.driver and participates with naming and connect. So there is no overriding or classing.

Copy link
Contributor

Choose a reason for hiding this comment

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

you could then just create it without naming directly in B07ElectronAnalyserController

Copy link
Contributor Author

@oliwenmandiamond oliwenmandiamond Jan 28, 2026

Choose a reason for hiding this comment

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

Do you mean like this?

       controller = B07ElectronAnalyserController(
            B07SpecsAnalyserDriverIO(prefix), 
            energy_source,
            shutter
        )
        super().__init__(controller, name)

Yes I could do it like this, but think it is much cleaner to do the above (and less lines?)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, fair enough. It's just confusing that you create one-time-use object called driver here and there is also driver object in parent class, why not to avoid possible confusion. Maybe you could rename this one to e.g. _driver ?

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