-
Notifications
You must be signed in to change notification settings - Fork 12
Create common mirror classes and populate I05s mirrors #1418
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
Open
Villtord
wants to merge
40
commits into
main
Choose a base branch
from
common-mirror
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
06b0c49
create i05-shared and move pgm there
db2bf55
change names to snake case
7a22f71
minor import change
49c2eb5
create base mirror
81166cb
add m1 mirror
a6bb6f1
add XY and XYZ collimating mirrrors
6e7a533
fix i10
ed3592b
add piezo mirror
1c292b6
add more mirrors
56e074b
move i05-shared to beamline specific utils
ba7f819
amend beamlines init file
b89e69a
move i05-shared to beamline specific utils
0c889cb
amend beamlines init file
d7a226e
Merge branch 'create-i05-shared-beamline-module' into common-mirror
Villtord 6b57679
remove XY coll mirror - will be a separate issue
2cfcce8
Merge remote-tracking branch 'origin/main' into common-mirror
ca52f00
rename mirror class
fdce221
move xyzpitchyawroll to motors
ccf8b5a
rename pgm
2a97a79
add explicit parameters to child classes
2d0bd84
Merge branch 'main' into common-mirror
Villtord 80422f0
make common mirror classes generic of strictenum
0cc78a0
Merge branch 'main' into common-mirror
Villtord 5dc0c0d
Merge branch 'main' into common-mirror
Villtord c6046b7
add mirrors controls and docstring
64eff2b
Merge branch 'main' into common-mirror
Villtord e322968
Merge branch 'main' into common-mirror
Villtord 0710b47
make all new classes depend on Stage only
7642ffa
Merge branch 'main' into common-mirror
Villtord 559937b
Merge branch 'main' into common-mirror
Villtord b979135
Merge branch 'main' into common-mirror
Villtord 9fdfcfd
relocate common_mirror to I05 devices
08322a2
Merge branch 'main' into common-mirror
Villtord a0cfb59
add comment on mirrors connection
74045b9
make mirrors locatable and stoppable, fix typos
c6be37c
Merge branch 'main' into common-mirror
Villtord 67e180e
Merge branch 'main' into common-mirror
Villtord 8d00f21
fix merge
b752967
fix merge
5388298
fix test
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 hidden or 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 |
|---|---|---|
| @@ -1,11 +1,41 @@ | ||
| from ophyd_async.core import StrictEnum | ||
|
|
||
| from dodal.common.beamlines.beamline_utils import device_factory | ||
| from dodal.devices.i05.enums import Grating | ||
| from dodal.devices.i05.common_mirror import XYZPiezoSwitchingMirror | ||
| from dodal.devices.motors import XYZPitchYawRollStage | ||
| from dodal.devices.pgm import PGM | ||
| from dodal.utils import BeamlinePrefix | ||
|
|
||
| PREFIX = BeamlinePrefix("i05", "I") | ||
|
|
||
|
|
||
| class M3MJ6Mirror(StrictEnum): | ||
| UNKNOWN = "Unknown" | ||
| MJ6 = "MJ6" | ||
| M3 = "M3" | ||
| REFERENCE = "Reference" | ||
|
|
||
|
|
||
| class Grating(StrictEnum): | ||
| PT_400 = "400 lines/mm" | ||
| C_1600 = "C 1600 lines/mm" | ||
| RH_1600 = "Rh 1600 lines/mm" | ||
| PT_800 = "B 800 lines/mm" | ||
|
|
||
|
|
||
| @device_factory() | ||
| def pgm() -> PGM: | ||
| return PGM(prefix=f"{PREFIX.beamline_prefix}-OP-PGM-01:", grating=Grating) | ||
|
|
||
|
|
||
| @device_factory() | ||
| def m1_collimating_mirror() -> XYZPitchYawRollStage: | ||
| return XYZPitchYawRollStage(prefix=f"{PREFIX.beamline_prefix}-OP-COL-01:") | ||
|
|
||
|
|
||
| @device_factory() | ||
| def m3mj6_switching_mirror() -> XYZPiezoSwitchingMirror: | ||
| return XYZPiezoSwitchingMirror( | ||
| prefix=f"{PREFIX.beamline_prefix}-OP-SWTCH-01:", | ||
| mirrors=M3MJ6Mirror, | ||
| ) |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| from dodal.devices.i05.enums import Grating | ||
| from dodal.devices.i05.common_mirror import ( | ||
| XYZPiezoCollimatingMirror, | ||
| XYZPiezoSwitchingMirror, | ||
| XYZSwitchingMirror, | ||
| ) | ||
|
|
||
| __all__ = ["Grating"] | ||
| __all__ = ["XYZSwitchingMirror", "XYZPiezoCollimatingMirror", "XYZPiezoSwitchingMirror"] |
This file contains hidden or 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,120 @@ | ||
| from typing import Generic, TypeVar | ||
|
|
||
| from ophyd_async.core import StrictEnum | ||
| from ophyd_async.epics.core import epics_signal_rw, epics_signal_x | ||
|
|
||
| from dodal.devices.motors import _X, _Y, _Z, XYZPitchYawRollStage | ||
|
|
||
| TMirror = TypeVar("TMirror", bound=StrictEnum) | ||
|
|
||
|
|
||
| class XYZSwitchingMirror(XYZPitchYawRollStage, Generic[TMirror]): | ||
| """ | ||
| Set of mirrors on a hexapod with x,y,z and yaw, pitch, roll motors. | ||
| To change mirror one need to set mirror enum and trigger mirror change. | ||
Villtord marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| prefix: str, | ||
| mirrors: type[TMirror], | ||
| name: str = "", | ||
| x_infix: str = _X, | ||
| y_infix: str = _Y, | ||
| z_infix: str = _Z, | ||
| pitch_infix: str = "PITCH", | ||
| yaw_infix: str = "YAW", | ||
| roll_infix: str = "ROLL", | ||
| mirror_read_suffix: str = "MIRCTRL:RBV:MIRROR", | ||
| mirror_write_suffix: str = "MIRCTRL:DMD:MIRROR", | ||
| mirror_change_suffix: str = "MIRCTRL:SEQ:CHNG:MIRROR.PROC", | ||
| mirror_abort_suffix: str = "MIRCTRL:DMD:ABORT.PROC", | ||
| ): | ||
| with self.add_children_as_readables(): | ||
| self.mirror = epics_signal_rw( | ||
| mirrors, | ||
| read_pv=prefix + mirror_read_suffix, | ||
| write_pv=prefix + mirror_write_suffix, | ||
| ) | ||
|
|
||
| self.mirror_change = epics_signal_x(write_pv=prefix + mirror_change_suffix) | ||
| self.mirror_abort = epics_signal_x(write_pv=prefix + mirror_abort_suffix) | ||
|
|
||
| super().__init__( | ||
| prefix, name, x_infix, y_infix, z_infix, pitch_infix, yaw_infix, roll_infix | ||
| ) | ||
|
|
||
|
|
||
| class XYZPiezoCollimatingMirror(XYZPitchYawRollStage): | ||
| """ | ||
| Collimating mirror on a hexapod with x,y,z and yaw, pitch, roll motors. | ||
| In addition there is a fine pitch piezo motor. | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| prefix: str, | ||
| name: str = "", | ||
| x_infix: str = _X, | ||
| y_infix: str = _Y, | ||
| z_infix: str = _Z, | ||
| pitch_infix: str = "PITCH", | ||
| yaw_infix: str = "YAW", | ||
| roll_infix: str = "ROLL", | ||
| fpitch_read_suffix: str = "FPITCH:RBV", | ||
| fpitch_write_suffix: str = "FPITCH:DMD", | ||
| ): | ||
| with self.add_children_as_readables(): | ||
| self.fine_pitch = epics_signal_rw( | ||
| float, | ||
| read_pv=prefix + fpitch_read_suffix, | ||
| write_pv=prefix + fpitch_write_suffix, | ||
| ) | ||
| super().__init__( | ||
| prefix, name, x_infix, y_infix, z_infix, pitch_infix, yaw_infix, roll_infix | ||
| ) | ||
|
|
||
|
|
||
| class XYZPiezoSwitchingMirror(XYZPitchYawRollStage, Generic[TMirror]): | ||
| """ | ||
| Set of mirrors on a hexapod with x,y,z and yaw, pitch, roll motors. | ||
| To change mirror one need to set mirror enum and trigger mirror change. | ||
| In addition there is a fine pitch piezo motor. | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| prefix: str, | ||
| mirrors: type[TMirror], | ||
| name: str = "", | ||
| x_infix: str = _X, | ||
| y_infix: str = _Y, | ||
| z_infix: str = _Z, | ||
| pitch_infix: str = "PITCH", | ||
| yaw_infix: str = "YAW", | ||
| roll_infix: str = "ROLL", | ||
| fpitch_read_suffix: str = "FPITCH:RBV", | ||
| fpitch_write_suffix: str = "FPITCH:DMD", | ||
| mirror_read_suffix: str = "MIRCTRL:RBV:MIRROR", | ||
| mirror_write_suffix: str = "MIRCTRL:DMD:MIRROR", | ||
| mirror_change_suffix: str = "MIRCTRL:SEQ:CHNG:MIRROR.PROC", | ||
| mirror_abort_suffix: str = "MIRCTRL:DMD:ABORT.PROC", | ||
Villtord marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ): | ||
| with self.add_children_as_readables(): | ||
| self.fine_pitch = epics_signal_rw( | ||
| float, | ||
| read_pv=prefix + fpitch_read_suffix, | ||
| write_pv=prefix + fpitch_write_suffix, | ||
| ) | ||
| self.mirror = epics_signal_rw( | ||
| mirrors, | ||
| read_pv=prefix + mirror_read_suffix, | ||
| write_pv=prefix + mirror_write_suffix, | ||
| ) | ||
|
|
||
| self.mirror_change = epics_signal_x(write_pv=prefix + mirror_change_suffix) | ||
Villtord marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| self.mirror_abort = epics_signal_x(write_pv=prefix + mirror_abort_suffix) | ||
Villtord marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| super().__init__( | ||
| prefix, name, x_infix, y_infix, z_infix, pitch_infix, yaw_infix, roll_infix | ||
| ) | ||
This file was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.