All devices instantiate

This commit is contained in:
Mohacsi Istvan 2022-11-22 13:44:28 +01:00
parent c483b50043
commit fd7208ed3e
4 changed files with 37 additions and 5 deletions

View File

@ -53,10 +53,14 @@ def createProxy(name: str, connect=True) -> OphydObject:
if __name__ == "__main__": if __name__ == "__main__":
num_errors = 0
for key in lut_db: for key in lut_db:
try: try:
dut = createProxy(str(key)) dut = createProxy(str(key))
# print(f"{key}\t: {type(dut)}\t{dut.read()}") # print(f"{key}\t: {type(dut)}\t{dut.read()}")
print(f"{key}\t: {type(dut)}") print(f"{key}\t: {type(dut)}")
except Exception as ex: except Exception as ex:
num_errors += 1
print(key)
print(ex) print(ex)
print(f"\nTotal number of errors: {num_errors}")

View File

@ -162,7 +162,7 @@ motrz1:
motrz1e: motrz1e:
desc: 'Monochromator crystal 1 axial movement encoder' desc: 'Monochromator crystal 1 axial movement encoder'
acquisition: {schedule: sync} acquisition: {schedule: sync}
config: {name: motrz1e, prefix: 'X12SA-OP-MO:ECZ1'} config: {name: motrz1e, read_pv: 'X12SA-OP-MO:ECZ1'}
deviceGroup: monitor deviceGroup: monitor
status: {enabled: true} status: {enabled: true}
type: EpicsSignalRO type: EpicsSignalRO
@ -176,7 +176,7 @@ motrz1e:
moth1e: moth1e:
desc: 'Monochromator crystal 1 theta encoder' desc: 'Monochromator crystal 1 theta encoder'
acquisition: {schedule: sync} acquisition: {schedule: sync}
config: {name: moth1e, prefix: 'X12SA-OP-MO:ECX1'} config: {name: moth1e, read_pv: 'X12SA-OP-MO:ECX1'}
deviceGroup: monitor deviceGroup: monitor
status: {enabled: true} status: {enabled: true}
type: EpicsSignalRO type: EpicsSignalRO
@ -211,7 +211,7 @@ motry2:
moth2e: moth2e:
desc: 'Monochromator crystal 2 theta encoder' desc: 'Monochromator crystal 2 theta encoder'
acquisition: {schedule: sync} acquisition: {schedule: sync}
config: {name: moth2e, prefix: 'X12SA-OP-MO:ECX2'} config: {name: moth2e, read_pv: 'X12SA-OP-MO:ECX2'}
deviceGroup: monitor deviceGroup: monitor
status: {enabled: true} status: {enabled: true}
type: EpicsSignalRO type: EpicsSignalRO

View File

@ -0,0 +1,28 @@
TABLES_DT_PUSH_DIST_MM = 890
class DetectorTableTheta(PseudoPositioner):
"""Detector table tilt motor
Small wrapper to adjust the detector table tilt as angle.
The table is pushed from one side by a single vertical motor.
Note: Rarely used!
"""
# Real axis (in degrees)
pusher = Component(EpicsMotor, "", name="pusher")
# Virtual axis
theta = Component(PseudoSingle, name="theta")
_real = ["pusher"]
@pseudo_position_argument
def forward(self, pseudo_pos):
return self.RealPosition(pusher = tan(pseudo_pos.theta * 3.141592 / 180.0) * TABLES_DT_PUSH_DIST_MM)
@real_position_argument
def inverse(self, real_pos):
return self.PseudoPosition(theta = -180 * atan(real_pos.pusher / TABLES_DT_PUSH_DIST_MM) / 3.141592)

View File

@ -8,7 +8,7 @@ IMPORTANT: Virtual monochromator axes should be implemented already in EPICS!!!
""" """
import numpy as np import numpy as np
from math import isclose from math import isclose, tan, atan
from ophyd import ( from ophyd import (
EpicsSignal, EpicsSignal,
EpicsSignalRO, EpicsSignalRO,
@ -20,7 +20,7 @@ from ophyd import (
Kind, Kind,
) )
from ophyd.pseudopos import pseudo_position_argument, real_position_argument from ophyd.pseudopos import pseudo_position_argument, real_position_argument
from ophyd.sim import SynAxis, Syn2DGauss
class PmMonoBender(PseudoPositioner): class PmMonoBender(PseudoPositioner):