Tested monochromator virtual axes

This commit is contained in:
Mohacsi Istvan 2022-11-23 11:14:33 +01:00
parent bbf53a3e64
commit a0a0c1398d
3 changed files with 122 additions and 111 deletions

4
.gitignore vendored
View File

@ -5,4 +5,6 @@
.DS_Store
**/out
**/.vscode
**/.pytest_cache
**/.pytest_cache
*.egg-info

View File

@ -145,97 +145,7 @@ fi3try:
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motry:
desc: 'OpticsHutch optical table vertical movement'
acquisition: {schedule: sync}
config: {name: motry, prefix: 'X12SA-OP-OT:TRY'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motrz1:
desc: 'Monochromator crystal 1 axial movement'
acquisition: {schedule: sync}
config: {name: motrz1, prefix: 'X12SA-OP-MO:TRZ1'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motrz1e:
desc: 'Monochromator crystal 1 axial movement encoder'
acquisition: {schedule: sync}
config: {name: motrz1e, read_pv: 'X12SA-OP-MO:ECZ1'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
mopush1:
desc: 'Monochromator crystal 1 angle'
acquisition: {schedule: sync}
config: {name: mopush1, read_pv: 'X12SA-OP-MO:ROX1'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
moth1e:
desc: 'Monochromator crystal 1 theta encoder'
acquisition: {schedule: sync}
config: {name: moth1e, read_pv: 'X12SA-OP-MO:ECX1'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
moroll1:
desc: 'Monochromator crystal 1 roll'
acquisition: {schedule: sync}
config: {name: moroll1, prefix: 'X12SA-OP-MO:ROZ1'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motrx2:
desc: 'Monochromator crystal 2 horizontal movement'
acquisition: {schedule: sync}
config: {name: motrx2, prefix: 'X12SA-OP-MO:TRX2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motry2:
desc: 'Monochromator crystal 2 vertical movement'
acquisition: {schedule: sync}
config: {name: motry2, prefix: 'X12SA-OP-MO:TRY2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
mopush2:
desc: 'Monochromator crystal 2 angle'
acquisition: {schedule: sync}
config: {name: mopush2, read_pv: 'X12SA-OP-MO:ROX2.VAL'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
moth2e:
desc: 'Monochromator crystal 2 theta encoder'
acquisition: {schedule: sync}
config: {name: moth2e, read_pv: 'X12SA-OP-MO:ECX2'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
#monot:
# desc: 'Monochromator temperature'
# acquisition: {schedule: sync}
# config: {name: monot, read_pv: 'X12SA-OP-MO:TC3'}
# deviceGroup: monitor
# status: {enabled: true}
# type: EpicsSignalRO
moyaw2:
desc: 'Monochromator crystal 2 yaw movement'
acquisition: {schedule: sync}
config: {name: moyaw2, prefix: 'X12SA-OP-MO:ROY2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
moroll2:
desc: 'Monochromator crystal 2 roll movement'
acquisition: {schedule: sync}
config: {name: moroll2, prefix: 'X12SA-OP-MO:ROZ2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
mobdai:
desc: 'Monochromator bender inner motor'
acquisition: {schedule: sync}
@ -913,28 +823,122 @@ stroz:
deviceGroup: beamlineMotor
status: {enabled: true}
type: GirderMotorROLL
mokev:
desc: 'Monochromator energy in keV'
motry:
desc: 'OpticsHutch optical table vertical movement'
acquisition: {schedule: sync}
config: {name: mokev, read_pv: 'X12SA-OP-MO:ROX2.VAL'}
config: {name: motry, prefix: 'X12SA-OP-OT:TRY'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motrz1:
desc: 'Monochromator crystal 1 axial movement'
acquisition: {schedule: sync}
config: {name: motrz1, prefix: 'X12SA-OP-MO:TRZ1'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motrz1e:
desc: 'Monochromator crystal 1 axial movement encoder'
acquisition: {schedule: sync}
config: {name: motrz1e, read_pv: 'X12SA-OP-MO:ECZ1'}
deviceGroup: monitor
status: {enabled: true}
type: EnergyKev
type: EpicsSignalRO
moroll1:
desc: 'Monochromator crystal 1 roll'
acquisition: {schedule: sync}
config: {name: moroll1, prefix: 'X12SA-OP-MO:ROZ1'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motrx2:
desc: 'Monochromator crystal 2 horizontal movement'
acquisition: {schedule: sync}
config: {name: motrx2, prefix: 'X12SA-OP-MO:TRX2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
motry2:
desc: 'Monochromator crystal 2 vertical movement'
acquisition: {schedule: sync}
config: {name: motry2, prefix: 'X12SA-OP-MO:TRY2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
#monot:
# desc: 'Monochromator temperature'
# acquisition: {schedule: sync}
# config: {name: monot, read_pv: 'X12SA-OP-MO:TC3'}
# deviceGroup: monitor
# status: {enabled: true}
# type: EpicsSignalRO
moyaw2:
desc: 'Monochromator crystal 2 yaw movement'
acquisition: {schedule: sync}
config: {name: moyaw2, prefix: 'X12SA-OP-MO:ROY2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
moroll2:
desc: 'Monochromator crystal 2 roll movement'
acquisition: {schedule: sync}
config: {name: moroll2, prefix: 'X12SA-OP-MO:ROZ2'}
deviceGroup: beamlineMotor
status: {enabled: true}
type: EpicsMotor
mopush1:
desc: 'Monochromator crystal 1 angle'
acquisition: {schedule: sync}
config: {name: mopush1, read_pv: 'X12SA-OP-MO:ROX1'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
moth1:
desc: 'Monochromator Theta 1'
acquisition: {schedule: sync}
config: {name: moth1, read_pv: 'X12SA-OP-MO:ECX1'}
config: {name: moth1, read_pv: 'X12SA-OP-MO:ROX1'}
deviceGroup: monitor
status: {enabled: true}
type: MonoTheta1
moth1e:
desc: 'Monochromator crystal 1 theta encoder'
acquisition: {schedule: sync}
config: {name: moth1e, read_pv: 'X12SA-OP-MO:ECX1'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
mopush2:
desc: 'Monochromator crystal 2 angle'
acquisition: {schedule: sync}
config: {name: mopush2, read_pv: 'X12SA-OP-MO:ROX2'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
moth2:
desc: 'Monochromator Theta 2'
acquisition: {schedule: sync}
config: {name: moth1, read_pv: 'X12SA-OP-MO:ECX2'}
config: {name: moth1, read_pv: 'X12SA-OP-MO:ROX2'}
deviceGroup: monitor
status: {enabled: true}
type: MonoTheta2
moth2e:
desc: 'Monochromator crystal 2 theta encoder'
acquisition: {schedule: sync}
config: {name: moth2e, read_pv: 'X12SA-OP-MO:ECX2'}
deviceGroup: monitor
status: {enabled: true}
type: EpicsSignalRO
mokev:
desc: 'Monochromator energy in keV'
acquisition: {schedule: sync}
config: {name: mokev, read_pv: 'X12SA-OP-MO:ROX2'}
deviceGroup: monitor
status: {enabled: true}
type: EnergyKev

View File

@ -130,7 +130,7 @@ class GirderMotorPITCH(PVPositioner):
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
class VirtualSignalBase(EpicsSignalRO):
class VirtualEpicsSignalRO(EpicsSignalRO):
"""This is a test class to create derives signals from one or
multiple original signals...
"""
@ -141,13 +141,13 @@ class VirtualSignalBase(EpicsSignalRO):
raw = super().get(*args, **kwargs)
return self.calc(raw)
def describe(self):
val = self.get()
d = super().describe()
d[self.name]["dtype"] = data_type(val)
return d
#def describe(self):
# val = self.get()
# d = super().describe()
# d[self.name]["dtype"] = data_type(val)
# return d
class MonoTheta1(VirtualSignalBase):
class MonoTheta1(VirtualEpicsSignalRO):
"""Converts the pusher motor position to theta angle
"""
_mono_a0_enc_scale1 = -1.0
@ -159,7 +159,7 @@ class MonoTheta1(VirtualSignalBase):
theta1 = self._mono_a0_enc_scale1 * asin( asin_arg ) / 3.141592 * 180.0 + self._mono_a3_enc_offs1
return theta1
class MonoTheta2(VirtualSignalBase):
class MonoTheta2(VirtualEpicsSignalRO):
"""Converts the pusher motor position to theta angle
"""
_mono_a3_enc_offs2 = -19.7072
@ -172,14 +172,19 @@ class MonoTheta2(VirtualSignalBase):
theta2 = self._mono_a0_enc_scale2 * asin( asin_arg ) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
return theta2
class EnergyKev(VirtualSignalBase):
class EnergyKev(VirtualEpicsSignalRO):
"""Converts the pusher motor position to energy in keV
"""
_mono_a3_enc_offs2 = -19.7072
_mono_a2_pusher_offs2 = 5.93905
_mono_a1_lever_length2 = 206.572
_mono_a0_enc_scale2 = -1.0
_mono_hce = 12.39852066
_mono_2d2 = 2*5.43102/sqrt(3)
def calc(self, val):
theta_deg = atan(50 / val) / 2.0 * 180.0 / 3.141592
E_keV = -self._mono_hce / self._mono_2d2 / sin(theta_deg/180.0*3.14152)
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
theta2_deg = self._mono_a0_enc_scale2 * asin( asin_arg ) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
E_keV = -self._mono_hce / self._mono_2d2 / sin(theta2_deg/180.0*3.14152)
return E_keV