diff --git a/xtreme_bec/device_configs/optics.yaml b/xtreme_bec/device_configs/optics.yaml index 03dbe57..20ef80f 100644 --- a/xtreme_bec/device_configs/optics.yaml +++ b/xtreme_bec/device_configs/optics.yaml @@ -1,65 +1,75 @@ -cmu_rox: - readoutPriority: baseline - description: "Collimating mirror rotation x" - deviceClass: ophyd_devices.EpicsMotor +cmu_y: + description: CMU y pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-CMU:ROX" - onFailure: retry + prefix: X07MA-OP-CMU + override_suffixes: + user_readback: :oy + user_setpoint: :ty.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -cmu_roy: - readoutPriority: baseline - description: "Collimating mirror rotation y" - deviceClass: ophyd_devices.EpicsMotor +cmu_z: + description: CMU z pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-CMU:ROY" - onFailure: retry + prefix: X07MA-OP-CMU + override_suffixes: + user_readback: :oz + user_setpoint: :tz.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -cmu_roz: - readoutPriority: baseline - description: "Collimating mirror rotation z" - deviceClass: ophyd_devices.EpicsMotor +cmu_rx: + description: CMU Rx pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-CMU:ROZ" - onFailure: retry + prefix: X07MA-OP-CMU + override_suffixes: + user_readback: :oRx + user_setpoint: :tRx.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -cmu_try: - readoutPriority: baseline - description: "Collimating mirror translation y" - deviceClass: ophyd_devices.EpicsMotor +cmu_ry: + description: CMU Ry pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-CMU:TRY" - onFailure: retry + prefix: X07MA-OP-CMU + override_suffixes: + user_readback: :oRy + user_setpoint: :tRy.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -cmu_trz: - readoutPriority: baseline - description: "Collimating mirror translation z" - deviceClass: ophyd_devices.EpicsMotor +cmu_rz: + description: CMU Rz pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-CMU:TRZ" - onFailure: retry + prefix: X07MA-OP-CMU + override_suffixes: + user_readback: :oRz + user_setpoint: :tRz.A enabled: true - readOnly: false - softwareTrigger: false + 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 @@ -102,68 +112,68 @@ grating_beta: deviceTags: - optics -fmu_rox: - readoutPriority: baseline - description: "Focusing mirror rotation x" - deviceClass: ophyd_devices.EpicsMotor +fmu_y: + description: FMU y pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-FMU:ROX" - onFailure: retry + prefix: X07MA-OP-FMU + override_suffixes: + user_readback: :oy + user_setpoint: :ty.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -fmu_roy: - readoutPriority: baseline - description: "Focusing mirror rotation y" - deviceClass: ophyd_devices.EpicsMotor +fmu_z: + description: FMU z pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-FMU:ROY" - onFailure: retry + prefix: X07MA-OP-FMU + override_suffixes: + user_readback: :oz + user_setpoint: :tz.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -fmu_roz: - readoutPriority: baseline - description: "Focusing mirror rotation z" - deviceClass: ophyd_devices.EpicsMotor +fmu_rx: + description: FMU Rx pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-FMU:ROZ" - onFailure: retry + prefix: X07MA-OP-FMU + override_suffixes: + user_readback: :oRx + user_setpoint: :tRx.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -fmu_try: - readoutPriority: baseline - description: "Focusing mirror translation y" - deviceClass: ophyd_devices.EpicsMotor +fmu_ry: + description: FMU Ry pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-FMU:TRY" - onFailure: retry + prefix: X07MA-OP-FMU + override_suffixes: + user_readback: :oRy + user_setpoint: :tRy.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics -fmu_trz: - readoutPriority: baseline - description: "Focusing mirror translation z" - deviceClass: ophyd_devices.EpicsMotor +fmu_rz: + description: FMU Rz pseudo motor + deviceClass: xtreme_bec.devices.mirror_pseudo.MirrorPseudo deviceConfig: - prefix: "X07MA-OP-FMU:TRZ" - onFailure: retry + prefix: X07MA-OP-FMU + override_suffixes: + user_readback: :oRz + user_setpoint: :tRz.A enabled: true - readOnly: false - softwareTrigger: false + readoutPriority: baseline deviceTags: - optics @@ -179,68 +189,3 @@ exit_slit: softwareTrigger: false deviceTags: - optics - -rmu_rox: - readoutPriority: baseline - description: "Refocusing mirror rotation x" - deviceClass: ophyd_devices.EpicsMotor - deviceConfig: - prefix: "X07MA-OP-RMU:ROX" - onFailure: retry - enabled: true - readOnly: false - softwareTrigger: false - deviceTags: - - optics - -rmu_roy: - readoutPriority: baseline - description: "Refocusing mirror rotation y" - deviceClass: ophyd_devices.EpicsMotor - deviceConfig: - prefix: "X07MA-OP-RMU:ROY" - onFailure: retry - enabled: true - readOnly: false - softwareTrigger: false - deviceTags: - - optics - -rmu_roz: - readoutPriority: baseline - description: "Refocusing mirror rotation z" - deviceClass: ophyd_devices.EpicsMotor - deviceConfig: - prefix: "X07MA-OP-RMU:ROZ" - onFailure: retry - enabled: true - readOnly: false - softwareTrigger: false - deviceTags: - - optics - -rmu_try: - readoutPriority: baseline - description: "Refocusing mirror translation y" - deviceClass: ophyd_devices.EpicsMotor - deviceConfig: - prefix: "X07MA-OP-RMU:TRY" - onFailure: retry - enabled: true - readOnly: false - softwareTrigger: false - deviceTags: - - optics - -rmu_trz: - readoutPriority: baseline - description: "Refocusing mirror translation z" - deviceClass: ophyd_devices.EpicsMotor - deviceConfig: - prefix: "X07MA-OP-RMU:TRZ" - onFailure: retry - enabled: true - readOnly: false - softwareTrigger: false - deviceTags: - - optics diff --git a/xtreme_bec/devices/mirror_pseudo.py b/xtreme_bec/devices/mirror_pseudo.py new file mode 100644 index 0000000..0e9b3a0 --- /dev/null +++ b/xtreme_bec/devices/mirror_pseudo.py @@ -0,0 +1,23 @@ +from ophyd import Component as Cpt +from ophyd import EpicsSignal +from ophyd_devices.devices.simple_positioner import PSISimplePositionerBase +from ophyd_devices.utils.psi_device_base_utils import TransitionStatus + + +class MirrorPseudo(PSISimplePositionerBase): + user_readback = Cpt(EpicsSignal, "R") + user_setpoint = Cpt(EpicsSignal, "S") + motor_done_move = Cpt(EpicsSignal, ":BUSY") + + def _setup_move(self, position): + """Move and do not wait until motion is complete (asynchronous)""" + + def _done_cb(status, *args, **kwargs): + self._done_moving(success=status.success) + self._move_completion_status = None + + self._move_completion_status = TransitionStatus(self.motor_done_move, transitions=[1, 0]) + self.user_setpoint.put(position, wait=False) + + self.cancel_on_stop(self._move_completion_status) + self._move_completion_status.add_callback(_done_cb) diff --git a/xtreme_bec/scans/otf_scan.py b/xtreme_bec/scans/otf_scan.py index 8c7e3ed..b26dbc7 100644 --- a/xtreme_bec/scans/otf_scan.py +++ b/xtreme_bec/scans/otf_scan.py @@ -123,7 +123,6 @@ class OTFScan(ScanBase): devices, e.g. devices that have a short timeout. The pre-scan logic is typically implemented on the device itself. """ - self.actions.pre_scan_all_devices() self.dev.mirror_theta.base_velocity.put(self.default_velocity / 10) self.dev.grating_beta.base_velocity.put(self.default_velocity / 10) @@ -144,6 +143,8 @@ class OTFScan(ScanBase): self.dev.grating_beta.velocity.put(beta_speed) self.mono.sync_with_undulator.put(1) + self.actions.pre_scan_all_devices() + @scan_hook def scan_core(self): """