-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #461 from DiamondLightSource/389-and-397-undulator…
…-dcm-ophyd-async Port `UndulatorDCM` to ophyd-async
- Loading branch information
Showing
14 changed files
with
370 additions
and
200 deletions.
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.