class Microscope: def __init__(self, ID, gonio=None, rotat=None, alias_namespace=None, z_undulator=None, description=None): self.ID = ID ### Microscope motors ### self.focus = Motor(ID + ":FOCUS") self.zoom = Motor(ID + ":ZOOM") # self._smaractaxes = { # 'gonio': '_xmic_gon', # will become self.gonio # 'rot': '_xmic_rot'} # """ self.rot self.gonio = SmarActAxis(gonio) #TODO: can this be None? self.rot = SmarActAxis(rotat) #TODO: can this be None? def __str__(self): return "Microscope positions\nfocus: %s\nzoom: %s\ngonio: %s\nrot: %s" % ( self.focus.wm(), self.zoom.wm(), self.gonio.wm(), self.rot.wm()) def __repr__(self): return "{'Focus': %s, 'Zoom': %s, 'Gonio': %s, 'Rot': %s}" % ( self.focus.wm(), self.zoom.wm(), self.gonio.wm(), self.rot.wm())
class Table: def __init__(self, ID, alias_namespace=None, z_undulator=None, description=None): self.ID = ID ### ADC optical table ### self.x1 = Motor(ID + ":MOTOR_X1") self.y1 = Motor(ID + ":MOTOR_Y1") self.y2 = Motor(ID + ":MOTOR_Y2") self.y3 = Motor(ID + ":MOTOR_Y3") self.z1 = Motor(ID + ":MOTOR_Z1") self.z2 = Motor(ID + ":MOTOR_Z2") self.x = Motor(ID + ":W_X") self.y = Motor(ID + ":W_Y") self.z = Motor(ID + ":W_Z") self.pitch = Motor(ID + ":W_RX") self.yaw = Motor(ID + ":W_RY") self.roll = Motor(ID + ":W_RZ") self.modeSP = PV(ID + ":MODE_SP") self.status = PV(ID + ":SS_STATUS") def __str__(self): return "Prime Table position\nx: %s mm\ny: %s mm\nz: %s\npitch: %s mrad\nyaw: %s mrad\nmode SP: %s \nstatus: %s" % ( self.x.wm(), self.y.wm(), self.z.wm(), self.pitch.wm(), self.yaw.wm(), self.modeSP.get(as_string=True), self.status.get()) def __repr__(self): return "{'x': %s, 'y': %s,'z': %s,'pitch': %s, 'yaw': %s, 'mode set point': %s,'status': %s}" % ( self.x, self.y, self.z, self.pitch, self.yaw, self.modeSP.get(as_string=True), self.status.get())
class GPS: def __init__(self, ID, alias_namespace=None): self.ID = ID ### motors heavy load gps table ### self.xhl = Motor(ID + ":MOT_TBL_TX") self.zhl = Motor(ID + ":MOT_TBL_TZ") self.yhl = Motor(ID + ":MOT_TBL_TY") self.th = Motor(ID + ":MOT_MY_RYTH") try: self.rxhl = Motor(ID + ":MOT_TBL_RX") except: print("GPS.pitch not found") pass try: self.ryhl = Motor(ID + ":MOT_TBL_RY") except: print("GPS.roll not found") pass ### motors heavy load gonio base ### self.xmu = Motor(ID + ":MOT_HEX_TX") self.mu = Motor(ID + ":MOT_HEX_RX") self.tth = Motor(ID + ":MOT_NY_RY2TH") self.xbase = Motor(ID + ":MOT_TX") self.ybase = Motor(ID + ":MOT_TY") 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 __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 += " - HLX %.4f\n" % (self.xhl.wm()) s += " - HLY %.4f\n" % (self.yhl.wm()) s += " - HLZ %.4f\n" % (self.zhl.wm()) s += " - HLTheta %.4f\n" % (self.th.wm()) s += "\n" s += "**Gonio**\n" motors = "xmu mu tth 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
class VonHamosBragg: def __init__(self, ID, alias_namespace=None, z_undulator=None, description=None): self.ID = ID ### Owis linear stages ### self.cry1 = Motor(ID + ":CRY_1") self.cry2 = Motor(ID + ":CRY_2") def __str__(self): return "von Hamos positions\nCrystal 1: %s mm\nCrystal 2: %s mm" % ( self.cry1.wm(), self.cry2.wm()) def __repr__(self): return "{'Crystal 1': %s, 'Crystal 2': %s}" % (self.cry1.wm(), self.cry2.wm())
class Huber: def __init__(self, ID, alias_namespace=None, z_undulator=None, description=None, name="Prime Sample Manipulator"): self.ID = ID ### Huber sample stages ### self.x = Motor(ID + ":MOTOR_X1", name + " X") self.y = Motor(ID + ":MOTOR_Y1", name + " Y") self.z = Motor(ID + ":MOTOR_Z1", name + " Z") def __str__(self): return "Huber Sample Stage %s\nx: %s mm\ny: %s mm\nz: %s mm" % ( self.ID, self.x.wm(), self.y.wm(), self.z.wm()) def __repr__(self): return "{'X': %s, 'Y': %s, 'Z': %s}" % (self.x.wm(), self.y.wm(), self.z.wm())
class XRD: def __init__(self, name=None, ID=None, configuration=[]): """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) ### motors base platform ### self.xbase = Motor(ID + ":MOT_TX", name="xbase") self.ybase = Motor(ID + ":MOT_TY", name="ybase") self.rxbase = Motor(ID + ":MOT_RX", name="rxbase") self.omega = Motor(ID + ":MOT_MY_RYTH", name="omega") ### motors XRD detector arm ### self.gamma = Motor(ID + ":MOT_NY_RY2TH", name="gam") self.delta = Motor(ID + ":MOT_DT_RX2TH", name="del") ### motors XRD area detector branch ### self.tdet = Motor(ID + ":MOT_D_T", name="tdet") ### motors XRD polarisation analyzer branch ### self.tpol = Motor(ID + ":MOT_P_T", name="tpol") # missing: slits of flight tube ### motors heavy load goniometer ### self.xhl = Motor(ID + ":MOT_TBL_TX", name="xhl") self.zhl = Motor(ID + ":MOT_TBL_TZ", name="zhl") self.yhl = Motor(ID + ":MOT_TBL_TY", name="yhl") try: self.rxhl = Motor(ID + ":MOT_TBL_RX", name="rxhl") except: print("GPS.pitch not found") pass try: self.ryhl = Motor(ID + ":MOT_TBL_RY", name="rxhl") except: print("GPS.roll not found") pass ### motors nu table ### self.tnu = Motor(ID + ":MOT_HEX_TX", name="tnu") self.nu = Motor(ID + ":MOT_HEX_RX", name="nu") ### 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 __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