feat: consolidate devices and improve undulator handling
This commit is contained in:
1 parent
c7fbb3e02d
commit
858aa5a396
11 files changed
+765
-527
No files matched your search
@@ -0,0 +1,57 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from ophyd.sim import make_fake_device
|
||||
from ophyd.status import Status
|
||||
|
||||
from xtreme_bec.devices.cff import Cff
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cff():
|
||||
return make_fake_device(Cff)("X07MA-", name="cff")
|
||||
|
||||
|
||||
def test_set_confirms_energy_without_waiting_for_cff_readback(cff):
|
||||
cff.cff.sim_put(1.8)
|
||||
|
||||
def confirm(value):
|
||||
cff_put.assert_called_once_with(2.25, wait=True)
|
||||
assert cff.cff.get() == 1.8
|
||||
assert value == 1
|
||||
status = Status()
|
||||
status.set_finished()
|
||||
return status
|
||||
|
||||
with (
|
||||
patch.object(cff.cff, "put") as cff_put,
|
||||
patch.object(cff.confirm_energy, "set", side_effect=confirm) as confirm_set,
|
||||
):
|
||||
status = cff.set(2.25)
|
||||
|
||||
status.wait(timeout=1)
|
||||
assert status.success
|
||||
confirm_set.assert_called_once_with(1)
|
||||
|
||||
|
||||
def test_failed_cff_write_does_not_confirm_energy(cff):
|
||||
with (
|
||||
patch.object(cff.cff, "put", side_effect=RuntimeError("CFF write failed")),
|
||||
patch.object(cff.confirm_energy, "set") as confirm_set,
|
||||
):
|
||||
with pytest.raises(RuntimeError, match="CFF write failed"):
|
||||
cff.set(2.25)
|
||||
|
||||
confirm_set.assert_not_called()
|
||||
|
||||
|
||||
def test_set_returns_confirmation_status(cff):
|
||||
confirmation = Status()
|
||||
with patch.object(cff.confirm_energy, "set", return_value=confirmation):
|
||||
status = cff.set(2.25)
|
||||
|
||||
assert status is confirmation
|
||||
assert not status.done
|
||||
confirmation.set_exception(RuntimeError("Energy confirmation failed"))
|
||||
with pytest.raises(RuntimeError, match="Energy confirmation failed"):
|
||||
status.wait(timeout=1)
|
||||
@@ -1,146 +1,157 @@
|
||||
valve:
|
||||
readoutPriority: baseline
|
||||
description: "Endstation valve"
|
||||
deviceClass: xtreme_bec.devices.VacuumValve
|
||||
deviceConfig:
|
||||
prefix: "X07MA-OP-VG13:"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- endstation
|
||||
# BEC Device Configuration File
|
||||
#
|
||||
# The device config consists of a mapping of device names to their configurations.
|
||||
#
|
||||
# The following fields are required for each device:
|
||||
# - deviceClass: The class of the device (e.g., ophyd_devices.SimPositioner).
|
||||
# - enabled: A boolean indicating if the device is enabled.
|
||||
# - readoutPriority: Determines how the device is read out during a scan. Possible values are ["monitored", "baseline", "async", "on_request", "continuous"].
|
||||
#
|
||||
# Optional fields (defaults shown):
|
||||
# - connectionTimeout: Connection timeout in seconds. Default is 5.
|
||||
# - description: A string description of the device. Default is "" (empty string).
|
||||
# - deviceConfig: A dictionary of configuration parameters specific to the device class. Default is None.
|
||||
# - deviceTags: A list/set of tags associated with the device. Default is an empty list/set.
|
||||
# - needs: A list of other device names that this device depends on. Default is [].
|
||||
# - onFailure: The action to take on failure. Possible values are ["buffer", "retry", "raise"]. Default is "retry".
|
||||
# - readOnly: A boolean indicating if the device is read-only. Default is false.
|
||||
# - softwareTrigger: A boolean indicating if the device uses software triggering. Default is false.
|
||||
# - userParameter: A dictionary of user-defined parameters. Default is {}.
|
||||
#
|
||||
# Default values may be omitted for brevity.
|
||||
##########################################################################################################################
|
||||
|
||||
filter:
|
||||
readoutPriority: baseline
|
||||
description: "Filter"
|
||||
deviceClass: ophyd_devices.EpicsUserMotorVME
|
||||
deviceConfig:
|
||||
prefix: "X07MA-OP-DI2:TR1"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
goldmesh1:
|
||||
readoutPriority: baseline
|
||||
description: "Gold mesh 1"
|
||||
deviceClass: ophyd_devices.EpicsMotor
|
||||
deviceConfig:
|
||||
prefix: "X07MA-OP-IO1:TR1"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- endstation
|
||||
# An example device configuration with all fields:
|
||||
|
||||
# device1:
|
||||
# deviceClass: ophyd_devices.SimPositioner
|
||||
# description: Sample positioner device
|
||||
# deviceConfig:
|
||||
# delay: 1
|
||||
# update_frequency: 10
|
||||
# deviceTags:
|
||||
# - frontend
|
||||
# - motor
|
||||
# enabled: true
|
||||
# connectionTimeout: 20
|
||||
# readoutPriority: baseline
|
||||
# needs:
|
||||
# - device2
|
||||
# - device3
|
||||
# onFailure: retry
|
||||
# readOnly: false
|
||||
# softwareTrigger: false
|
||||
# userParameter:
|
||||
# in: 23.1
|
||||
# out: -50
|
||||
|
||||
##########################################################################################################################
|
||||
|
||||
goldmesh2:
|
||||
readoutPriority: baseline
|
||||
description: "Gold mesh 2"
|
||||
deviceClass: ophyd_devices.EpicsMotor
|
||||
deviceConfig:
|
||||
prefix: "X07MA-OP-IO2:TR1"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
field_x:
|
||||
readoutPriority: baseline
|
||||
description: "Magnetic field x"
|
||||
description: Magnetic field x
|
||||
deviceClass: xtreme_bec.devices.X07MAMagnetAxis
|
||||
deviceConfig:
|
||||
axis_id: X
|
||||
ps_prefix: "X07MA-PC-PS2:"
|
||||
prefix: "X07MA-PC-MAG:"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: 'X07MA-PC-MAG:'
|
||||
ps_prefix: 'X07MA-PC-PS2:'
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
field_z:
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
description: "Magnetic field z"
|
||||
field_z:
|
||||
description: Magnetic field z
|
||||
deviceClass: xtreme_bec.devices.X07MAMagnetAxis
|
||||
deviceConfig:
|
||||
axis_id: Z
|
||||
ps_prefix: "X07MA-PC-PS1:"
|
||||
prefix: "X07MA-PC-MAG:"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: 'X07MA-PC-MAG:'
|
||||
ps_prefix: 'X07MA-PC-PS1:'
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
filter:
|
||||
description: Filter
|
||||
deviceClass: ophyd_devices.EpicsUserMotorVME
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-DI2:TR1
|
||||
deviceTags:
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
goldmesh1:
|
||||
description: Gold mesh 1
|
||||
deviceClass: ophyd_devices.EpicsMotor
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-IO1:TR1
|
||||
deviceTags:
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
goldmesh2:
|
||||
description: Gold mesh 2
|
||||
deviceClass: ophyd_devices.EpicsMotor
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-IO2:TR1
|
||||
deviceTags:
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
keithley_1:
|
||||
readoutPriority: baseline
|
||||
description: "Keithley 1 / 428 tey"
|
||||
description: Keithley 1 / 428 gain
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-PC-K428:1:setGain"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
auto_monitor: true
|
||||
read_pv: X07MA-PC-K428:1:setGain
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
keithley_2:
|
||||
readoutPriority: baseline
|
||||
description: "Keithley 2 / 428 i0"
|
||||
description: Keithley 2 / 428 i0
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-PC-K428:2:setGain"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
auto_monitor: true
|
||||
read_pv: X07MA-PC-K428:2:setGain
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
keithley_3:
|
||||
readoutPriority: baseline
|
||||
description: "Keithley 3 / 428 diode"
|
||||
description: Keithley 3 / 428 diode
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-PC-K428:3:setGain"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
auto_monitor: true
|
||||
read_pv: X07MA-PC-K428:3:setGain
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
signals:
|
||||
readoutPriority: monitored
|
||||
description: 'ADC signals'
|
||||
description: ADC signals
|
||||
deviceClass: xtreme_bec.devices.adc_signals.ADCSignals
|
||||
deviceConfig:
|
||||
prefix: 'X07MA-'
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-
|
||||
deviceTags:
|
||||
- endstation
|
||||
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: monitored
|
||||
temperature:
|
||||
readoutPriority: baseline
|
||||
description: "Temperature controller"
|
||||
description: Temperature controller
|
||||
deviceClass: xtreme_bec.devices.X07MATemperatureController
|
||||
deviceConfig:
|
||||
prefix: "X07MA-PC-TC:"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: 'X07MA-PC-TC:'
|
||||
deviceTags:
|
||||
- endstation
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
valve:
|
||||
description: Endstation valve
|
||||
deviceClass: xtreme_bec.devices.VacuumValve
|
||||
deviceConfig:
|
||||
prefix: 'X07MA-OP-VG13:'
|
||||
deviceTags:
|
||||
- endstation
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
@@ -1,209 +1,218 @@
|
||||
idgap:
|
||||
description: "Motor to control the IDGap of X07MA"
|
||||
deviceClass: ophyd_devices.devices.undulator.UndulatorGap
|
||||
deviceConfig:
|
||||
prefix: "X07MA-UIND:"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- frontend
|
||||
# BEC Device Configuration File
|
||||
#
|
||||
# The device config consists of a mapping of device names to their configurations.
|
||||
#
|
||||
# The following fields are required for each device:
|
||||
# - deviceClass: The class of the device (e.g., ophyd_devices.SimPositioner).
|
||||
# - enabled: A boolean indicating if the device is enabled.
|
||||
# - readoutPriority: Determines how the device is read out during a scan. Possible values are ["monitored", "baseline", "async", "on_request", "continuous"].
|
||||
#
|
||||
# Optional fields (defaults shown):
|
||||
# - connectionTimeout: Connection timeout in seconds. Default is 5.
|
||||
# - description: A string description of the device. Default is "" (empty string).
|
||||
# - deviceConfig: A dictionary of configuration parameters specific to the device class. Default is None.
|
||||
# - deviceTags: A list/set of tags associated with the device. Default is an empty list/set.
|
||||
# - needs: A list of other device names that this device depends on. Default is [].
|
||||
# - onFailure: The action to take on failure. Possible values are ["buffer", "retry", "raise"]. Default is "retry".
|
||||
# - readOnly: A boolean indicating if the device is read-only. Default is false.
|
||||
# - softwareTrigger: A boolean indicating if the device uses software triggering. Default is false.
|
||||
# - userParameter: A dictionary of user-defined parameters. Default is {}.
|
||||
#
|
||||
# Default values may be omitted for brevity.
|
||||
##########################################################################################################################
|
||||
|
||||
uind_mode:
|
||||
description: "UIND mode of X07MA"
|
||||
deviceClass: xtreme_bec.devices.uind_mode.UIndMode
|
||||
deviceConfig:
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
uind_harmonic:
|
||||
readoutPriority: baseline
|
||||
description: "Undulator harmonic"
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-UIND:HARMONIC"
|
||||
auto_monitor: true
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- frontend
|
||||
# An example device configuration with all fields:
|
||||
|
||||
# device1:
|
||||
# deviceClass: ophyd_devices.SimPositioner
|
||||
# description: Sample positioner device
|
||||
# deviceConfig:
|
||||
# delay: 1
|
||||
# update_frequency: 10
|
||||
# deviceTags:
|
||||
# - frontend
|
||||
# - motor
|
||||
# enabled: true
|
||||
# connectionTimeout: 20
|
||||
# readoutPriority: baseline
|
||||
# needs:
|
||||
# - device2
|
||||
# - device3
|
||||
# onFailure: retry
|
||||
# readOnly: false
|
||||
# softwareTrigger: false
|
||||
# userParameter:
|
||||
# in: 23.1
|
||||
# out: -50
|
||||
|
||||
##########################################################################################################################
|
||||
|
||||
uind_energy:
|
||||
readoutPriority: baseline
|
||||
description: "Undulator energy"
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-UIND:ENERGY-RBV"
|
||||
auto_monitor: true
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
energy:
|
||||
readoutPriority: baseline
|
||||
description: "Energy in eV"
|
||||
description: Energy in eV
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-PHS-E:GO.A"
|
||||
auto_monitor: true
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
read_pv: X07MA-PHS-E:GO.A
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
energy_mode:
|
||||
- frontend
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
description: "Energy mode. Either PGM = 0 or PGM+ID = 1"
|
||||
energy_mode:
|
||||
description: Energy mode. Either PGM = 0 or PGM+ID = 1
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-PHS-E:OPT"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
auto_monitor: true
|
||||
read_pv: X07MA-PHS-E:OPT
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1xi:
|
||||
description: "slit 1 (frontend) x ring"
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:TRXR"
|
||||
onFailure: raise
|
||||
- frontend
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1xo:
|
||||
description: "slit 1 (frontend) x wall"
|
||||
fe_slxc:
|
||||
description: slit 1 (frontend) x center
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:TRXW"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-SL1:CENTERX
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1yb:
|
||||
description: "slit 1 (frontend) y bottom"
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
fe_slxi:
|
||||
description: slit 1 (frontend) x ring
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:TRYB"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-SL1:TRXR
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1yt:
|
||||
description: "slit 1 (frontend) y top"
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
fe_slxo:
|
||||
description: slit 1 (frontend) x wall
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:TRYT"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-SL1:TRXW
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1xc:
|
||||
description: "slit 1 (frontend) x center"
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
fe_slxs:
|
||||
description: slit 1 (frontend) x size
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:CENTERX"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-SL1:SIZEX
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1xs:
|
||||
description: "slit 1 (frontend) x size"
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
fe_slyb:
|
||||
description: slit 1 (frontend) y bottom
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:SIZEX"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-SL1:TRYB
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1yc:
|
||||
description: "slit 1 (frontend) y center"
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
fe_slyc:
|
||||
description: slit 1 (frontend) y center
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:CENTERY"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-SL1:CENTERY
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
sl1ys:
|
||||
description: "slit 1 (frontend) y size"
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
fe_slys:
|
||||
description: slit 1 (frontend) y size
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-SL1:SIZEY"
|
||||
prefix: X07MA-FE-SL1:SIZEY
|
||||
deviceTags:
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
fe_slyt:
|
||||
description: slit 1 (frontend) y top
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: X07MA-FE-SL1:TRYT
|
||||
deviceTags:
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
id_alpha:
|
||||
description: Angle of linear polarization relative to the horizontal plane
|
||||
deviceClass: xtreme_bec.devices.undulator.UndulatorAlpha
|
||||
deviceConfig:
|
||||
prefix: 'X07MA-UIND:'
|
||||
deviceTags:
|
||||
- frontend
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
id_energy:
|
||||
description: Undulator energy
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig:
|
||||
auto_monitor: true
|
||||
read_pv: X07MA-UIND:ENERGY-RBV
|
||||
write_pv: X07MA-UIND:ENERGY-SP
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
- frontend
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
id_gap:
|
||||
description: Motor to control the IDGap of X07MA
|
||||
deviceClass: xtreme_bec.devices.undulator.UndulatorGap
|
||||
deviceConfig:
|
||||
prefix: 'X07MA-UIND:'
|
||||
deviceTags:
|
||||
- frontend
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
id_harmonic:
|
||||
description: Undulator harmonic
|
||||
deviceClass: xtreme_bec.devices.undulator.UndulatorHarmonic
|
||||
deviceConfig:
|
||||
prefix: 'X07MA-UIND:'
|
||||
deviceTags:
|
||||
- frontend
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
id_mode:
|
||||
description: UIND mode of X07MA
|
||||
deviceClass: xtreme_bec.devices.undulator.UndulatorMode
|
||||
deviceConfig:
|
||||
prefix: 'X07MA-UIND:'
|
||||
deviceTags:
|
||||
- frontend
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
xbpm1x:
|
||||
description: "X-ray BPM1 in frontend translation x"
|
||||
description: X-ray BPM1 in frontend translation x
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-XBPM1:TRX"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-XBPM1:TRX
|
||||
deviceTags:
|
||||
- frontend
|
||||
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
xbpm1y:
|
||||
description: "X-ray BPM1 in frontend translation y"
|
||||
description: X-ray BPM1 in frontend translation y
|
||||
deviceClass: ophyd_devices.EpicsMotorEC
|
||||
deviceConfig:
|
||||
prefix: "X07MA-FE-XBPM1:TRY"
|
||||
onFailure: raise
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
prefix: X07MA-FE-XBPM1:TRY
|
||||
deviceTags:
|
||||
- frontend
|
||||
- frontend
|
||||
enabled: true
|
||||
onFailure: raise
|
||||
readoutPriority: baseline
|
||||
@@ -1,57 +1,96 @@
|
||||
##############################################
|
||||
################## Machine ###################
|
||||
##############################################
|
||||
# BEC Device Configuration File
|
||||
#
|
||||
# The device config consists of a mapping of device names to their configurations.
|
||||
#
|
||||
# The following fields are required for each device:
|
||||
# - deviceClass: The class of the device (e.g., ophyd_devices.SimPositioner).
|
||||
# - enabled: A boolean indicating if the device is enabled.
|
||||
# - readoutPriority: Determines how the device is read out during a scan. Possible values are ["monitored", "baseline", "async", "on_request", "continuous"].
|
||||
#
|
||||
# Optional fields (defaults shown):
|
||||
# - connectionTimeout: Connection timeout in seconds. Default is 5.
|
||||
# - description: A string description of the device. Default is "" (empty string).
|
||||
# - deviceConfig: A dictionary of configuration parameters specific to the device class. Default is None.
|
||||
# - deviceTags: A list/set of tags associated with the device. Default is an empty list/set.
|
||||
# - needs: A list of other device names that this device depends on. Default is [].
|
||||
# - onFailure: The action to take on failure. Possible values are ["buffer", "retry", "raise"]. Default is "retry".
|
||||
# - readOnly: A boolean indicating if the device is read-only. Default is false.
|
||||
# - softwareTrigger: A boolean indicating if the device uses software triggering. Default is false.
|
||||
# - userParameter: A dictionary of user-defined parameters. Default is {}.
|
||||
#
|
||||
# Default values may be omitted for brevity.
|
||||
##########################################################################################################################
|
||||
|
||||
|
||||
# An example device configuration with all fields:
|
||||
|
||||
# device1:
|
||||
# deviceClass: ophyd_devices.SimPositioner
|
||||
# description: Sample positioner device
|
||||
# deviceConfig:
|
||||
# delay: 1
|
||||
# update_frequency: 10
|
||||
# deviceTags:
|
||||
# - frontend
|
||||
# - motor
|
||||
# enabled: true
|
||||
# connectionTimeout: 20
|
||||
# readoutPriority: baseline
|
||||
# needs:
|
||||
# - device2
|
||||
# - device3
|
||||
# onFailure: retry
|
||||
# readOnly: false
|
||||
# softwareTrigger: false
|
||||
# userParameter:
|
||||
# in: 23.1
|
||||
# out: -50
|
||||
|
||||
##########################################################################################################################
|
||||
|
||||
|
||||
curr:
|
||||
description: SLS ring current
|
||||
deviceClass: ophyd_devices.EpicsSignalRO
|
||||
deviceConfig:
|
||||
read_pv: AGEBD-PARAMS:CURRENT
|
||||
auto_monitor: true
|
||||
onFailure: buffer
|
||||
enabled: true
|
||||
readoutPriority: monitored
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
read_pv: AGEBD-PARAMS:CURRENT
|
||||
deviceTags:
|
||||
- machine
|
||||
|
||||
- machine
|
||||
enabled: true
|
||||
onFailure: buffer
|
||||
readOnly: true
|
||||
readoutPriority: monitored
|
||||
ofb:
|
||||
description: SLS OFB status
|
||||
deviceClass: ophyd_devices.EpicsSignalRO
|
||||
deviceConfig:
|
||||
read_pv: ARSGE-CECL-FOFB1:FOFB-OPERATE
|
||||
auto_monitor: true
|
||||
onFailure: buffer
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
read_pv: ARSGE-CECL-FOFB1:FOFB-OPERATE
|
||||
deviceTags:
|
||||
- machine
|
||||
|
||||
- machine
|
||||
enabled: true
|
||||
onFailure: buffer
|
||||
readOnly: true
|
||||
readoutPriority: baseline
|
||||
operator:
|
||||
description: SLS operator messages
|
||||
deviceClass: ophyd_devices.devices.sls_devices.SLSOperatorMessages
|
||||
deviceTags:
|
||||
- machine
|
||||
enabled: true
|
||||
onFailure: buffer
|
||||
readOnly: true
|
||||
readoutPriority: on_request
|
||||
shutter:
|
||||
description: X07MA shutter status
|
||||
deviceClass: ophyd_devices.EpicsSignalRO
|
||||
deviceConfig:
|
||||
read_pv: X07M-OP-PSYS:SH-A-OPEN
|
||||
auto_monitor: true
|
||||
onFailure: buffer
|
||||
read_pv: X07M-OP-PSYS:SH-A-OPEN
|
||||
deviceTags:
|
||||
- machine
|
||||
enabled: true
|
||||
onFailure: buffer
|
||||
readOnly: true
|
||||
readoutPriority: baseline
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- machine
|
||||
|
||||
operator:
|
||||
description: SLS operator messages
|
||||
deviceClass: ophyd_devices.devices.sls_devices.SLSOperatorMessages
|
||||
deviceConfig:
|
||||
onFailure: buffer
|
||||
enabled: true
|
||||
readoutPriority: on_request
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- machine
|
||||
@@ -1,12 +1,11 @@
|
||||
|
||||
machine:
|
||||
- !include ./machine.yaml
|
||||
endstation:
|
||||
- !include ./endstation.yaml
|
||||
|
||||
frontend:
|
||||
- !include ./frontend.yaml
|
||||
|
||||
machine:
|
||||
- !include ./machine.yaml
|
||||
|
||||
optics:
|
||||
- !include ./optics.yaml
|
||||
|
||||
endstation:
|
||||
- !include ./endstation.yaml
|
||||
@@ -1,191 +1,230 @@
|
||||
cmu_y:
|
||||
description: CMU y pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
# BEC Device Configuration File
|
||||
#
|
||||
# The device config consists of a mapping of device names to their configurations.
|
||||
#
|
||||
# The following fields are required for each device:
|
||||
# - deviceClass: The class of the device (e.g., ophyd_devices.SimPositioner).
|
||||
# - enabled: A boolean indicating if the device is enabled.
|
||||
# - readoutPriority: Determines how the device is read out during a scan. Possible values are ["monitored", "baseline", "async", "on_request", "continuous"].
|
||||
#
|
||||
# Optional fields (defaults shown):
|
||||
# - connectionTimeout: Connection timeout in seconds. Default is 5.
|
||||
# - description: A string description of the device. Default is "" (empty string).
|
||||
# - deviceConfig: A dictionary of configuration parameters specific to the device class. Default is None.
|
||||
# - deviceTags: A list/set of tags associated with the device. Default is an empty list/set.
|
||||
# - needs: A list of other device names that this device depends on. Default is [].
|
||||
# - onFailure: The action to take on failure. Possible values are ["buffer", "retry", "raise"]. Default is "retry".
|
||||
# - readOnly: A boolean indicating if the device is read-only. Default is false.
|
||||
# - softwareTrigger: A boolean indicating if the device uses software triggering. Default is false.
|
||||
# - userParameter: A dictionary of user-defined parameters. Default is {}.
|
||||
#
|
||||
# Default values may be omitted for brevity.
|
||||
##########################################################################################################################
|
||||
|
||||
|
||||
# An example device configuration with all fields:
|
||||
|
||||
# device1:
|
||||
# deviceClass: ophyd_devices.SimPositioner
|
||||
# description: Sample positioner device
|
||||
# deviceConfig:
|
||||
# delay: 1
|
||||
# update_frequency: 10
|
||||
# deviceTags:
|
||||
# - frontend
|
||||
# - motor
|
||||
# enabled: true
|
||||
# connectionTimeout: 20
|
||||
# readoutPriority: baseline
|
||||
# needs:
|
||||
# - device2
|
||||
# - device3
|
||||
# onFailure: retry
|
||||
# readOnly: false
|
||||
# softwareTrigger: false
|
||||
# userParameter:
|
||||
# in: 23.1
|
||||
# out: -50
|
||||
|
||||
##########################################################################################################################
|
||||
|
||||
|
||||
cff:
|
||||
description: PGM CFF
|
||||
deviceClass: xtreme_bec.devices.Cff
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-CMU
|
||||
override_suffixes:
|
||||
user_readback: :oy
|
||||
user_setpoint: :ty.A
|
||||
prefix: X07MA-
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
cmu_z:
|
||||
description: CMU z pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-CMU
|
||||
override_suffixes:
|
||||
user_readback: :oz
|
||||
user_setpoint: :tz.A
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
cmu_rx:
|
||||
description: CMU Rx pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-CMU
|
||||
override_suffixes:
|
||||
user_readback: :oRx
|
||||
user_setpoint: :tRx.A
|
||||
prefix: X07MA-OP-CMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
cmu_ry:
|
||||
description: CMU Ry pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-CMU
|
||||
override_suffixes:
|
||||
user_readback: :oRy
|
||||
user_setpoint: :tRy.A
|
||||
prefix: X07MA-OP-CMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
cmu_rz:
|
||||
description: CMU Rz pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-CMU
|
||||
override_suffixes:
|
||||
user_readback: :oRz
|
||||
user_setpoint: :tRz.A
|
||||
prefix: X07MA-OP-CMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
pgm_id_coupling:
|
||||
description: "PGM ID coupling"
|
||||
deviceClass: ophyd_devices.EpicsSignal
|
||||
deviceConfig:
|
||||
read_pv: X07MA-PHS-E:OPT
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
mono:
|
||||
readoutPriority: baseline
|
||||
description: "PGM Monochromator"
|
||||
deviceClass: xtreme_bec.devices.PGMMonochromator
|
||||
deviceConfig:
|
||||
prefix: "X07MA-"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
mirror_theta:
|
||||
readoutPriority: baseline
|
||||
description: "Mirror theta"
|
||||
deviceClass: ophyd_devices.EpicsUserMotorVME
|
||||
deviceConfig:
|
||||
prefix: "X07MA:m1"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
grating_beta:
|
||||
readoutPriority: baseline
|
||||
description: "Grating beta"
|
||||
deviceClass: ophyd_devices.EpicsUserMotorVME
|
||||
deviceConfig:
|
||||
prefix: "X07MA:m2"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
fmu_y:
|
||||
description: FMU y pseudo motor
|
||||
cmu_y:
|
||||
description: CMU y pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-FMU
|
||||
override_suffixes:
|
||||
user_readback: :oy
|
||||
user_setpoint: :ty.A
|
||||
prefix: X07MA-OP-CMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
fmu_z:
|
||||
description: FMU z pseudo motor
|
||||
cmu_z:
|
||||
description: CMU z pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-FMU
|
||||
override_suffixes:
|
||||
user_readback: :oz
|
||||
user_setpoint: :tz.A
|
||||
prefix: X07MA-OP-CMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
exit_slit:
|
||||
description: Exit slit
|
||||
deviceClass: ophyd_devices.EpicsSignal
|
||||
deviceConfig:
|
||||
auto_monitor: true
|
||||
read_pv: X07MA-OP-SL1SV1:TR_ISAP
|
||||
write_pv: X07MA-OP-SL1SV1:TR_AP
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
exit_slit_long:
|
||||
description: Longitudinal translation exit slit
|
||||
deviceClass: ophyd_devices.EpicsUserMotorVME
|
||||
deviceConfig:
|
||||
limits:
|
||||
- 180.0
|
||||
- 500.0
|
||||
prefix: X07MA-OP-SL1:TRX
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
fmu_rx:
|
||||
description: FMU Rx pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-FMU
|
||||
override_suffixes:
|
||||
user_readback: :oRx
|
||||
user_setpoint: :tRx.A
|
||||
prefix: X07MA-OP-FMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
fmu_ry:
|
||||
description: FMU Ry pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-FMU
|
||||
override_suffixes:
|
||||
user_readback: :oRy
|
||||
user_setpoint: :tRy.A
|
||||
prefix: X07MA-OP-FMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
fmu_rz:
|
||||
description: FMU Rz pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
prefix: X07MA-OP-FMU
|
||||
override_suffixes:
|
||||
user_readback: :oRz
|
||||
user_setpoint: :tRz.A
|
||||
prefix: X07MA-OP-FMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- optics
|
||||
|
||||
exit_slit:
|
||||
readoutPriority: baseline
|
||||
description: "Aperture between focusing and refocusing mirror"
|
||||
deviceClass: ophyd_devices.EpicsSignal
|
||||
fmu_y:
|
||||
description: FMU y pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
read_pv: "X07MA-OP-SL1SV1:TR_AP"
|
||||
onFailure: retry
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
override_suffixes:
|
||||
user_readback: :oy
|
||||
user_setpoint: :ty.A
|
||||
prefix: X07MA-OP-FMU
|
||||
deviceTags:
|
||||
- optics
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
fmu_z:
|
||||
description: FMU z pseudo motor
|
||||
deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo
|
||||
deviceConfig:
|
||||
override_suffixes:
|
||||
user_readback: :oz
|
||||
user_setpoint: :tz.A
|
||||
prefix: X07MA-OP-FMU
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
grating_beta:
|
||||
description: Grating beta
|
||||
deviceClass: ophyd_devices.EpicsUserMotorVME
|
||||
deviceConfig:
|
||||
prefix: X07MA:m2
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
mirror_theta:
|
||||
description: Mirror theta
|
||||
deviceClass: ophyd_devices.EpicsUserMotorVME
|
||||
deviceConfig:
|
||||
prefix: X07MA:m1
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
mono:
|
||||
description: PGM Monochromator
|
||||
deviceClass: xtreme_bec.devices.PGMMonochromator
|
||||
deviceConfig:
|
||||
prefix: X07MA-
|
||||
deviceTags:
|
||||
- optics
|
||||
enabled: true
|
||||
readoutPriority: baseline
|
||||
@@ -1,2 +1,4 @@
|
||||
from .cff import Cff
|
||||
from .pgm import PGMMonochromator
|
||||
from .undulator import UndulatorAlpha, UndulatorGap, UndulatorHarmonic, UndulatorMode
|
||||
from .x07ma_devices import *
|
||||
@@ -37,8 +37,20 @@ class NormSignal(Signal):
|
||||
|
||||
|
||||
class NormTEYSignals(Device):
|
||||
signal1 = Cpt(EpicsSignalRO, name="signal1", read_pv="X07MA-ES1-AI:SIGNAL0", kind="omitted")
|
||||
signal2 = Cpt(EpicsSignalRO, name="signal2", read_pv="X07MA-ES1-AI:SIGNAL1", kind="omitted")
|
||||
signal1 = Cpt(
|
||||
EpicsSignalRO,
|
||||
name="signal1",
|
||||
read_pv="X07MA-ES1-AI:SIGNAL0",
|
||||
kind="omitted",
|
||||
auto_monitor=True,
|
||||
)
|
||||
signal2 = Cpt(
|
||||
EpicsSignalRO,
|
||||
name="signal2",
|
||||
read_pv="X07MA-ES1-AI:SIGNAL1",
|
||||
kind="omitted",
|
||||
auto_monitor=True,
|
||||
)
|
||||
norm = Cpt(NormSignal, name="norm", kind="hinted")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -47,8 +59,20 @@ class NormTEYSignals(Device):
|
||||
|
||||
|
||||
class NormDIODESignals(Device):
|
||||
signal1 = Cpt(EpicsSignalRO, name="signal1", read_pv="X07MA-ES1-AI:SIGNAL3", kind="omitted")
|
||||
signal2 = Cpt(EpicsSignalRO, name="signal2", read_pv="X07MA-ES1-AI:SIGNAL2", kind="omitted")
|
||||
signal1 = Cpt(
|
||||
EpicsSignalRO,
|
||||
name="signal1",
|
||||
read_pv="X07MA-ES1-AI:SIGNAL3",
|
||||
kind="omitted",
|
||||
auto_monitor=True,
|
||||
)
|
||||
signal2 = Cpt(
|
||||
EpicsSignalRO,
|
||||
name="signal2",
|
||||
read_pv="X07MA-ES1-AI:SIGNAL2",
|
||||
kind="omitted",
|
||||
auto_monitor=True,
|
||||
)
|
||||
norm = Cpt(NormSignal, name="norm", kind="hinted")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
from enum import Enum
|
||||
from typing import Literal
|
||||
|
||||
from ophyd import Component as Cpt
|
||||
from ophyd import Device, EpicsSignal, Kind, StatusBase
|
||||
|
||||
|
||||
class UIndModeEnum(str, Enum):
|
||||
OFF = "Off"
|
||||
LINEAR_H = "Linear H"
|
||||
LINEAR_V_PLUS = "Linear V+"
|
||||
LINEAR_V_MINUS = "Linear V-"
|
||||
CIRCULAR_PLUS = "Circular+"
|
||||
CIRCULAR_MINUS = "Circular-"
|
||||
PLUS_45_DEG = "+45 deg"
|
||||
MINUS_45_DEG = "-45 deg"
|
||||
|
||||
|
||||
class UIndMode(Device):
|
||||
USER_ACCESS = ["set_mode"]
|
||||
|
||||
value = Cpt(EpicsSignal, "X07MA-UIND:MODE", auto_monitor=True, kind=Kind.hinted)
|
||||
value_string = Cpt(EpicsSignal, "X07MA-UIND:MODE", auto_monitor=True, string=True)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.value.name = self.name
|
||||
|
||||
def set_mode(
|
||||
self,
|
||||
mode: (
|
||||
Literal[
|
||||
"Off",
|
||||
"Linear H",
|
||||
"Linear V+",
|
||||
"Linear V-",
|
||||
"Circular+",
|
||||
"Circular-",
|
||||
"+45 deg",
|
||||
"-45 deg",
|
||||
]
|
||||
| int
|
||||
),
|
||||
) -> StatusBase:
|
||||
"""
|
||||
Set the undulator polarization mode.
|
||||
|
||||
Args:
|
||||
mode (Literal["Off", "Linear H", "Linear V+", "Linear V-", "Circular+", "Circular-", "+45 deg", "-45 deg"] | int): The desired polarization mode, either as a string or an integer index.
|
||||
"""
|
||||
if isinstance(mode, str):
|
||||
try:
|
||||
mode_enum = UIndModeEnum(mode)
|
||||
mode_val = mode_enum.value
|
||||
except ValueError:
|
||||
# pylint: disable=raise-missing-from
|
||||
raise ValueError(
|
||||
f"Invalid mode string: {mode}. Valid options are: {[m.value for m in UIndModeEnum]}"
|
||||
)
|
||||
elif isinstance(mode, int):
|
||||
try:
|
||||
mode_enum = list(UIndModeEnum)[mode]
|
||||
mode_val = mode_enum.value
|
||||
except IndexError:
|
||||
# pylint: disable=raise-missing-from
|
||||
raise ValueError(
|
||||
f"Invalid mode index: {mode}. Valid indices are: 0 to {len(UIndModeEnum) - 1}, corresponding to: {[m.value for m in UIndModeEnum]}"
|
||||
)
|
||||
else:
|
||||
raise TypeError("Mode must be either a string or an integer index.")
|
||||
return self.value.set(mode_val)
|
||||
@@ -0,0 +1,128 @@
|
||||
from collections.abc import Callable
|
||||
from enum import Enum
|
||||
from typing import Literal
|
||||
|
||||
from ophyd import Component as Cpt
|
||||
from ophyd import Device, EpicsSignalRO
|
||||
from ophyd_devices.devices.undulator import UndulatorAlpha as _UndulatorAlpha
|
||||
from ophyd_devices.devices.undulator import UndulatorBase
|
||||
from ophyd_devices.devices.undulator import UndulatorGap as _UndulatorGap
|
||||
from ophyd_devices.devices.undulator import UndulatorHarmonic as _UndulatorHarmonic
|
||||
from ophyd_devices.devices.undulator import UndulatorSetpointSignal, UndulatorStopSignal
|
||||
from ophyd_devices.utils.psi_device_base_utils import StatusBase
|
||||
|
||||
__all__ = [
|
||||
"UndulatorAlpha",
|
||||
"UndulatorGap",
|
||||
"UndulatorHarmonic",
|
||||
"UndulatorMode",
|
||||
"UndulatorModeEnum",
|
||||
]
|
||||
|
||||
_CMU_ONLINE_VALIDATIONS = (
|
||||
("cmu_online", 4, "CMU must be On-line (X07MA-OP-CMU:ONLINE = 4) to control the undulator."),
|
||||
)
|
||||
|
||||
|
||||
class _CMUOnlineMixin(Device):
|
||||
"""Expose the CMU state required by X-Treme undulator control validations."""
|
||||
|
||||
cmu_online = Cpt(
|
||||
EpicsSignalRO, "X07MA-OP-CMU:ONLINE", add_prefix=(), auto_monitor=True, kind="omitted"
|
||||
)
|
||||
|
||||
|
||||
class UndulatorGap(_CMUOnlineMixin, _UndulatorGap):
|
||||
"""X-Treme undulator gap control requiring the CMU to be On-line."""
|
||||
|
||||
control_validations = _UndulatorGap.control_validations + _CMU_ONLINE_VALIDATIONS
|
||||
|
||||
|
||||
class UndulatorHarmonic(_CMUOnlineMixin, _UndulatorHarmonic):
|
||||
"""X-Treme undulator harmonic control requiring the CMU to be On-line."""
|
||||
|
||||
control_validations = _UndulatorHarmonic.control_validations + _CMU_ONLINE_VALIDATIONS
|
||||
|
||||
|
||||
class UndulatorAlpha(_CMUOnlineMixin, _UndulatorAlpha):
|
||||
"""X-Treme undulator alpha control requiring the CMU to be On-line."""
|
||||
|
||||
control_validations = _UndulatorAlpha.control_validations + _CMU_ONLINE_VALIDATIONS
|
||||
|
||||
|
||||
class UndulatorModeEnum(str, Enum):
|
||||
OFF = "Off"
|
||||
LINEAR_H = "Linear H"
|
||||
LINEAR_V_PLUS = "Linear V+"
|
||||
LINEAR_V_MINUS = "Linear V-"
|
||||
CIRCULAR_PLUS = "Circular+"
|
||||
CIRCULAR_MINUS = "Circular-"
|
||||
PLUS_45_DEG = "+45 deg"
|
||||
MINUS_45_DEG = "-45 deg"
|
||||
|
||||
|
||||
class UndulatorMode(_CMUOnlineMixin, UndulatorBase):
|
||||
"""X-Treme undulator polarization positioner, completed by the IOC's DONE signal.
|
||||
|
||||
The CMU must be On-line and control must belong to the beamline.
|
||||
Use ``set("Circular+")`` or ``set(4)`` to select a mode. As with harmonic
|
||||
and alpha control, every request writes the target and waits for DONE,
|
||||
including requests for the currently selected mode.
|
||||
"""
|
||||
|
||||
control_validations = UndulatorBase.control_validations + _CMU_ONLINE_VALIDATIONS
|
||||
|
||||
setpoint = Cpt(UndulatorSetpointSignal, "MODE", auto_monitor=True, kind="hinted")
|
||||
value_string = Cpt(EpicsSignalRO, "MODE", auto_monitor=True, string=True)
|
||||
stop_signal = Cpt(UndulatorStopSignal, "STOP", auto_monitor=True, kind="omitted")
|
||||
done = Cpt(EpicsSignalRO, "DONE", auto_monitor=True, kind="omitted")
|
||||
select_control = Cpt(EpicsSignalRO, "SCTRL", auto_monitor=True)
|
||||
|
||||
def __init__(self, prefix: str = "X07MA-UIND:", **kwargs) -> None:
|
||||
super().__init__(prefix=prefix, **kwargs)
|
||||
self.setpoint.name = self.name
|
||||
|
||||
def move(
|
||||
self,
|
||||
position: (
|
||||
Literal[
|
||||
"Off",
|
||||
"Linear H",
|
||||
"Linear V+",
|
||||
"Linear V-",
|
||||
"Circular+",
|
||||
"Circular-",
|
||||
"+45 deg",
|
||||
"-45 deg",
|
||||
]
|
||||
| int
|
||||
),
|
||||
wait: bool = True,
|
||||
timeout: float | None = None,
|
||||
moved_cb: Callable | None = None,
|
||||
) -> StatusBase:
|
||||
"""Select a mode by label or index and wait for undulator completion.
|
||||
|
||||
``set()`` delegates here with ``wait=False`` and returns a pending status.
|
||||
Invalid labels and indices raise ValueError before issuing a command.
|
||||
"""
|
||||
modes = list(UndulatorModeEnum)
|
||||
if isinstance(position, str):
|
||||
try:
|
||||
mode = modes.index(UndulatorModeEnum(position))
|
||||
except ValueError as exc:
|
||||
raise ValueError(
|
||||
f"Invalid mode string: {position}. "
|
||||
f"Valid options are: {[mode.value for mode in modes]}"
|
||||
) from exc
|
||||
elif isinstance(position, int) and not isinstance(position, bool):
|
||||
if not 0 <= position < len(modes):
|
||||
raise ValueError(
|
||||
f"Invalid mode index: {position}. Valid indices are: 0 to {len(modes) - 1}."
|
||||
)
|
||||
mode = position
|
||||
else:
|
||||
raise TypeError("Mode must be either a string or an integer index.")
|
||||
|
||||
self.validate_control()
|
||||
return super().move(mode, wait=wait, timeout=timeout, moved_cb=moved_cb)
|
||||
@@ -12,7 +12,6 @@ class XtremeNeXusFormat(DefaultFormat):
|
||||
"rmu": ("refocusing_mirror", "Refocusing mirror", 29.8),
|
||||
}
|
||||
_MIRROR_AXES = ("y", "z", "rx", "ry", "rz")
|
||||
_SLIT_SIGNALS = ("sl1xi", "sl1xo", "sl1yb", "sl1yt", "sl1xc", "sl1xs", "sl1yc", "sl1ys")
|
||||
|
||||
def format(self) -> None:
|
||||
entry = self.storage.create_group("entry")
|
||||
@@ -67,10 +66,16 @@ class XtremeNeXusFormat(DefaultFormat):
|
||||
insertion_device.attrs["NX_class"] = "NXinsertion_device"
|
||||
insertion_device.create_dataset(name="type", data="undulator")
|
||||
insertion_device.create_dataset(name="description", data="Apple II undulator")
|
||||
self.safe_dataset(group=insertion_device, name="polarization", device="uind_mode")
|
||||
self.safe_dataset(group=insertion_device, name="energy", device="uind_energy")
|
||||
self.safe_dataset(group=insertion_device, name="gap", device="idgap")
|
||||
self.safe_dataset(group=insertion_device, name="harmonic", device="uind_harmonic")
|
||||
self.safe_dataset(
|
||||
group=insertion_device,
|
||||
name="polarization",
|
||||
device="id_mode",
|
||||
signal="id_mode_value_string",
|
||||
)
|
||||
self.safe_dataset(group=insertion_device, name="alpha", device="id_alpha")
|
||||
self.safe_dataset(group=insertion_device, name="energy", device="id_energy")
|
||||
self.safe_dataset(group=insertion_device, name="gap", device="id_gap")
|
||||
self.safe_dataset(group=insertion_device, name="harmonic", device="id_harmonic")
|
||||
|
||||
xbpm = instrument.create_group("xbpm_1")
|
||||
xbpm.attrs["NX_class"] = "NXpositioner"
|
||||
@@ -96,14 +101,14 @@ class XtremeNeXusFormat(DefaultFormat):
|
||||
front_end_slit = instrument.create_group("front_end_slit")
|
||||
front_end_slit.attrs["NX_class"] = "NXslit"
|
||||
front_end_slit.create_dataset(name="description", data="Front-end slit 1")
|
||||
self.safe_dataset(group=front_end_slit, name="x_gap", device="sl1xs")
|
||||
self.safe_dataset(group=front_end_slit, name="y_gap", device="sl1ys")
|
||||
self.safe_dataset(group=front_end_slit, name="x_translation", device="sl1xc")
|
||||
self.safe_dataset(group=front_end_slit, name="y_translation", device="sl1yc")
|
||||
self.safe_dataset(group=front_end_slit, name="x_ring_blade", device="sl1xi")
|
||||
self.safe_dataset(group=front_end_slit, name="x_wall_blade", device="sl1xo")
|
||||
self.safe_dataset(group=front_end_slit, name="y_bottom_blade", device="sl1yb")
|
||||
self.safe_dataset(group=front_end_slit, name="y_top_blade", device="sl1yt")
|
||||
self.safe_dataset(group=front_end_slit, name="x_gap", device="fe_slxs")
|
||||
self.safe_dataset(group=front_end_slit, name="y_gap", device="fe_slys")
|
||||
self.safe_dataset(group=front_end_slit, name="x_translation", device="fe_slxc")
|
||||
self.safe_dataset(group=front_end_slit, name="y_translation", device="fe_slyc")
|
||||
self.safe_dataset(group=front_end_slit, name="x_ring_blade", device="fe_slxi")
|
||||
self.safe_dataset(group=front_end_slit, name="x_wall_blade", device="fe_slxo")
|
||||
self.safe_dataset(group=front_end_slit, name="y_bottom_blade", device="fe_slyb")
|
||||
self.safe_dataset(group=front_end_slit, name="y_top_blade", device="fe_slyt")
|
||||
|
||||
##############################
|
||||
#### Optics ####
|
||||
@@ -113,7 +118,7 @@ class XtremeNeXusFormat(DefaultFormat):
|
||||
self.safe_dataset(group=monochromator, name="energy", device="mono")
|
||||
self.safe_dataset(group=monochromator, name="beamline_energy", device="energy")
|
||||
self.safe_dataset(group=monochromator, name="mode", device="energy_mode")
|
||||
self.safe_dataset(group=monochromator, name="cff", device="mono", signal="cff")
|
||||
self.safe_dataset(group=monochromator, name="cff", device="cff")
|
||||
|
||||
plane_mirror = monochromator.create_group("plane_mirror")
|
||||
plane_mirror.attrs["NX_class"] = "NXmirror"
|
||||
@@ -198,15 +203,11 @@ class XtremeNeXusFormat(DefaultFormat):
|
||||
"async", []
|
||||
)
|
||||
|
||||
print(f"signal is async: {signals_is_async}")
|
||||
|
||||
if signals_is_async:
|
||||
prefix = "signals_data_"
|
||||
else:
|
||||
prefix = "signals_"
|
||||
|
||||
print(self.written_async_signals)
|
||||
|
||||
self.safe_dataset(group=group, name="s1", device="signals", signal=f"{prefix}s1")
|
||||
self.safe_dataset(group=group, name="s2", device="signals", signal=f"{prefix}s2")
|
||||
self.safe_dataset(group=group, name="s3", device="signals", signal=f"{prefix}s3")
|
||||
|
||||
Reference in new issue
Block a user