updates to yamls
This commit is contained in:
@@ -1,792 +0,0 @@
|
||||
sls_current:
|
||||
description: SLS current
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'ARS07-DPCT-0100:CURR', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- SLS
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
ps1_press:
|
||||
description: Photon shutter 1 pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-FE-PSH1-VMCC-1010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
abs_press:
|
||||
description: Absorber pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-FE-VMCC-0000:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
lu_bpmsum:
|
||||
description: LU BPM Summed
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-OP-LUBPM:SumAll:MeanValue_RBV', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bpm
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
ss_bpmsum:
|
||||
description: SS BPM Summed
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-ES-SSBPM1:SumAll:MeanValue_RBV', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bpm
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
ps3_press:
|
||||
description: Pumpstand 3 pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-FE-PUM3-VMCC-2010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
bsf_press:
|
||||
description: BSF pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-OP-BSF-VMFR-0010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
bb1_press:
|
||||
description: BB1 pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-OP-BBU-VMFR-1010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
dcm_press:
|
||||
description: DCM pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-OP-DCM-VMFR-3010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
bb2_press:
|
||||
description: BB2 pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-OP-BBD-VMFR-4010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
lu_press:
|
||||
description: LU pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-OP-LU-VMFR-5010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
ps2_press:
|
||||
description: Photon shutter 2 pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-OP-PSH1-VMFR-7010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
ss_press:
|
||||
description: SS pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-ES-SS1-VMFR-0010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
kb_press:
|
||||
description: KBV pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-ES-KBV-VMFR-0010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
bcu_press:
|
||||
description: BCU pressure
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig: {read_pv: 'X10SA-ES-BCU-VMFR-0010:PRESSURE', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- press
|
||||
readOnly: true
|
||||
softwareTrigger: false
|
||||
fe_sxr:
|
||||
description: 'FE Slit X Ring'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:TRXR'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
fe_syt:
|
||||
description: 'FE Slit Y top'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:TRYT'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
fe_sxw:
|
||||
description: 'FE Slit X Wall'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:TRXW'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
fe_syb:
|
||||
description: 'FE SlitY Bottom'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:TRYB'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
fe_sxcen:
|
||||
description: 'FE Slit X Centre'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:CENTERX'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
fe_sxsize:
|
||||
description: 'FE Slit X Size'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:SIZEX'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
fe_sycen:
|
||||
description: 'FE Slit Y Centre'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:CENTERY'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
fe_sysize:
|
||||
description: 'FE Slit Y Size'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-FE-SLDI:SIZEY'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- fe
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s1_xw:
|
||||
description: 'BSF slit outboard'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-SLH:TRXW'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s1_xr:
|
||||
description: 'BSF slit inboard'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-SLH:TRXR'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s1_yt:
|
||||
description: 'BSF slit top'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-SLV:TRYT'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s1_yb:
|
||||
description: 'BSF slit bottom'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-SLV:TRYB'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s1_xcen:
|
||||
description: 'BSF X centre'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-SLH:CENTER'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s1_xsize:
|
||||
description: 'BSF X size'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-SLH:SIZE'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s1_ycen:
|
||||
description: 'BSF Y centre'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-SLV:CENTER'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
opf1_y:
|
||||
description: 'BSF Filter 1 Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-FI1:TRY'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
opf2_y:
|
||||
description: 'BSF Filter 2 Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-FI2:TRY'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- bsf
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
dcm_bragg:
|
||||
description: 'DCM Bragg angle'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-DCM:ROTY'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- dcm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
dcm_x:
|
||||
description: 'DCM lateral'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-DCM:TRX'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- dcm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
dcm_perp:
|
||||
description: 'DCM Perp'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-DCM:TRX-C2'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- dcm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
dcm_pitch:
|
||||
description: 'DCM 2nd crystal pitch'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-OP-DCM:ROTY-C2'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- dcm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
ssbpm_x:
|
||||
description: 'SS BPM X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSBPM1:TRX1'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
ssbpm_y:
|
||||
description: 'SS BPM Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSBPM1:TRY1'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_xw:
|
||||
description: 'SS slit wall'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSH1:TRXW'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_xr:
|
||||
description: 'SS slit ring'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSH1:TRXR'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_xcen:
|
||||
description: 'SS slit X centre'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSH1:CENTER'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_xsize:
|
||||
description: 'SS slit X size'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSH1:CENTER'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_yt:
|
||||
description: 'SS slit top'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSV1:TRYT'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_yb:
|
||||
description: 'SS slit bottom'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSV1:TRYB'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_ycen:
|
||||
description: 'SS slit Y centre'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSV1:CENTER'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
s2_ysize:
|
||||
description: 'SS slit Y size'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSSV1:SIZE'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
xeye_x:
|
||||
description: 'SS X-ray eye X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSXI1:TRX1'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
xeye_y:
|
||||
description: 'SS X-ray eye Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SSXI1:TRY1'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- ss
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_xu:
|
||||
description: 'VFM Upstream X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:TRXU'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_xd:
|
||||
description: 'VFM Downstream X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:TRXD'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_yur:
|
||||
description: 'VFM Upstream Ring Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:TRYUR'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_yw:
|
||||
description: 'VFM Wall Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:TRYW'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_ydr:
|
||||
description: 'VFM Downstream Ring Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:TRYDR'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_bu:
|
||||
description: 'VFM Upstream Bender'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:BNDU'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_bd:
|
||||
description: 'VFM Downstream Bender'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:BNDD'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_yaw:
|
||||
description: 'VFM Virtual Yaw'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:YAW'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_roll:
|
||||
description: 'VFM Virtual Roll'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:ROLL'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_pitch:
|
||||
description: 'VFM Virtual Pitch'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:PITCH'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_lat:
|
||||
description: 'VFM Virtual X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:TRX'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
vfm_vert:
|
||||
description: 'VFM Virtual Y '
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-VFM:TRY'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- vfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_xu:
|
||||
description: 'HFM Upstream X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:TRXU'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_xd:
|
||||
description: 'HFM Downstream X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:TRXD'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_yuw:
|
||||
description: 'HFM Upstream Wall Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:TRYUW'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_yr:
|
||||
description: 'HFM Ring Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:TRYR'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_ydw:
|
||||
description: 'HFM Downstream Wall Y'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:TRYDW'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_bu:
|
||||
description: 'HFM Upstream Bender'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:BNDU'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_bd:
|
||||
description: 'HFM Downstream Bender'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:BNDD'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_yaw:
|
||||
description: 'HFM Virtual Yaw'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:YAW'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_roll:
|
||||
description: 'HFM Virtual Roll'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:ROLL'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_pitch:
|
||||
description: 'HFM Virtual Pitch'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:PITCH'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_lat:
|
||||
description: 'HFM Virtual X'
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:TRX'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
hfm_vert:
|
||||
description: 'HFM Virtual Y '
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-HFM:TRY'}
|
||||
onFailure: buffer
|
||||
enabled: False
|
||||
readoutPriority: monitored
|
||||
deviceTags:
|
||||
- hfm
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
@@ -196,14 +196,14 @@ states:
|
||||
det_cov: 'close'
|
||||
diag_y: out
|
||||
fl_bright: 'on'
|
||||
aerotech_x: in
|
||||
aerotech_y: work
|
||||
aerotech_z: work
|
||||
aerotech_u: mount
|
||||
smargon_x: mount
|
||||
smargon_y: mount
|
||||
smargon_chi: mount
|
||||
smargon_phi: mount
|
||||
# aerotech_x: in
|
||||
# aerotech_y: work
|
||||
# aerotech_z: work
|
||||
# aerotech_u: mount
|
||||
# smargon_x: mount
|
||||
# smargon_y: mount
|
||||
# smargon_chi: mount
|
||||
# smargon_phi: mount
|
||||
xrf_pos: out
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
aerotech_x:
|
||||
userParameter: {"type": continuous, "in": 0.0, "out": -10.0, "safe": -50, "tol": 0.5}
|
||||
aerotech_y:
|
||||
userParameter: {"type": continuous, "mount": 0.0, "work": 0.01, "tol": 0.002}
|
||||
aerotech_z:
|
||||
userParameter: {"type": continuous, "mount": 0.0, "work": 0.02, "tol": 0.01}
|
||||
aerotech_u:
|
||||
userParameter: {"type": continuous, "mount": 0.0}
|
||||
smargon_x:
|
||||
userParameter: {"type": continuous, "mount": 0.0}
|
||||
smargon_y:
|
||||
userParameter: {"type": continuous, "mount": 0.0}
|
||||
smargon_z:
|
||||
userParameter: {"type": continuous, "mount": 18.0}
|
||||
smargon_chi:
|
||||
userParameter: {"type": continuous, "mount": 0.0}
|
||||
smargon_phi:
|
||||
userParameter: {"type": continuous, "mount": 0.0}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,130 +0,0 @@
|
||||
bl_bright:
|
||||
description: Backlight Brightness
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig: {read_pv: 'X10SA-ES-BL:SET', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type": continuous, "on": 1.3, "off": 0.0, "tol": 0.01}
|
||||
|
||||
bl_pos:
|
||||
description: Backlight Positioner
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig: {read_pv: 'X10SA-ES-BL:POS-SET', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type":discrete, "in": 1, "out": 0}
|
||||
|
||||
bs_pos:
|
||||
description: Beamstop Positioner
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig: {read_pv: 'X10SA-ES-BS:POS-SET', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type":discrete, "in": 1, "out": 0}
|
||||
|
||||
bs_z:
|
||||
description: Beamstop Z
|
||||
deviceClass: ophyd_devices.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-BS:TRZ'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type": continuous, "min": 13, "samp": 15, "work_min": 20, "safe": 41, "max_blin": 42, "max_blout": 70}
|
||||
|
||||
coll_y:
|
||||
description: Collimator Y
|
||||
deviceClass: ophyd_devices.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-COL:TRY'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type": continuous, "in": 41.5, "out": 20.0, "intermediate": 32, "park": 1,"tol":0.05}
|
||||
|
||||
cryo_pos:
|
||||
description: Cryo positioner
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig: {read_pv: 'X10SA-ES-CS:POS-SET', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type":discrete, "in": 1, "out": 0}
|
||||
|
||||
det_cov:
|
||||
description: Detector cover
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig: {read_pv: 'X10SA-ES-DETCOV:SET', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type":discrete, "open": 2, "close": 1}
|
||||
|
||||
diag_y:
|
||||
description: Scintillator/diode Y
|
||||
deviceClass: ophyd_devices.EpicsMotor
|
||||
deviceConfig: {prefix: 'X10SA-ES-SCL:TRY'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type": continuous, "scint": 38.62, "i1": 44.0, "out": 20.0,"park": 1,"tol":0.3}
|
||||
|
||||
fl_bright:
|
||||
description: Frontlight Brightness
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig: {read_pv: 'X10SA-ES-FL:SET', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type": continuous, "on": 3.0, "off": 0.0, "tol": 0.01}
|
||||
|
||||
xrf_pos:
|
||||
description: XRF Positioner
|
||||
deviceClass: ophyd.EpicsSignal
|
||||
deviceConfig: {read_pv: 'X10SA-ES-XRF:POS-SET', auto_monitor: true}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- state
|
||||
readOnly: False
|
||||
softwareTrigger: false
|
||||
userParameter: {"type":discrete, "in": 1, "out": 0}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
smargon:
|
||||
description: REST-based device which connects to Smargopolo
|
||||
deviceClass: pxii_bec.devices.smargopolo_smargon.Smargon
|
||||
deviceConfig: {prefix: 'http://localhost:8000'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- smargon
|
||||
- motors
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
@@ -1,40 +1,40 @@
|
||||
base_config:
|
||||
- !include ./pxii-standard-devices.yaml
|
||||
sample_env:
|
||||
- !include ./se_devices.yaml
|
||||
id_gap:
|
||||
readoutPriority: baseline
|
||||
description: undulator gap
|
||||
deviceClass: pxii_bec.devices.undulator.UndulatorGap
|
||||
deviceConfig:
|
||||
prefix: 'X10SA-UIND:'
|
||||
onFailure: buffer
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
- !include ./pxii-devices.yaml
|
||||
# sample_env:
|
||||
# - !include ./pxii-state-devices.yaml
|
||||
# id_gap:
|
||||
# readoutPriority: baseline
|
||||
# description: undulator gap
|
||||
# deviceClass: pxii_bec.devices.undulator.UndulatorGap
|
||||
# deviceConfig:
|
||||
# prefix: 'X10SA-UIND:'
|
||||
# onFailure: buffer
|
||||
# enabled: true
|
||||
# readOnly: false
|
||||
# softwareTrigger: false
|
||||
|
||||
smargon:
|
||||
description: REST-based device which connects to Smargopolo
|
||||
deviceClass: pxii_bec.devices.smargopolo_smargon.Smargon
|
||||
deviceConfig: {prefix: 'http://x10sa-smargopolo.psi.ch:3000'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- smargon
|
||||
- motors
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
# smargon:
|
||||
# description: REST-based device which connects to Smargopolo
|
||||
# deviceClass: pxii_bec.devices.smargopolo_smargon.Smargon
|
||||
# deviceConfig: {prefix: 'http://x10sa-smargopolo.psi.ch:3000'}
|
||||
# onFailure: buffer
|
||||
# enabled: True
|
||||
# readoutPriority: baseline
|
||||
# deviceTags:
|
||||
# - smargon
|
||||
# - motors
|
||||
# readOnly: false
|
||||
# softwareTrigger: false
|
||||
|
||||
aerotech:
|
||||
description: REST-based device which connects to AareScan and Aerotech
|
||||
deviceClass: pxii_bec.devices.aerotech.Aerotech
|
||||
deviceConfig: {prefix: 'http://mx-x10sa-queue-01:5234'}
|
||||
onFailure: buffer
|
||||
enabled: True
|
||||
readoutPriority: baseline
|
||||
deviceTags:
|
||||
- aerotech
|
||||
- motors
|
||||
readOnly: false
|
||||
softwareTrigger: false
|
||||
# aerotech:
|
||||
# description: REST-based device which connects to AareScan and Aerotech
|
||||
# deviceClass: pxii_bec.devices.aerotech.Aerotech
|
||||
# deviceConfig: {prefix: 'http://mx-x10sa-queue-01:5234'}
|
||||
# onFailure: buffer
|
||||
# enabled: True
|
||||
# readoutPriority: baseline
|
||||
# deviceTags:
|
||||
# - aerotech
|
||||
# - motors
|
||||
# readOnly: false
|
||||
# softwareTrigger: false
|
||||
|
||||
Executable → Regular
+32
-12
@@ -139,8 +139,8 @@ def rock(**kwargs):
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
## create a dock area:
|
||||
dock_area = bec.gui.new()
|
||||
wr = dock_area.new(gui.available_widgets.Waveform)
|
||||
dock_area = bec.gui.new(name="Rock", geometry = [4000, 900, 700, 700])
|
||||
wr = dock_area.new(bec.gui.available_widgets.Waveform)
|
||||
|
||||
# width of rocking curve of perfect xtal: at 20 keV: 14 urad == 0.0008 deg
|
||||
|
||||
@@ -194,12 +194,14 @@ def rock(**kwargs):
|
||||
mot = motb
|
||||
pos0 = motb_rb
|
||||
|
||||
s = scans.line_scan(mot, -dx, dx, steps=50, exp_time=time, relative=True)
|
||||
# md = scan.metadata["bec"]
|
||||
wr.title = f"RockingScan at Energy of {e}"
|
||||
wr.plot(x_name=mot.name, y_name=det.name) ##set names/axes first !
|
||||
wr.x_label = mot.name
|
||||
wr.y_label = det.name
|
||||
wr.plot(device_x=mot, device_y=det) ##set names/axes first !
|
||||
|
||||
s = scans.line_scan(mot, -dx, dx, steps=50, exp_time=time, relative=True)
|
||||
|
||||
if ax == 0:
|
||||
data_x = s.scan.live_data.dcm_pitch.dcm_pitch.val
|
||||
else:
|
||||
@@ -237,6 +239,23 @@ def rock(**kwargs):
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################
|
||||
### Help PROGRAMS
|
||||
|
||||
#############################
|
||||
### just reconfigure beaml
|
||||
#############################
|
||||
def loadmac():
|
||||
|
||||
bec.macros.load_all_user_macros()
|
||||
# d, planner = init_beamline_environment()
|
||||
|
||||
|
||||
|
||||
################################
|
||||
### FITTING PROGRAMS
|
||||
|
||||
@@ -859,8 +878,8 @@ def colliscan(direction: str, range=0.3, nsteps=30, stime=0.5, centre=1):
|
||||
"""
|
||||
import sys
|
||||
|
||||
dock_area = bec.gui.new()
|
||||
wr = dock_area.new().new(bec.gui.available_widgets.Waveform)
|
||||
dock_area = bec.gui.new(name="ColliScan", geometry = [4000, 900, 700, 700])
|
||||
wr = dock_area.new(bec.gui.available_widgets.Waveform)
|
||||
|
||||
# check if i1 DIODE is IN
|
||||
# if not, aks to be moved
|
||||
@@ -1033,18 +1052,19 @@ def slitscan(device_location: str, direction: str, range: 1, nsteps=50, centre=0
|
||||
print("Ok, cancelled")
|
||||
return
|
||||
|
||||
dock_area = bec.gui.new()
|
||||
wr = dock_area.new(gui.available_widgets.Waveform)
|
||||
dock_area = bec.gui.new(name="SlitScan", geometry = [4000, 900, 700, 700])
|
||||
wr = dock_area.new(bec.gui.available_widgets.Waveform)
|
||||
|
||||
pos0 = mot.user_readback.get()
|
||||
siz0 = size.user_readback.get()
|
||||
umv(size, s_closed)
|
||||
|
||||
s = scans.line_scan(mot, -dx, dx, steps=nsteps, exp_time=time, relative=True)
|
||||
wr.plot(x_name=mot.name, y_name=det.name)
|
||||
wr.plot(device_x=mot, device_y=det)
|
||||
|
||||
wr.x_label = mot.name
|
||||
wr.y_label = det.name
|
||||
|
||||
s = scans.line_scan(mot, -dx, dx, steps=nsteps, exp_time=time, relative=True)
|
||||
# this gives funny errors: ARRAYS differently read?
|
||||
# data_x = s.scan.data.devices[mot.name][mot.name].read()["value"]
|
||||
# data_x = s.scan.live_data["fe_sxcen"]["fe_sxcen"].val
|
||||
@@ -1494,8 +1514,8 @@ def scan_window(wname="Scan", fit=True):
|
||||
nam = "waveform_dock_"+wname
|
||||
dock_area = bec.gui.new(name=wname, geometry = [4000, 900, 700, 700])
|
||||
|
||||
w1 = dock_area.new(gui.available_widgets.Waveform) # CALL gui.available_widgets to see what is available
|
||||
w2 = dock_area.new(gui.available_widgets.ScanControl)
|
||||
w1 = dock_area.new(bec.gui.available_widgets.Waveform) # CALL gui.available_widgets to see what is available
|
||||
w2 = dock_area.new(bec.gui.available_widgets.ScanControl)
|
||||
|
||||
# Add signals to the WaveformWidget
|
||||
w1.plot(device_x = dev.id_gap, device_y = dev.lu_bpmsum)
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
class KBMirror:
|
||||
def __init__(self, mirror_type="PXII_HFM"):
|
||||
self.mirror_type = mirror_type
|
||||
self._load_parameters()
|
||||
|
||||
def _load_parameters(self):
|
||||
if self.mirror_type == "PXII_VFM":
|
||||
self.C0 = 0.284078
|
||||
self.C1 = -0.471525
|
||||
self.P2 = 0.583490
|
||||
self.P3 = -0.372950
|
||||
self.L1 = -0.955798
|
||||
self.curv_approx_fact = 1.0121
|
||||
self.s1 = 24.15 #24.35
|
||||
self.s2 = 1.45
|
||||
self.asym0 = 0.08
|
||||
|
||||
elif self.mirror_type == "PXII_HFM":
|
||||
self.C0 = 0.060453
|
||||
self.C1 = -0.457812
|
||||
self.P2 = 0.586057
|
||||
self.P3 = -0.088093
|
||||
self.L1 = -0.999445
|
||||
self.curv_approx_fact = 0.995
|
||||
self.s1 = 24.90 #25.10
|
||||
self.s2 = 0.7
|
||||
self.asym0 = -0.0107
|
||||
|
||||
else:
|
||||
raise ValueError(f"Unknown mirror type: {self.mirror_type}")
|
||||
|
||||
def bend_to_curvature(self, BU, BD):
|
||||
BU0 = (BD - self.L1 * BU - self.P3) / (self.P2 - self.L1)
|
||||
curv = self.C0 + self.C1 * BU0
|
||||
a = BU - BU0
|
||||
asym = a * np.sqrt(1 - self.L1**2)
|
||||
return curv, asym
|
||||
|
||||
def curvature_to_bend(self, curv, asym):
|
||||
BU0 = (curv - self.C0) / self.C1
|
||||
BD0 = self.P2 * BU0 + self.P3
|
||||
a = asym / np.sqrt(1 - self.L1**2)
|
||||
BU = a + BU0
|
||||
BD = BD0 + self.L1 * a
|
||||
return BU, BD
|
||||
|
||||
def ellipse_to_curvature(self, s2, th_mrad):
|
||||
R = 2 * self.s1 * s2 / (self.s1 + s2) / np.sin(th_mrad / 1000)
|
||||
curv = (1 / R) * 1000 * self.curv_approx_fact
|
||||
return curv
|
||||
|
||||
def curvature_to_ellipse(self, curv, th_mrad):
|
||||
curv0 = curv / self.curv_approx_fact / 1000
|
||||
R = 1 / curv0
|
||||
s2 = self.s1 / (2 * self.s1 / (R * np.sin(th_mrad / 1000)) - 1)
|
||||
return s2
|
||||
|
||||
def get_benders(self, th=2.0, defocus_mm=0.0, user_asymmetry=0.0):
|
||||
asym = self.asym0 + user_asymmetry
|
||||
s2_target = self.s2 + defocus_mm / 1000
|
||||
curv = self.ellipse_to_curvature(s2_target, th)
|
||||
BU, BD = self.curvature_to_bend(curv, asym)
|
||||
return BU, BD
|
||||
|
||||
def readback(self, BU, BD, th=2.0):
|
||||
curv, asym = self.bend_to_curvature(BU, BD)
|
||||
s2_rb = self.curvature_to_ellipse(curv, th)
|
||||
defocus_mm = (s2_rb - self.s2) * 1000
|
||||
bend_rad_m = 1/curv *1000
|
||||
return {
|
||||
"curvature": curv,
|
||||
"bend_rad_m": bend_rad_m,
|
||||
"asymmetry": asym,
|
||||
"s2": s2_rb,
|
||||
"defocus_mm": defocus_mm
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -227,11 +227,11 @@ def long_gscan(estart=7, end_en=20.5, g_low=4.5, g_high=9.0, nsteps=1500):
|
||||
)
|
||||
resol = (g_high - g_low) / nsteps
|
||||
print(f"nsteps = {nsteps}; resolution is {resol} mm")
|
||||
dock_area = bec.gui.new("LongGapScan")
|
||||
wr = dock_area.new(gui.available_widgets.Waveform)
|
||||
dock_area = bec.gui.new("LongGapScan", geometry = [4000, 900, 1200, 700])
|
||||
wr = dock_area.new(bec.gui.available_widgets.Waveform)
|
||||
mot = dev.id_gap
|
||||
det = dev.lu_bpmsum
|
||||
wr.plot(x_name=mot.name, y_name=det.name) ## names first !
|
||||
wr.plot(device_x=mot, device_y=det) ## names first !
|
||||
wr.x_label = mot.name
|
||||
wr.y_label = det.name
|
||||
g0 = dev.id_gap.readback.get()
|
||||
@@ -304,11 +304,11 @@ def gscan(centre=0, gomax=0, detune=0):
|
||||
"""
|
||||
import time
|
||||
|
||||
dock_area = bec.gui.new()
|
||||
wr = dock_area.new(gui.available_widgets.Waveform)
|
||||
dock_area = bec.gui.new(name="GapScan", geometry = [4000, 900, 700, 700])
|
||||
wr = dock_area.new(bec.gui.available_widgets.Waveform)
|
||||
mot = dev.id_gap
|
||||
det = dev.lu_bpmsum
|
||||
wr.plot(x_name=mot.name, y_name=det.name) ## names first !
|
||||
wr.plot(device_x=mot, device_y=det) ## names first !
|
||||
# wr.plot(x=mot.name,y=det.name) ### this comes later
|
||||
wr.x_label = mot.name
|
||||
wr.y_label = det.name
|
||||
@@ -323,7 +323,7 @@ def gscan(centre=0, gomax=0, detune=0):
|
||||
# indmax = np.argmax(bpm_data)
|
||||
# gm = gap_data[indmax]
|
||||
|
||||
gcen, xm = fit_plot(gap_data, bpm_data, model="gauss")
|
||||
gcen, xm = fit_plot(gap_data, bpm_data, model="voigt")
|
||||
|
||||
if gomax:
|
||||
gm = xm
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
"""Planner to move between beamline statesΩ"""
|
||||
"""Planner to move between beamline states"""
|
||||
|
||||
import time
|
||||
from collections import defaultdict, deque
|
||||
from enum import Enum
|
||||
|
||||
# from enums import BeamlineState, TemperatureMode
|
||||
# from matcher import DeviceMatcher, nonzero_is_on
|
||||
|
||||
|
||||
class BeamlineState(str, Enum):
|
||||
"""List of beamline states"""
|
||||
|
||||
ROBOT_SAMPLE_EXCHANGE = "robot_sample_exchange"
|
||||
SAMPLE_ALIGNMENT = "sample_alignment"
|
||||
DATA_COLLECTION = "data_collection"
|
||||
@@ -22,6 +24,7 @@ class BeamlineState(str, Enum):
|
||||
|
||||
class TemperatureMode(str, Enum):
|
||||
"""List of temperature modes"""
|
||||
|
||||
CRYO = "cryo"
|
||||
ROOM_TEMP = "room_temp"
|
||||
|
||||
@@ -59,7 +62,6 @@ class StateChangePlanner:
|
||||
target.update(self.modifiers[modifier])
|
||||
return target
|
||||
|
||||
|
||||
def move_to(self, state_name, modifier=None):
|
||||
"""Move devices to the correct positions to achieve a given state"""
|
||||
if isinstance(state_name, str):
|
||||
@@ -124,12 +126,8 @@ class StateChangePlanner:
|
||||
config = self._merged_state(state, modifier)
|
||||
|
||||
# Check if all devices match their expected positions
|
||||
if all(self.devices[d].is_at(p)
|
||||
for d, p in config.items()
|
||||
if d not in ignore_keys
|
||||
):
|
||||
# print(f"Current state: {state.name}, Modifier: {modifier.name if modifier else 'None'}")
|
||||
matches.append((state.name, modifier.name if modifier else 'None'))
|
||||
if all(self.devices[d].is_at(p) for d, p in config.items() if d not in ignore_keys):
|
||||
matches.append((state.name, modifier.name if modifier else "None"))
|
||||
|
||||
return matches if matches else None
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
""" Build the sample environment devices"""
|
||||
"""Build the sample environment devices"""
|
||||
|
||||
import os
|
||||
import yaml
|
||||
|
||||
# from position_device import PositionDevice
|
||||
|
||||
def motor_resolver(bec_name):
|
||||
|
||||
candidates = [
|
||||
bec_name,
|
||||
bec_name.replace("_", "."),
|
||||
]
|
||||
def motor_resolver(bec_name):
|
||||
"""Used to handle aerotech and smargon motors"""
|
||||
|
||||
candidates = [bec_name, bec_name.replace("_", ".")]
|
||||
|
||||
for path in candidates:
|
||||
try:
|
||||
@@ -24,9 +25,9 @@ def motor_resolver(bec_name):
|
||||
|
||||
raise ValueError(f"Cannot resolve motor for '{bec_name}'")
|
||||
|
||||
def build_devices(yaml_file, mock_devices):
|
||||
""" Build devices from the beamline states yaml"""
|
||||
|
||||
def build_devices(yaml_file, mock_devices):
|
||||
"""Build devices from the beamline states yaml"""
|
||||
|
||||
state_devices = {}
|
||||
|
||||
@@ -41,30 +42,103 @@ def build_devices(yaml_file, mock_devices):
|
||||
if not user:
|
||||
continue
|
||||
|
||||
if bec_name in ("aerotech", "smargon"):
|
||||
|
||||
tol = user.get("tol", 0.1)
|
||||
tol = user.get("tol", 0.01)
|
||||
|
||||
positions = {
|
||||
k: v for k, v in user.items()
|
||||
if k not in ("type", "tol")
|
||||
}
|
||||
for axis in ["x", "y", "z", "u", "chi", "phi"]:
|
||||
|
||||
allow_arbitrary = (user["type"] == "continuous")
|
||||
|
||||
|
||||
positions = user.get(axis)
|
||||
|
||||
pos_dev = PositionDevice(
|
||||
bec_name=bec_name,
|
||||
mot_device = motor_resolver(bec_name),
|
||||
positions=positions,
|
||||
tol=tol,
|
||||
allow_arbitrary=allow_arbitrary,
|
||||
use_mock=bec_name in mock_devices,
|
||||
)
|
||||
if positions is None:
|
||||
continue
|
||||
|
||||
component_name = f"{bec_name}_{axis}"
|
||||
|
||||
pos_dev = PositionDevice(
|
||||
bec_name=component_name,
|
||||
mot_device=motor_resolver(component_name),
|
||||
positions=positions,
|
||||
tol=tol,
|
||||
allow_arbitrary=True,
|
||||
use_mock=component_name in mock_devices,
|
||||
)
|
||||
|
||||
state_devices[component_name] = pos_dev
|
||||
|
||||
else:
|
||||
|
||||
tol = user.get("tol", 0.1)
|
||||
allow_arbitrary = user.get("type") == "continuous"
|
||||
|
||||
positions = {k: v for k, v in user.items() if k not in ("type", "tol")}
|
||||
|
||||
pos_dev = PositionDevice(
|
||||
bec_name=bec_name,
|
||||
mot_device=motor_resolver(bec_name),
|
||||
positions=positions,
|
||||
tol=tol,
|
||||
allow_arbitrary=allow_arbitrary,
|
||||
use_mock=bec_name in mock_devices,
|
||||
)
|
||||
|
||||
state_devices[bec_name] = pos_dev
|
||||
|
||||
state_devices[bec_name] = pos_dev
|
||||
return state_devices
|
||||
|
||||
|
||||
# def update_position(device, position, value, axis=None):
|
||||
# """Update the user parameter saved positions for a device"""
|
||||
# params = device.user_parameter
|
||||
|
||||
# if axis is None:
|
||||
# # Is this a nested structure?
|
||||
# nested_keys = [k for k, v in params.items() if isinstance(v, dict)]
|
||||
|
||||
# if nested_keys:
|
||||
# raise ValueError(
|
||||
# f"{device.name} has nested parameters "
|
||||
# f"({nested_keys}); specify axis=..."
|
||||
# )
|
||||
|
||||
# device.update_user_parameter({position: value})
|
||||
# return
|
||||
|
||||
# axis_params = params[axis].copy()
|
||||
# axis_params[position] = value
|
||||
# device.update_user_parameter({axis: axis_params})
|
||||
|
||||
|
||||
# # Save the updated values to the device yaml file
|
||||
# # and re-initialise
|
||||
# beamline = os.environ["BEAMLINE"]
|
||||
# env = Environment(beamline = beamline)
|
||||
# bec.config.save_current_session(env.devices_file)
|
||||
# return init_beamline_environment()
|
||||
|
||||
|
||||
def update_position(device, position, value, axis=None):
|
||||
"""Update the user parameter saved positions for a device"""
|
||||
params = device.user_parameter
|
||||
|
||||
if axis is None:
|
||||
nested_keys = [k for k, v in params.items() if isinstance(v, dict)]
|
||||
|
||||
if nested_keys:
|
||||
raise ValueError(
|
||||
f"{device.name} has nested parameters " f"({nested_keys}); specify axis=..."
|
||||
)
|
||||
|
||||
device.update_user_parameter({position: value})
|
||||
|
||||
else:
|
||||
axis_params = params[axis].copy()
|
||||
axis_params[position] = value
|
||||
device.update_user_parameter({axis: axis_params})
|
||||
|
||||
# Save the updated values to the device yaml file
|
||||
beamline = os.environ["BEAMLINE"]
|
||||
env = Environment(beamline=beamline)
|
||||
bec.config.save_current_session(env.devices_file)
|
||||
|
||||
return init_beamline_environment()
|
||||
|
||||
+47
-95
@@ -25,15 +25,12 @@ class Status(Enum):
|
||||
Status.ERROR: "red",
|
||||
Status.UNKNOWN: "blue",
|
||||
}[self]
|
||||
|
||||
|
||||
@property
|
||||
def color_scilog(self):
|
||||
return {
|
||||
Status.OK: "green",
|
||||
Status.WARNING: "",
|
||||
Status.ERROR: "red",
|
||||
Status.UNKNOWN: "",
|
||||
}[self]
|
||||
return {Status.OK: "green", Status.WARNING: "", Status.ERROR: "red", Status.UNKNOWN: ""}[
|
||||
self
|
||||
]
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
@@ -45,7 +42,7 @@ class Status(Enum):
|
||||
class HealthCheckResult:
|
||||
|
||||
name: str
|
||||
description: str
|
||||
description: str
|
||||
status: Status
|
||||
|
||||
value: Any = None
|
||||
@@ -59,50 +56,34 @@ class HealthCheckResult:
|
||||
if self.status == Status.OK:
|
||||
return f"[{self.status.name}] {self.description}"
|
||||
|
||||
return (
|
||||
f"[{self.status.name}] "
|
||||
f"{self.description}: {self.message}"
|
||||
)
|
||||
|
||||
return f"[{self.status.name}] " f"{self.description}: {self.message}"
|
||||
|
||||
def formatted_message(self):
|
||||
if self.status == Status.OK:
|
||||
return f"[{self.status.name} {self.name}]"
|
||||
|
||||
return (
|
||||
f"[{self.status.name}] "
|
||||
f"{self.description}: {self.message}"
|
||||
)
|
||||
|
||||
return f"[{self.status.name}] " f"{self.description}: {self.message}"
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Send to SciLog
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
|
||||
def send_to_scilog(results):
|
||||
|
||||
counts = {
|
||||
Status.OK: 0,
|
||||
Status.WARNING: 0,
|
||||
Status.ERROR: 0,
|
||||
Status.UNKNOWN: 0,
|
||||
}
|
||||
counts = {Status.OK: 0, Status.WARNING: 0, Status.ERROR: 0, Status.UNKNOWN: 0}
|
||||
|
||||
for result in results:
|
||||
counts[result.status] += 1
|
||||
|
||||
|
||||
msg = bec.messaging.scilog.new()
|
||||
|
||||
msg.add_text(
|
||||
"Beamline Health Summary",
|
||||
bold = True
|
||||
)
|
||||
msg.add_text("Beamline Health Summary", bold=True)
|
||||
|
||||
msg.add_text("\n")
|
||||
for status, count in counts.items():
|
||||
msg.add_text(
|
||||
f"{status.name:<10}: {count}",
|
||||
bold=True,
|
||||
)
|
||||
msg.add_text(f"{status.name:<10}: {count}", bold=True)
|
||||
|
||||
msg.add_text("\n")
|
||||
|
||||
@@ -110,7 +91,7 @@ def send_to_scilog(results):
|
||||
msg.add_text(
|
||||
result.formatted_message(),
|
||||
# bold=result.status != Status.OK,
|
||||
color = result.status.color_scilog
|
||||
color=result.status.color_scilog,
|
||||
)
|
||||
msg.add_text("\n")
|
||||
msg.add_tags(["beamline health check"])
|
||||
@@ -121,14 +102,12 @@ def send_to_scilog(results):
|
||||
# Configuration
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
|
||||
@dataclass
|
||||
class BeamlineHealthConfig:
|
||||
|
||||
signal_rules: dict[str, Callable] = field(
|
||||
default_factory=lambda: {
|
||||
"cam": lambda x: x != 0,
|
||||
"bpm": lambda x: x != 0,
|
||||
}
|
||||
default_factory=lambda: {"cam": lambda x: x != 0, "bpm": lambda x: x != 0}
|
||||
)
|
||||
|
||||
motor_tolerances: dict[str, float] = field(
|
||||
@@ -160,11 +139,7 @@ def check_signals(devices, config: BeamlineHealthConfig):
|
||||
|
||||
results = []
|
||||
|
||||
signal_devices = [
|
||||
(name, obj)
|
||||
for name, obj in devices
|
||||
if isinstance(obj, Signal)
|
||||
]
|
||||
signal_devices = [(name, obj) for name, obj in devices if isinstance(obj, Signal)]
|
||||
|
||||
for name, obj in signal_devices:
|
||||
|
||||
@@ -255,11 +230,7 @@ def check_motors(devices, config: BeamlineHealthConfig):
|
||||
results = []
|
||||
ignore = ["id_gap", "smargon"]
|
||||
|
||||
motor_devices = [
|
||||
(name, obj)
|
||||
for name, obj in devices
|
||||
if isinstance(obj, Positioner)
|
||||
]
|
||||
motor_devices = [(name, obj) for name, obj in devices if isinstance(obj, Positioner)]
|
||||
|
||||
for name, obj in motor_devices:
|
||||
|
||||
@@ -342,10 +313,7 @@ def check_motors(devices, config: BeamlineHealthConfig):
|
||||
|
||||
diff = abs(actual - setpoint)
|
||||
|
||||
tolerance = config.motor_tolerances.get(
|
||||
name,
|
||||
config.default_motor_tolerance,
|
||||
)
|
||||
tolerance = config.motor_tolerances.get(name, config.default_motor_tolerance)
|
||||
|
||||
if diff > tolerance:
|
||||
|
||||
@@ -389,6 +357,8 @@ def check_motors(devices, config: BeamlineHealthConfig):
|
||||
)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# General Info
|
||||
# -------------------------------------------------------------------
|
||||
@@ -397,12 +367,14 @@ def info():
|
||||
gap = dev.id_gap.position
|
||||
energy = get_current_energy()
|
||||
# state = get_state()
|
||||
print(f"[INFO] Machine: {current:.4g} mA\n"
|
||||
f"[INFO] Undulator gap: {gap:.4g}\n"
|
||||
f"[INFO] Beamline energy: {energy:.6g} eV\n")
|
||||
# f"[INFO] Beamline state: {state}")
|
||||
|
||||
|
||||
print(
|
||||
f"[INFO] Machine: {current:.4g} mA\n"
|
||||
f"[INFO] Undulator gap: {gap:.4g}\n"
|
||||
f"[INFO] Beamline energy: {energy:.6g} eV\n"
|
||||
)
|
||||
# f"[INFO] Beamline state: {state}")
|
||||
|
||||
|
||||
# def get_state():
|
||||
# states = []
|
||||
# res = planner.current_state()
|
||||
@@ -431,9 +403,7 @@ def check2(config: BeamlineHealthConfig | None = None):
|
||||
# Sort by severity
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
results.sort(
|
||||
key=lambda r: r.status.value,
|
||||
)
|
||||
results.sort(key=lambda r: r.status.value)
|
||||
|
||||
return results
|
||||
|
||||
@@ -447,7 +417,6 @@ def summary_text(results):
|
||||
|
||||
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
|
||||
n_ok = sum(r.status == Status.OK for r in results)
|
||||
|
||||
n_warn = sum(r.status == Status.WARNING for r in results)
|
||||
@@ -472,22 +441,19 @@ def summary_text(results):
|
||||
# -------------------------------------------------------------------
|
||||
# Filter results
|
||||
# -------------------------------------------------------------------
|
||||
def filter_results(results, statuses = None):
|
||||
def filter_results(results, statuses=None):
|
||||
if statuses is None:
|
||||
return results
|
||||
|
||||
return [
|
||||
r for r in results
|
||||
if r.status in statuses
|
||||
]
|
||||
|
||||
return [r for r in results if r.status in statuses]
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# CLI Entry Point
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
|
||||
def run_check(show_all= False, scilog=False):
|
||||
|
||||
def run_check(show_all=False, scilog=False):
|
||||
|
||||
results = check2()
|
||||
|
||||
@@ -496,36 +462,22 @@ def run_check(show_all= False, scilog=False):
|
||||
info()
|
||||
|
||||
problem_results = filter_results(
|
||||
results,
|
||||
statuses={
|
||||
Status.WARNING,
|
||||
Status.ERROR,
|
||||
Status.UNKNOWN,
|
||||
}
|
||||
results, statuses={Status.WARNING, Status.ERROR, Status.UNKNOWN}
|
||||
)
|
||||
if scilog:
|
||||
send_to_scilog(problem_results)
|
||||
|
||||
|
||||
if not show_all:
|
||||
results = filter_results(
|
||||
results,
|
||||
statuses={
|
||||
Status.WARNING,
|
||||
Status.ERROR,
|
||||
Status.UNKNOWN
|
||||
}
|
||||
)
|
||||
results = filter_results(results, statuses={Status.WARNING, Status.ERROR, Status.UNKNOWN})
|
||||
for result in results:
|
||||
print(result)
|
||||
|
||||
disclaimer = "\n======================================================\n" \
|
||||
"This reports: \n 1. If motors are in error state, if moving, or if readback != setpoint" \
|
||||
"\n 2. If camera or BPMs are reading 0 (may or may not be an error)" \
|
||||
"\nN.B. The motor checks are only done if they exist as standard ophyd motors in BEC." \
|
||||
"\nTo see which devices were checked use run_check(show_all=True)."
|
||||
|
||||
disclaimer = (
|
||||
"\n======================================================\n"
|
||||
"This reports: \n 1. If motors are in error state, if moving, or if readback != setpoint"
|
||||
"\n 2. If camera or BPMs are reading 0 (may or may not be an error)"
|
||||
"\nN.B. The motor checks are only done if they exist as standard ophyd motors in BEC."
|
||||
"\nTo see which devices were checked use run_check(show_all=True)."
|
||||
)
|
||||
|
||||
print(disclaimer)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +1,14 @@
|
||||
"""Planner dependencies"""
|
||||
|
||||
|
||||
def planner_deps():
|
||||
"""Define the dependencies between beamline positions"""
|
||||
return {
|
||||
("bs_z", "samp"): [
|
||||
("aerotech_x", "out"),
|
||||
("diag_y", "out"),
|
||||
("coll_y", "out"),
|
||||
],
|
||||
("aerotech_x", "in"): [
|
||||
("diag_y", "out"),
|
||||
("bs_z", "safe"),
|
||||
],
|
||||
("aerotech_x", "out"): [
|
||||
("diag_y", "out"),
|
||||
("bs_z", "safe"),
|
||||
],
|
||||
("diag_y", "scint"): [
|
||||
("aerotech_x", "out"),
|
||||
("bs_z", "safe"),
|
||||
("cryo_pos", "out"),
|
||||
],
|
||||
("diag_y", "i1"): [
|
||||
("aerotech_x", "out"),
|
||||
("bs_z", "safe"),
|
||||
("cryo_pos", "out"),
|
||||
],
|
||||
("bs_z", "samp"): [("aerotech_x", "out"), ("diag_y", "out"), ("coll_y", "out")],
|
||||
("aerotech_x", "in"): [("diag_y", "out"), ("bs_z", "safe")],
|
||||
("aerotech_x", "out"): [("diag_y", "out"), ("bs_z", "safe")],
|
||||
("diag_y", "scint"): [("aerotech_x", "out"), ("bs_z", "safe"), ("cryo_pos", "out")],
|
||||
("diag_y", "i1"): [("aerotech_x", "out"), ("bs_z", "safe"), ("cryo_pos", "out")],
|
||||
("bs_pos", "out"): [("bs_z", "safe")],
|
||||
("bs_pos", "in"): [("bs_z", "safe")],
|
||||
("diag_y", "out"): [("bs_z", "safe")],
|
||||
|
||||
@@ -10,13 +10,14 @@ class DeviceManager:
|
||||
"""Class for building devices and attaching safety guards and policies."""
|
||||
|
||||
@staticmethod
|
||||
def initialize_devices(state_devices_file, rest_devices_file, mock_devices):
|
||||
# def initialize_devices(state_devices_file, rest_devices_file, mock_devices):
|
||||
def initialize_devices(devices_file, mock_devices):
|
||||
"""
|
||||
Initializes sample environment devices from the specified file.
|
||||
"""
|
||||
devices = build_devices(state_devices_file, mock_devices)
|
||||
rest_devices = build_devices(rest_devices_file, mock_devices)
|
||||
devices.update(rest_devices)
|
||||
devices = build_devices(devices_file, mock_devices)
|
||||
# rest_devices = build_devices(rest_devices_file, mock_devices)
|
||||
# devices.update(rest_devices)
|
||||
attach_guards(devices)
|
||||
attach_policies(devices)
|
||||
return devices
|
||||
|
||||
@@ -15,9 +15,7 @@ class AtPositionGuard:
|
||||
def check(self):
|
||||
"""Check if the device is in the specified position."""
|
||||
if self.device.pos != self.pos:
|
||||
raise GuardViolation(
|
||||
f"{self.device.bec_name} must be in the '{self.pos}' position"
|
||||
)
|
||||
raise GuardViolation(f"{self.device.bec_name} must be in the '{self.pos}' position")
|
||||
# print("move allowed")
|
||||
return True
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@ from dataclasses import dataclass
|
||||
# from dependencies import planner_deps
|
||||
# from beamline_planner import StateChangePlanner
|
||||
|
||||
|
||||
@dataclass
|
||||
class Environment:
|
||||
"""Define the device and state yaml files for each beamline"""
|
||||
|
||||
device_mocks: dict[str, bool] = None
|
||||
beamline: str = None
|
||||
@@ -21,18 +23,17 @@ class Environment:
|
||||
# "rest": "pxi-rest-devices.yaml",
|
||||
# "states": "pxi-beamline-states.yaml",
|
||||
# },
|
||||
"x10sa" : {
|
||||
"x10sa": {
|
||||
"devdir": "/sls/x10sa/config/bec/production/pxii_bec/pxii_bec/device_configs/",
|
||||
"state": "pxii-state-devices.yaml",
|
||||
"rest": "pxii-rest-devices.yaml",
|
||||
"devices": "pxii-devices.yaml",
|
||||
"states": "pxii-beamline-states.yaml",
|
||||
},
|
||||
"x06da" : {
|
||||
"x06da": {
|
||||
"devdir": "/sls/x06da/config/bec/production/pxiii_bec/pxiii_bec/device_configs/",
|
||||
"state": "pxiii-state-devices.yaml",
|
||||
"rest": "pxiii-rest-devices.yaml",
|
||||
"states": "pxiii-beamline-states.yaml",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
def __post_init__(self):
|
||||
@@ -60,34 +61,23 @@ class Environment:
|
||||
"xrf_pos": "mock",
|
||||
}
|
||||
|
||||
mocks = sorted(
|
||||
name
|
||||
for name, backend in self.device_mocks.items()
|
||||
if backend == "mock"
|
||||
)
|
||||
mocks = sorted(name for name, backend in self.device_mocks.items() if backend == "mock")
|
||||
|
||||
reals = sorted(
|
||||
name
|
||||
for name, backend in self.device_mocks.items()
|
||||
if backend == "real"
|
||||
)
|
||||
reals = sorted(name for name, backend in self.device_mocks.items() if backend == "real")
|
||||
|
||||
print(f"Mock devices ({len(mocks)}): {mocks}")
|
||||
print(f"Real devices ({len(reals)}): {reals}")
|
||||
# print(f"Mock devices ({len(mocks)}): {mocks}")
|
||||
# print(f"Real devices ({len(reals)}): {reals}")
|
||||
|
||||
try:
|
||||
cfg = self.beamline_configs[self.beamline]
|
||||
except KeyError:
|
||||
raise ValueError(
|
||||
f"Unknown beamline '{self.beamline}'"
|
||||
)
|
||||
raise ValueError(f"Unknown beamline '{self.beamline}'")
|
||||
|
||||
devdir = cfg["devdir"]
|
||||
|
||||
self.state_devices_file = devdir + cfg["state"]
|
||||
self.rest_devices_file = devdir + cfg["rest"]
|
||||
self.devices_file = devdir + cfg["devices"]
|
||||
self.states_file = devdir + cfg["states"]
|
||||
|
||||
|
||||
mock_start_positions = {
|
||||
"aerotech_x": "in",
|
||||
"aerotech_y": "mount",
|
||||
@@ -107,7 +97,7 @@ class Environment:
|
||||
"smargon_z": "mount",
|
||||
"smargon_chi": "mount",
|
||||
"smargon_phi": "mount",
|
||||
"xrf_pos": "out",
|
||||
"xrf_pos": "out",
|
||||
}
|
||||
|
||||
@property
|
||||
@@ -116,7 +106,8 @@ class Environment:
|
||||
for name, device in self.device_mocks.items():
|
||||
if device == "mock":
|
||||
mock_names.add(name)
|
||||
return mock_names
|
||||
return mock_names
|
||||
|
||||
|
||||
def init_beamline_environment():
|
||||
"""
|
||||
@@ -125,15 +116,11 @@ def init_beamline_environment():
|
||||
|
||||
beamline = os.environ["BEAMLINE"]
|
||||
|
||||
env = Environment(beamline = beamline)
|
||||
env = Environment(beamline=beamline)
|
||||
|
||||
# Initialize devices
|
||||
device_manager = DeviceManager()
|
||||
devices = device_manager.initialize_devices(
|
||||
env.state_devices_file,
|
||||
env.rest_devices_file,
|
||||
env.mock_devices
|
||||
)
|
||||
devices = device_manager.initialize_devices(env.devices_file, env.mock_devices)
|
||||
|
||||
# Initialize states
|
||||
state_manager = DefineStatesManager()
|
||||
@@ -144,7 +131,7 @@ def init_beamline_environment():
|
||||
|
||||
# Setup planner
|
||||
planner = StateChangePlanner(devices, states, allow_modifiers, deps)
|
||||
print("Initializing beamline state planner")
|
||||
print("Initializing beamline state planner and devices")
|
||||
|
||||
# Set mock motor starting positions
|
||||
|
||||
@@ -155,9 +142,4 @@ def init_beamline_environment():
|
||||
except Exception as e:
|
||||
print(f"{e} error when setting {mock_dev}")
|
||||
|
||||
|
||||
return devices, planner
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+1547
File diff suppressed because it is too large
Load Diff
@@ -58,15 +58,16 @@ def make_diag_y_policy(d):
|
||||
def diag_y_policy(target):
|
||||
cfg = d["diag_y"].positions
|
||||
# Don't move in if the goniometer is in
|
||||
if d["aerotech_x"].actual >= d['aerotech_x'].positions['in'] and target > cfg["out"]:
|
||||
if d["aerotech_x"].actual >= d["aerotech_x"].positions["in"] and target > cfg["out"]:
|
||||
raise GuardViolation(
|
||||
f"Diagnostic device cannot move beyond {cfg['out']} mm when goniometer is not OUT"
|
||||
)
|
||||
# Don't move if cryocooler is in
|
||||
if d['cryo_pos'].pos == 'in' and target > cfg['out']:
|
||||
if d["cryo_pos"].pos == "in" and target > cfg["out"]:
|
||||
raise GuardViolation(
|
||||
f"Diagnostic device cannot move beyond {cfg['out']} mm when cryocooler is IN"
|
||||
)
|
||||
|
||||
return diag_y_policy
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ def mono_pitch_scan(plot=True):
|
||||
energy = get_current_energy()
|
||||
pos = get_dcm_motors_positions(energy)
|
||||
print(f"Setting DCM Pitch to default value of {pos['dcm_pitch']}")
|
||||
scans.umv(EnergyDefaults.mono_pitch, pos["dcm_pitch"], relative=False)
|
||||
# scans.umv(EnergyDefaults.mono_pitch, pos["dcm_pitch"], relative=False)
|
||||
# Go to peak using default parameters from EnergyDefaults
|
||||
if plot:
|
||||
print("Scanning monochromator pitch and moving to peak, with plotting.")
|
||||
@@ -118,7 +118,7 @@ def mono_pitch_scan(plot=True):
|
||||
# Specific functions - need to be edited for each beamline
|
||||
|
||||
|
||||
def move_gap_if_needed(energy_ev, move_gap=False):
|
||||
def move_gap_if_needed(energy_ev, move_gap=True):
|
||||
"""
|
||||
Move the gap position based on energy if the move_gap flag is set.
|
||||
|
||||
@@ -163,7 +163,7 @@ def get_dcm_motors_positions(energy_ev):
|
||||
# dcm_motor_values = get_value_from_lut(energy_ev)
|
||||
dcm_motor_values = {}
|
||||
# pitch = float(np.poly1d(Calibration.pitch)(energy_ev))
|
||||
pitch = -5.304
|
||||
pitch = -5.5
|
||||
roll = EnergyDefaults.mono_roll_value
|
||||
perp = calc_perp_position(energy_ev, print_result=False)
|
||||
bragg_angle = convert_from_energy(energy_ev, print_result=False)["bragg_angle_mrad"]
|
||||
@@ -183,8 +183,8 @@ def move_dcm_motors(energy_ev):
|
||||
print(
|
||||
f"Moving DCM bragg: {dcm_pos['bragg_angle']: .5g} mrad, "
|
||||
f"DCM perp: {dcm_pos['perp']: .3g} mm, "
|
||||
f"DCM pitch fixed at -5.304 mrad, "
|
||||
# f"DCM pitch: {dcm_pos['dcm_pitch']: .5g} mrad, "
|
||||
# f"DCM pitch fixed at -5.304 mrad, "
|
||||
f"DCM pitch: {dcm_pos['dcm_pitch']: .5g} mrad, "
|
||||
f"DCM Roll: {dcm_pos['dcm_roll']:.5g} V"
|
||||
)
|
||||
# umv(EnergyDefaults.energy, dcm_pos["bragg_angle"])
|
||||
@@ -205,7 +205,7 @@ def move_dcm_motors(energy_ev):
|
||||
)
|
||||
|
||||
|
||||
def bl_energy(energy_ev, move_gap=False, mono_scan=True, plot=True):
|
||||
def bl_energy(energy_ev, move_gap=True, mono_scan=True, plot=True):
|
||||
"""
|
||||
Adjusts the beamline's energy to the specified energy in electron volts (eV).
|
||||
The function validates the target energy, checks the current energy, and makes
|
||||
|
||||
@@ -4,7 +4,6 @@ from dataclasses import dataclass
|
||||
import numpy as np
|
||||
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EnergyDefaults:
|
||||
"""Parameters for PXII energy changes"""
|
||||
@@ -37,13 +36,15 @@ class Gap:
|
||||
"""Fit parameters to calculate gap from harmonics"""
|
||||
|
||||
harmonics = {
|
||||
"H3": np.array([9.15e-04, 4.49e-01]),
|
||||
"H5": np.array([5.19e-04, 7.149e-01]),
|
||||
"H7": np.array([3.57694643e-04, 8.73775476e-01]),
|
||||
"H9": np.array([2.76335714e-04, 8.98471905e-01]),
|
||||
"H11": np.array([2.2225e-04, 9.582e-01]),
|
||||
"H13": np.array([1.9e-4, 9.262e-01]),
|
||||
"H15": np.array([1.67e-4, 8.83e-01]),
|
||||
"H3": np.array([9.409e-04, 2.797e-01]),
|
||||
"H5": np.array([5.097e-04, 8.065e-01]),
|
||||
"H7": np.array([3.623e-04, 8.252e-01]),
|
||||
"H9": np.array([2.795e-04, 8.595e-01]),
|
||||
"H11": np.array([2.309e-04, 8.167e-01]),
|
||||
"H13": np.array([1.928e-04, 8.748e-01]),
|
||||
"H15": np.array([1.67e-04, 8.743e-01]),
|
||||
"H17": np.array([1.484e-04, 8.546e-01]),
|
||||
"H19": np.array([1.275e-04, 1.0085]),
|
||||
}
|
||||
# Define harmonic ranges as a constant
|
||||
harmonic_ranges = {
|
||||
@@ -53,7 +54,9 @@ class Gap:
|
||||
"H9": (13000, 16000),
|
||||
"H11": (16000, 19000),
|
||||
"H13": (19000, 22000),
|
||||
"H15": (22000, float("inf")),
|
||||
"H15": (22000, 25000),
|
||||
"H17": (25000, 27500),
|
||||
"H19": (27500, float("inf")),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
@@ -122,17 +125,17 @@ class CamConversion:
|
||||
class BPMScans:
|
||||
"""Define the names of the motors and bpm channels"""
|
||||
|
||||
fe = {
|
||||
"x_name": dev.fe_bpm_x.name,
|
||||
"y_name": dev.fe_bpm_y.name,
|
||||
"z1_name": dev.fe_bpm1.name,
|
||||
"z2_name": dev.fe_bpm2.name,
|
||||
"z3_name": dev.fe_bpm3.name,
|
||||
"z4_name": dev.fe_bpm3.name,
|
||||
"z5_name": dev.fe_bpmsum.name,
|
||||
"x_device": dev.fe_bpm_x,
|
||||
"y_device": dev.fe_bpm_y,
|
||||
}
|
||||
# fe = {
|
||||
# "x_name": dev.fe_bpm_x.name,
|
||||
# "y_name": dev.fe_bpm_y.name,
|
||||
# "z1_name": dev.fe_bpm1.name,
|
||||
# "z2_name": dev.fe_bpm2.name,
|
||||
# "z3_name": dev.fe_bpm3.name,
|
||||
# "z4_name": dev.fe_bpm3.name,
|
||||
# "z5_name": dev.fe_bpmsum.name,
|
||||
# "x_device": dev.fe_bpm_x,
|
||||
# "y_device": dev.fe_bpm_y,
|
||||
# }
|
||||
lu = {
|
||||
"x_name": dev.lu_bpm_x.name,
|
||||
"y_name": dev.lu_bpm_y.name,
|
||||
@@ -186,5 +189,3 @@ class BPMScans:
|
||||
# "x_device": dev.vfm_bu,
|
||||
# "y_device": dev.vfm_bd,
|
||||
# }
|
||||
|
||||
|
||||
|
||||
@@ -1,338 +0,0 @@
|
||||
"""File to store beamline parameters and defaults"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Callable
|
||||
import numpy as np
|
||||
import yaml
|
||||
|
||||
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EnergyDefaults:
|
||||
"""Parameters for PXII energy changes"""
|
||||
|
||||
min_energy_change = 1
|
||||
min_energy_ev = 4800
|
||||
max_energy_ev = 30002
|
||||
beam_offset = 6
|
||||
signals = {"sig1": dev.lu_bpmsum, "sig2": dev.bsc_bpmsum, "sig3": dev.bcu_bpmsum}
|
||||
energy = dev.dcm_bragg
|
||||
mono_pitch = dev.dcm_pitch
|
||||
mono_perp = dev.dcm_perp
|
||||
mono_roll = dev.dcm_froll
|
||||
mono_roll_value = 4.65
|
||||
LUT_table = "luts/energy_lut.csv"
|
||||
stripe_thresholds = {"silicon": 9000, "rhodium": 20000, "platinum": 40000}
|
||||
pitch_scan = {"halfwidth": 0.075, "steps": 20}
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Calibration:
|
||||
"""Calibration parameters for PXII optics"""
|
||||
|
||||
pitch = np.array([4.61823701e-14, -1.97330772e-09, 2.89694543e-05, -5.34468669e00])
|
||||
roll = np.array([2.28291039e-03, -2.41928101e01])
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Gap:
|
||||
"""Fit parameters to calculate gap from harmonics"""
|
||||
|
||||
harmonics = {
|
||||
"H3": np.array([9.15e-04, 4.49e-01]),
|
||||
"H5": np.array([5.19e-04, 7.149e-01]),
|
||||
"H7": np.array([3.57694643e-04, 8.73775476e-01]),
|
||||
"H9": np.array([2.76335714e-04, 8.98471905e-01]),
|
||||
"H11": np.array([2.2225e-04, 9.582e-01]),
|
||||
"H13": np.array([1.9e-4, 9.262e-01]),
|
||||
"H15": np.array([1.67e-4, 8.83e-01]),
|
||||
}
|
||||
# Define harmonic ranges as a constant
|
||||
harmonic_ranges = {
|
||||
"H3": (4900, 7000),
|
||||
"H5": (7000, 10000),
|
||||
"H7": (10000, 13000),
|
||||
"H9": (13000, 16000),
|
||||
"H11": (16000, 19000),
|
||||
"H13": (19000, 22000),
|
||||
"H15": (22000, float("inf")),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def get_harmonic_by_energy(energy_ev: float):
|
||||
"""
|
||||
Determines the harmonic key based on the provided energy.
|
||||
|
||||
Args:
|
||||
energy_ev (float): The energy value (eV).
|
||||
|
||||
Returns:
|
||||
Optional[str]: The harmonic name (e.g., 'H3', 'H7')
|
||||
if the range matches, None otherwise.
|
||||
"""
|
||||
for harmonic, (low, high) in Gap.harmonic_ranges.items():
|
||||
if low < energy_ev <= high:
|
||||
return harmonic
|
||||
return None
|
||||
|
||||
def get_harmonic_values(self, energy_ev: float):
|
||||
"""
|
||||
Retrieves the harmonic array based on the energy value.
|
||||
|
||||
Args:
|
||||
energy_ev (float): The energy value (eV).
|
||||
|
||||
Returns:
|
||||
Optional[np.array]: The corresponding array of harmonic values
|
||||
if the range matches, None otherwise.
|
||||
"""
|
||||
harmonic = self.get_harmonic_by_energy(energy_ev)
|
||||
return self.harmonics.get(harmonic) if harmonic else None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Harmonics:
|
||||
"""Anuschka's harmonics data for PXII U19 Undulator"""
|
||||
|
||||
min_gap_value = 4.5
|
||||
map = {
|
||||
3: np.array([1.07141725, -0.52834258]),
|
||||
4: np.array([0.007111, -0.13678409, 1.52295567, -1.06882785]),
|
||||
5: np.array([0.00315051, -0.0766359, 1.13107469, -0.86442062]),
|
||||
6: np.array([0.00162862, -0.04452336, 0.82948259, -0.37329674]),
|
||||
7: np.array([0.00080764, -0.02418882, 0.59212947, 0.15702886]),
|
||||
8: np.array([1.16699242e-03, -4.68207543e-02, 9.43972396e-01, -1.94201019e00]),
|
||||
9: np.array([0.00048419, -0.02010648, 0.55514114, -0.38180067]),
|
||||
10: np.array([2.11583333e-04, -8.03503571e-03, 3.43141595e-01, 6.02318000e-01]),
|
||||
11: np.array([0.00334392, -0.18405336, 3.58338994, -19.3640241]),
|
||||
12: np.array([3.20520798e-05, 2.39253145e-03, 8.09198503e-02, 2.22897377e00]),
|
||||
13: np.array([0.00278744, 0.07979874, 2.05143916]),
|
||||
}
|
||||
energy_ranges = {3: (0, 7), 5: (7, 10), 7: (10, 13), 9: (13, 16), 11: (16, 19), 13: (19, 22)}
|
||||
high_energy = [(15, (23, 25)), (17, (25, 29)), (19, (29, float("inf")))]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CamConversion:
|
||||
"""Convert pixels to microns for sam cam"""
|
||||
|
||||
a = 0.5208
|
||||
b = 0.002586
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BPMScans:
|
||||
"""Define the names of the motors and bpm channels"""
|
||||
|
||||
fe = {
|
||||
"x_name": dev.fe_bpm_x.name,
|
||||
"y_name": dev.fe_bpm_y.name,
|
||||
"z1_name": dev.fe_bpm1.name,
|
||||
"z2_name": dev.fe_bpm2.name,
|
||||
"z3_name": dev.fe_bpm3.name,
|
||||
"z4_name": dev.fe_bpm3.name,
|
||||
"z5_name": dev.fe_bpmsum.name,
|
||||
"x_device": dev.fe_bpm_x,
|
||||
"y_device": dev.fe_bpm_y,
|
||||
}
|
||||
lu = {
|
||||
"x_name": dev.lu_bpm_x.name,
|
||||
"y_name": dev.lu_bpm_y.name,
|
||||
"z1_name": dev.lu_bpm1.name,
|
||||
"z2_name": dev.lu_bpm2.name,
|
||||
"z3_name": dev.lu_bpm3.name,
|
||||
"z4_name": dev.lu_bpm4.name,
|
||||
"z5_name": dev.lu_bpmsum.name,
|
||||
"x_device": dev.lu_bpm_x,
|
||||
"y_device": dev.lu_bpm_y,
|
||||
}
|
||||
bsc = {
|
||||
"x_name": dev.bsc_bpm_x.name,
|
||||
"y_name": dev.bsc_bpm_y.name,
|
||||
"z1_name": dev.bsc_bpm1.name,
|
||||
"z2_name": dev.bsc_bpm2.name,
|
||||
"z3_name": dev.bsc_bpm3.name,
|
||||
"z4_name": dev.bsc_bpm4.name,
|
||||
"z5_name": dev.bsc_bpmsum.name,
|
||||
"x_device": dev.bsc_bpm_x,
|
||||
"y_device": dev.bsc_bpm_y,
|
||||
}
|
||||
bcu = {
|
||||
"x_name": dev.bcu_bpm_x.name,
|
||||
"y_name": dev.bcu_bpm_y.name,
|
||||
"z1_name": dev.bcu_bpm1.name,
|
||||
"z2_name": dev.bcu_bpm2.name,
|
||||
"z3_name": dev.bcu_bpm3.name,
|
||||
"z4_name": dev.bcu_bpm4.name,
|
||||
"z5_name": dev.bcu_bpmsum.name,
|
||||
"x_device": dev.bcu_bpm_x,
|
||||
"y_device": dev.bcu_bpm_y,
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MirrorConfig:
|
||||
"""Define the names of the mirror channels"""
|
||||
|
||||
hfm = {
|
||||
"bu_name": dev.hfm_bu.name,
|
||||
"bd_name": dev.hfm_bd.name,
|
||||
"z_name": dev.samcam_xsig.name,
|
||||
"x_device": dev.hfm_bu,
|
||||
"y_device": dev.hfm_bd,
|
||||
}
|
||||
vfm = {
|
||||
"bu_name": dev.vfm_bu.name,
|
||||
"bd_name": dev.vfm_bd.name,
|
||||
"z_name": dev.samcam_ysig.name,
|
||||
"x_device": dev.vfm_bu,
|
||||
"y_device": dev.vfm_bd,
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class PositionedDevice:
|
||||
"""Class for devices with defined in and out positions"""
|
||||
|
||||
device_name: str
|
||||
type: str
|
||||
name: str
|
||||
inpos: float
|
||||
outpos: float
|
||||
tol: float
|
||||
mot: str
|
||||
reader: Callable[[], float]
|
||||
|
||||
@property
|
||||
def actual(self):
|
||||
"""Returns current motor position"""
|
||||
return self.reader()
|
||||
|
||||
def checkin(self):
|
||||
"""Returns True if motor in in the 'in' position"""
|
||||
return abs(self.actual - self.inpos) <= self.tol
|
||||
|
||||
def mvin(self):
|
||||
"""Moves motor to the 'in' position"""
|
||||
scans.umv(self.mot, self.inpos, relative=False)
|
||||
|
||||
def mvout(self):
|
||||
"""Moves motor to the 'out' position"""
|
||||
scans.umv(self.mot, self.outpos, relative=False)
|
||||
|
||||
def status(self):
|
||||
""" Check if device is in or out or moving"""
|
||||
positions = ("in", "out", "moving", "undefined")
|
||||
target_in = self.inpos
|
||||
target_out = self.outpos
|
||||
actual = self.actual
|
||||
delta_in = actual - target_in
|
||||
delta_out = actual - target_out
|
||||
# Check if motor is moving
|
||||
if "Signal" in self.type:
|
||||
moving = 0
|
||||
elif "Motor" in self.type:
|
||||
d = getattr(dev, self.device_name)
|
||||
moving = d.motor_is_moving.get()
|
||||
if moving:
|
||||
pos = positions[2]
|
||||
return {"position": pos.upper(),
|
||||
"name": self.name,
|
||||
"moving": moving}
|
||||
|
||||
if abs(delta_in) > self.tol and abs(delta_out) > self.tol:
|
||||
pos = positions[3]
|
||||
return {"position": pos.upper(),
|
||||
"name": self.name,
|
||||
"actual": actual,
|
||||
"moving": moving}
|
||||
|
||||
elif abs(delta_in) <= self.tol:
|
||||
target = self.inpos
|
||||
pos = positions[0]
|
||||
delta = delta_in
|
||||
elif abs(delta_out) <= self.tol:
|
||||
target = self.outpos
|
||||
pos = positions[1]
|
||||
delta = delta_out
|
||||
|
||||
return {
|
||||
"name": self.name,
|
||||
"position": pos.upper(),
|
||||
"target": target,
|
||||
"actual": actual,
|
||||
"delta": delta,
|
||||
"tol": self.tol,
|
||||
"moving": moving,
|
||||
}
|
||||
|
||||
def report(self):
|
||||
""" Print status of motor """
|
||||
s = self.status()
|
||||
|
||||
if s['position'] == "UNDEFINED":
|
||||
return (f"{s['name']:15s}: "
|
||||
f"{s['position']} "
|
||||
f"position {s['actual']:.3f}")
|
||||
elif s['position'] == "MOVING":
|
||||
return (f"{s['name']:15s}: "
|
||||
f"{s['position']} ")
|
||||
else:
|
||||
return (
|
||||
f"{s['name']:15s}: "
|
||||
f"[{s['position']}] "
|
||||
f"actual = {s['actual']:.3f} "
|
||||
f"target = {s['target']:.3f} "
|
||||
f"delta = {s['delta']:.3f}"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PD:
|
||||
"""Class for positioned device positions"""
|
||||
|
||||
|
||||
def build_pd(yaml_file):
|
||||
"""Takes the in and out values from the yaml file
|
||||
and adds them to the PD class
|
||||
"""
|
||||
with open(yaml_file, encoding="utf-8") as f:
|
||||
data = yaml.safe_load(f)
|
||||
for device_name, cfg in data.items():
|
||||
# Skip devices without userParameter
|
||||
user = cfg.get("userParameter")
|
||||
if not user:
|
||||
continue
|
||||
# Set tolerance
|
||||
if "tol" not in user:
|
||||
user["tol"] = 0.01
|
||||
|
||||
try:
|
||||
dev_obj = getattr(dev, device_name)
|
||||
except:
|
||||
raise KeyError(f"Device {device_name} not found in device list")
|
||||
desc = cfg.get("description")
|
||||
type = cfg.get("deviceClass")
|
||||
target = PositionedDevice(
|
||||
device_name=device_name,
|
||||
type = type,
|
||||
name=desc,
|
||||
inpos=user["in"],
|
||||
outpos=user["out"],
|
||||
tol=user["tol"],
|
||||
mot=dev_obj,
|
||||
reader=lambda d=dev_obj, n=device_name: d.read()[n]["value"],
|
||||
)
|
||||
|
||||
setattr(PD, device_name, target)
|
||||
|
||||
|
||||
def init_positioned_devices():
|
||||
"""Initialises the positioned devices"""
|
||||
file = (
|
||||
"/sls/x10sa/config/bec/production/pxii_bec/pxii_bec/device_configs/pxii-autogenerated.yaml"
|
||||
)
|
||||
build_pd(file)
|
||||
print("Defined positions for devices have been updated from pxii-autogenerated.yaml")
|
||||
@@ -22,7 +22,7 @@ def state_test():
|
||||
current = random.choice(choices)
|
||||
print(f"Testing {current}")
|
||||
planner.move_to(current)
|
||||
time.sleep(5)
|
||||
time.sleep(2)
|
||||
tested_states.append(current.name)
|
||||
previous = current
|
||||
planner.move_to(BeamlineState.MANUAL_SAMPLE_EXCHANGE)
|
||||
|
||||
Reference in New Issue
Block a user