-
Notifications
You must be signed in to change notification settings - Fork 10
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
98a6931
Create an AttenuatorBase class and use it
noemifrisina 2d540fd
Merge branch 'main' into 889_attenuator-base
noemifrisina 50a1e54
Link issue and clarify comment
noemifrisina 70775e6
Add to docstring for fractional transmission
noemifrisina dde0393
Add link to issue
noemifrisina cf72c55
Merge branch 'main' into 889_attenuator-base
noemifrisina 90a8d14
Rename BaseAttenuator to ReadOnlyAttenuator (#931)
DominicOram 86ff155
Merge branch 'main' into 889_attenuator-base
noemifrisina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from ophyd_async.core import StandardReadable | ||
from ophyd_async.epics.core import epics_signal_r, epics_signal_rw, epics_signal_x | ||
|
||
# This will need a set | ||
# See https://github.com/DiamondLightSource/dodal/issues/928 | ||
|
||
|
||
class AttenuatorBase(StandardReadable): | ||
"""An attenuator base class with a minimum set of common PVs to phase1 beamlines. | ||
|
||
The desired transmission value is fractional (i.e 0-1) instead of a percentage, \ | ||
and when read from the device the actual_transmission will also return a fraction. | ||
""" | ||
|
||
def __init__(self, prefix: str, name: str = "") -> None: | ||
self._desired_transmission = epics_signal_rw(float, prefix + "T2A:SETVAL1") | ||
self._use_current_energy = epics_signal_x(prefix + "E2WL:USECURRENTENERGY.PROC") | ||
|
||
with self.add_children_as_readables(): | ||
self.actual_transmission = epics_signal_r(float, prefix + "MATCH") | ||
|
||
super().__init__(name) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 aset
.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 onlyBL24I-OP-ATTN-01:MP1:INPOS
andBL24I-OP-ATTN-01:MP2:INPOS
_calculated_filter_states
are soft signals that are all high_change
is a soft signal that's a no-opIf we don't do this in this issue can you put this in a new issue please?
There was a problem hiding this comment.
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