Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a common base for attenuator #912

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

noemifrisina
Copy link
Collaborator

@noemifrisina noemifrisina commented Nov 21, 2024

Fixes #889

Creates an AttenuatorBase with a minimum set of common PVs that beamline-specific devices can inherit from.

Used in MX_bluesky#627

Instructions to reviewer on how to test:

  1. Check attenuator devices for i03 and i04 still connect
  2. Check new device for i24 connects
  3. Run tests

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}

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.04%. Comparing base (cb7717c) to head (90a8d14).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #912   +/-   ##
=======================================
  Coverage   96.04%   96.04%           
=======================================
  Files         136      136           
  Lines        5639     5645    +6     
=======================================
+ Hits         5416     5422    +6     
  Misses        223      223           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Thanks, a couple of comments

def attenuator(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> AttenuatorBase:
"""Get a basic (without filter wheels) attenuator device for i24, instantiate it
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: This is a bit misleading, there are filter wheels on the I24 attenuator:
image.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, but for the moment there's no filter wheel device (Made a ticket to write one #927 , which will also be needed soon for i19) and I24 doesn't need it at this stage... Beyond making it clearer in the comment that it's only temporary and will be added in the future I'm not sure what could be added here?

Comment on lines 5 to 6
class AttenuatorBase(StandardReadable):
"""An attenuator base class with a minimum set of common PVs to phase1 beamlines."""
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 it's worth making clear here that the read transmission will be fractional i.e. 0-1 not a percentage

Comment on lines 9 to 10
self._desired_transmission = epics_signal_rw(float, prefix + "T2A:SETVAL1")
self._use_current_energy = epics_signal_x(prefix + "E2WL:USECURRENTENERGY.PROC")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: Either this attenuator is only used for reading and we remove these PVs or we want to add the setting too, in which case AttenuatorBase should have a set.

If we're going to do setting as well I actually think you might be able to get away with exactly the same set between the two. In the i24 case:

  • _filters_in_position contains only BL24I-OP-ATTN-01:MP1:INPOS and BL24I-OP-ATTN-01:MP2:INPOS
  • _calculated_filter_states are soft signals that are all high
  • _change is a soft signal that's a no-op

If we don't do this in this issue can you put this in a new issue please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made an issue here #928

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.

I think it would be clearer about what's going on if we just reframe it all as read-only vs settable Attenuators. I've done this in #931, let me know what you think. Sorry to jump on it and re-write it but it seemed easier than trying to articulate what I meant

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.

Create an Attenuator base class
2 participants