XRD setup can now be configured in the config file and the components are loaded accordingly

This commit is contained in:
“Roman
2019-05-23 09:26:47 +02:00
parent 7d58422551
commit caee42e77d
2 changed files with 58 additions and 61 deletions
+1 -1
View File
@@ -246,7 +246,7 @@ components = [
"z_und": 142,
"desc": "Xray diffractometer",
"type": "eco.endstations.bernina_diffractometers:XRD",
"kwargs": {"Id": "SARES21-XRD"},
"kwargs": {"Id": "SARES21-XRD", "configuration": config['xrd_config']},
},
{
"args": [],
+57 -60
View File
@@ -75,78 +75,75 @@ class GPS:
class XRD:
def __init__(self, name=None, Id=None, configuration=[]):
def __init__(self, name=None, Id=None, configuration=['base']):
"""X-ray diffractometer platform in AiwssFEL Bernina.\
<configuration> : list of elements mounted on
the plaform, options are kappa, nutable, hlgonio, polana"""
self.Id = Id
self.name = name
self.alias = Alias(name)
self.configuration = configuration
### motors base platform ###
addMotorRecordToSelf(self, Id=Id + ":MOT_TX", name="xbase")
addMotorRecordToSelf(self, Id=Id + ":MOT_TY", name="ybase")
addMotorRecordToSelf(self, Id=Id + ":MOT_RX", name="rxbase")
addMotorRecordToSelf(self, Id=Id + ":MOT_MY_RYTH", name="omega")
if "base" in self.configuration:
### motors base platform ###
### motors base platform ###
addMotorRecordToSelf(self, Id=Id + ":MOT_TX", name="xbase")
addMotorRecordToSelf(self, Id=Id + ":MOT_TY", name="ybase")
addMotorRecordToSelf(self, Id=Id + ":MOT_RX", name="rxbase")
addMotorRecordToSelf(self, Id=Id + ":MOT_MY_RYTH", name="omega")
### motors XRD detector arm ###
addMotorRecordToSelf(self, Id=Id + ":MOT_NY_RY2TH", name="gamma")
addMotorRecordToSelf(self, Id=Id + ":MOT_DT_RX2TH", name="delta")
if "arm" in self.configuration:
### motors XRD detector arm ###
addMotorRecordToSelf(self, Id=Id + ":MOT_NY_RY2TH", name="gamma")
addMotorRecordToSelf(self, Id=Id + ":MOT_DT_RX2TH", name="delta")
### motors XRD area detector branch ###
addMotorRecordToSelf(self, Id=Id + ":MOT_D_T", name="tdet")
### motors XRD area detector branch ###
addMotorRecordToSelf(self, Id=Id + ":MOT_D_T", name="tdet")
### motors XRD polarisation analyzer branch ###
addMotorRecordToSelf(self, Id=Id + ":MOT_P_T", name="tpol")
# missing: slits of flight tube
### motors XRD polarisation analyzer branch ###
addMotorRecordToSelf(self, Id=Id + ":MOT_P_T", name="tpol")
# missing: slits of flight tube
if "hlxz" in self.configuration:
### motors heavy load goniometer ###
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TX", name="xhl")
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TZ", name="zhl")
if "hly" in self.configuration:
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TY", name="yhl")
### motors heavy load goniometer ###
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TX", name="xhl")
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TZ", name="zhl")
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TY", name="yhl")
try:
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RX", name="rxhl")
except:
print("XRD.rxhl not found")
pass
try:
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RY", name="rzhl")
except:
print("XRD.rzhl not found")
pass
if "hlrxrz" in self.configuration:
try:
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RX", name="rxhl")
except:
print("XRD.rxhl not found")
pass
try:
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RY", name="rzhl")
except:
print("XRD.rzhl not found")
pass
### motors nu table ###
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_TX", name="teta")
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_RX", name="eta")
if "phi_table" in self.configuration:
### motors nu table ###
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_TX", name="teta")
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_RX", name="eta")
### motors PI hexapod ###
self.hex_x = PV("SARES20-HEX_PI:POSI-X")
self.hex_y = PV("SARES20-HEX_PI:POSI-Y")
self.hex_z = PV("SARES20-HEX_PI:POSI-Z")
self.hex_u = PV("SARES20-HEX_PI:POSI-U")
self.hex_v = PV("SARES20-HEX_PI:POSI-V")
self.hex_w = PV("SARES20-HEX_PI:POSI-W")
if "phi_hex" in self.configuration:
### motors PI hexapod ###
self.hex_x = PV("SARES20-HEX_PI:POSI-X")
self.hex_y = PV("SARES20-HEX_PI:POSI-Y")
self.hex_z = PV("SARES20-HEX_PI:POSI-Z")
self.hex_u = PV("SARES20-HEX_PI:POSI-U")
self.hex_v = PV("SARES20-HEX_PI:POSI-V")
self.hex_w = PV("SARES20-HEX_PI:POSI-W")
def get_adjustable_positions_str(self):
ostr = "*****XRD motor positions******\n"
for tkey, item in self.__dict__.items():
if hasattr(item, "get_current_value"):
pos = item.get_current_value()
ostr += " " + tkey.ljust(17) + " : % 14g\n" % pos
return ostr
def __repr__(self):
s = "**Heavy Load**\n"
motors = "xmu mu tth xbase ybase".split()
for motor in motors:
s += " - %s %.4f\n" % (motor, getattr(self, motor).wm())
s += " - xhl %.4f\n" % (self.xhl.wm())
s += " - yhl %.4f\n" % (self.yhl.wm())
s += " - zhl %.4f\n" % (self.zhl.wm())
s += " - th %.4f\n" % (self.th.wm())
s += "\n"
s += "**Gonio**\n"
motors = "xmu mu tth delta det_z cam_z xbase ybase".split()
for motor in motors:
s += " - %s %.4f\n" % (motor, getattr(self, motor).wm())
s += "\n"
s += "**Hexapod**\n"
motors = "x y z u v w".split()
for motor in motors:
s += " - hex_%s %.4f\n" % (motor, getattr(self, "hex_" + motor).get())
return s
return self.get_adjustable_positions_str()