-
Notifications
You must be signed in to change notification settings - Fork 11
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
Make attenuator with enum filter values #969
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
24bb351
Make common attenuator filter
olliesilvester ac38ea6
Create EnumFilterAttenuator device
olliesilvester 6b26e15
Merge remote-tracking branch 'origin/main' into 927_common_filter_wheel
olliesilvester bec4bd3
Attach issue to comment
olliesilvester 1e43ab0
fix typo
olliesilvester ee96c46
Update src/dodal/devices/attenuator/attenuator.py
olliesilvester 0268af6
Update src/dodal/beamlines/i02_1.py
olliesilvester 0578092
Update src/dodal/beamlines/i02_1.py
olliesilvester 00a9274
Update tests/devices/unit_tests/p99/test_p99_stage.py
olliesilvester 1d7b0fe
Update src/dodal/devices/attenuator/filter.py
olliesilvester a2f5dd0
Update src/dodal/beamlines/p99.py
olliesilvester 47f18bd
Remove FilterSelection intermediate class
olliesilvester a12d4c1
Merge branch 'main' into 927_common_filter_wheel
olliesilvester b7cdb40
Remove all references to intermediate class
olliesilvester 9ed3eca
fix typing
olliesilvester 6ef9288
Update docstring
olliesilvester 38da921
Update src/dodal/devices/attenuator/filter_selections.py
olliesilvester df48e84
Change name of p99 filter selection
olliesilvester 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""Beamline i02-1 is also known as VMXm, or I02J""" | ||
|
||
from dodal.common.beamlines.beamline_utils import ( | ||
device_factory, | ||
) | ||
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline | ||
from dodal.devices.attenuator.attenuator import EnumFilterAttenuator | ||
from dodal.devices.attenuator.filter_selections import ( | ||
I02_1FilterFourSelections, | ||
I02_1FilterOneSelections, | ||
I02_1FilterThreeSelections, | ||
I02_1FilterTwoSelections, | ||
) | ||
from dodal.log import set_beamline as set_log_beamline | ||
from dodal.utils import BeamlinePrefix, get_beamline_name | ||
|
||
BL = get_beamline_name("i02-1") | ||
PREFIX = BeamlinePrefix(BL, suffix="J") | ||
set_log_beamline(BL) | ||
set_utils_beamline(BL) | ||
|
||
|
||
@device_factory() | ||
def attenuator() -> EnumFilterAttenuator: | ||
"""Get the i02-1 attenuator device, instantiate it if it hasn't already been. | ||
If this is called when already instantiated in i02-1, it will return the existing object. | ||
""" | ||
|
||
return EnumFilterAttenuator( | ||
f"{PREFIX.beamline_prefix}-OP-ATTN-01:", | ||
( | ||
I02_1FilterOneSelections, | ||
I02_1FilterTwoSelections, | ||
I02_1FilterThreeSelections, | ||
I02_1FilterFourSelections, | ||
), | ||
) |
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
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,11 @@ | ||
from ophyd_async.core import StandardReadable, SubsetEnum | ||
from ophyd_async.epics.core import epics_signal_rw | ||
|
||
|
||
class FilterMotor(StandardReadable): | ||
def __init__( | ||
self, prefix: str, filter_selections: type[SubsetEnum], name: str = "" | ||
): | ||
with self.add_children_as_readables(): | ||
self.user_setpoint = epics_signal_rw(filter_selections, f"{prefix}SELECT") | ||
super().__init__(name=name) |
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,72 @@ | ||
from ophyd_async.core import SubsetEnum | ||
|
||
|
||
class p99StageSelections(SubsetEnum): | ||
olliesilvester marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EMPTY = "Empty" | ||
MN5UM = "Mn 5um" | ||
FE = "Fe (empty)" | ||
CO5UM = "Co 5um" | ||
NI5UM = "Ni 5um" | ||
CU5UM = "Cu 5um" | ||
ZN5UM = "Zn 5um" | ||
ZR = "Zr (empty)" | ||
MO = "Mo (empty)" | ||
RH = "Rh (empty)" | ||
PD = "Pd (empty)" | ||
AG = "Ag (empty)" | ||
CD25UM = "Cd 25um" | ||
W = "W (empty)" | ||
PT = "Pt (empty)" | ||
USER = "User" | ||
|
||
|
||
class I02_1FilterOneSelections(SubsetEnum): | ||
EMPTY = "Empty" | ||
AL8 = "Al8" | ||
AL15 = "Al15" | ||
AL25 = "Al25" | ||
AL1000 = "Al1000" | ||
TI50 = "Ti50" | ||
TI100 = "Ti100" | ||
TI200 = "Ti200" | ||
TI400 = "Ti400" | ||
TWO_TIMES_TI500 = "2xTi500" | ||
|
||
|
||
class I02_1FilterTwoSelections(SubsetEnum): | ||
EMPTY = "Empty" | ||
AL50 = "Al50" | ||
AL100 = "Al100" | ||
AL125 = "Al125" | ||
AL250 = "Al250" | ||
AL500 = "Al500" | ||
AL1000 = "Al1000" | ||
TI50 = "Ti50" | ||
TI100 = "Ti100" | ||
TWO_TIMES_TI500 = "2xTi500" | ||
|
||
|
||
class I02_1FilterThreeSelections(SubsetEnum): | ||
EMPTY = "Empty" | ||
AL15 = "Al15" | ||
AL25 = "Al25" | ||
AL50 = "Al50" | ||
AL100 = "Al100" | ||
AL250 = "Al250" | ||
AL1000 = "Al1000" | ||
TI50 = "Ti50" | ||
TI100 = "Ti100" | ||
TI200 = "Ti200" | ||
|
||
|
||
class I02_1FilterFourSelections(SubsetEnum): | ||
EMPTY = "Empty" | ||
AL15 = "Al15" | ||
AL25 = "Al25" | ||
AL50 = "Al50" | ||
AL100 = "Al100" | ||
AL250 = "Al250" | ||
AL500 = "Al500" | ||
TI300 = "Ti300" | ||
TI400 = "Ti400" | ||
TI500 = "Ti500" |
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
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.
Ugly, but maybe it has to be. Open to suggestions