-
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
Port UndulatorDCM
to ophyd-async
#461
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0ff71bc
Rename DCM.py to dcm.py
callumforrester f2b32ce
Naively port DCM to ophyd-async
callumforrester 5d41025
Begin moving Undulator and UndulatorDCM to ophyd-async
callumforrester 242da6b
Port UndulatorDCM to ophyd-async and remove energy signal
callumforrester de34ba9
Tidy and document UndulatorDCM class
callumforrester de32163
Make UndulatorDCM file I/O asynchronous
callumforrester 7060696
Document undulator and dcm
callumforrester aca5199
Update Undulator system test
callumforrester 3961241
Document and test undular and dcm classes
callumforrester 88b7909
Fix UndulatorDCM instantiation on i03
callumforrester c63b2bf
Remove MO-DCM-01: prefix from hardcoding
callumforrester da44327
Make undulator enum inherit from str
callumforrester d305391
Move ID gap lookup table into util module
callumforrester c1ae952
Remove commented out code
callumforrester 78d4bd3
Simplify undulator system test
callumforrester 8e66fc5
Stop staging undulator and dcm during read tests
callumforrester 7c3fdaf
Fix import errors and formatting
callumforrester 48091cd
Move I03 energy change lookup table path attributes from Undulator an…
callumforrester d91bb3e
Update based on breaking changes in ophyd-async
callumforrester 23bded3
Make more maintainable hint names
callumforrester ea806c5
(#397) Update adjuster to allow ophyd_async motors
DominicOram d905a29
Merge branch 'main' into 389-and-397-undulator-dcm-ophyd-async
DominicOram 360db19
(#397) Update to work for latest ophyd_async
DominicOram 830adfe
(#397) Updated undulator to use add_children_as_readables
DominicOram 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 was deleted.
Oops, something went wrong.
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,39 @@ | ||
from ophyd_async.core import StandardReadable | ||
from ophyd_async.epics.motion import Motor | ||
from ophyd_async.epics.signal import epics_signal_r | ||
|
||
|
||
class DCM(StandardReadable): | ||
""" | ||
A double crystal monochromator (DCM), used to select the energy of the beam. | ||
|
||
perp describes the gap between the 2 DCM crystals which has to change as you alter | ||
the angle to select the requested energy. | ||
|
||
offset ensures that the beam exits the DCM at the same point, regardless of energy. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
prefix: str, | ||
name: str = "", | ||
) -> None: | ||
with self.add_children_as_readables(): | ||
self.bragg_in_degrees = Motor(prefix + "BRAGG") | ||
self.roll_in_mrad = Motor(prefix + "ROLL") | ||
self.offset_in_mm = Motor(prefix + "OFFSET") | ||
self.perp_in_mm = Motor(prefix + "PERP") | ||
self.energy_in_kev = Motor(prefix + "ENERGY") | ||
self.pitch_in_mrad = Motor(prefix + "PITCH") | ||
self.wavelength = Motor(prefix + "WAVELENGTH") | ||
|
||
# temperatures | ||
self.xtal1_temp = epics_signal_r(float, prefix + "TEMP1") | ||
self.xtal2_temp = epics_signal_r(float, prefix + "TEMP2") | ||
self.xtal1_heater_temp = epics_signal_r(float, prefix + "TEMP3") | ||
self.xtal2_heater_temp = epics_signal_r(float, prefix + "TEMP4") | ||
self.backplate_temp = epics_signal_r(float, prefix + "TEMP5") | ||
self.perp_temp = epics_signal_r(float, prefix + "TEMP6") | ||
self.perp_sub_assembly_temp = epics_signal_r(float, prefix + "TEMP7") | ||
|
||
super().__init__(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 |
---|---|---|
@@ -1,28 +1,34 @@ | ||
from enum import Enum | ||
|
||
from ophyd import Component, Device, EpicsMotor, EpicsSignalRO | ||
from ophyd_async.core import StandardReadable | ||
from ophyd_async.epics.motion import Motor | ||
from ophyd_async.epics.signal import epics_signal_r | ||
|
||
# The acceptable difference, in mm, between the undulator gap and the DCM | ||
# energy, when the latter is converted to mm using lookup tables | ||
UNDULATOR_DISCREPANCY_THRESHOLD_MM = 2e-3 | ||
|
||
|
||
class UndulatorGapAccess(Enum): | ||
class UndulatorGapAccess(str, Enum): | ||
ENABLED = "ENABLED" | ||
DISABLED = "DISABLED" | ||
|
||
|
||
class Undulator(Device): | ||
gap_motor = Component(EpicsMotor, "BLGAPMTR") | ||
current_gap = Component(EpicsSignalRO, "CURRGAPD") | ||
gap_access = Component(EpicsSignalRO, "IDBLENA") | ||
gap_discrepancy_tolerance_mm: float = UNDULATOR_DISCREPANCY_THRESHOLD_MM | ||
class Undulator(StandardReadable): | ||
""" | ||
An Undulator-type insertion device, used to control photon emission at a given | ||
beam energy. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
lookup_table_path="/dls_sw/i03/software/daq_configuration/lookup/BeamLine_Undulator_toGap.txt", | ||
*args, | ||
**kwargs, | ||
): | ||
super().__init__(*args, **kwargs) | ||
self.lookup_table_path = lookup_table_path | ||
prefix: str, | ||
name: str = "", | ||
) -> None: | ||
with self.add_children_as_readables(): | ||
self.gap_motor = Motor(prefix + "BLGAPMTR") | ||
self.current_gap = epics_signal_r(float, prefix + "CURRGAPD") | ||
self.gap_access = epics_signal_r(UndulatorGapAccess, prefix + "IDBLENA") | ||
self.gap_discrepancy_tolerance_mm: float = UNDULATOR_DISCREPANCY_THRESHOLD_MM | ||
|
||
super().__init__(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
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.
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.
👍 Nice comment, thanks!