This commit is contained in:
gac-x11ma
2024-03-19 16:16:03 +01:00
parent 1d75bc4535
commit 8aefd82ba7
72 changed files with 5064 additions and 75 deletions
+63 -4
View File
@@ -14,8 +14,8 @@ class LEEM2000(TcpDevice):
self.debug = False
self.retries = 1
self.timeout = 1000
self.move_timeout = 300000 #5min
self.homing_timeout = 300000 #5min
self.move_timeout = 600000 #5min
self.homing_timeout = 600000 #5min
def doInitialize(self):
super(LEEM2000, self).doInitialize()
@@ -143,6 +143,13 @@ class LEEM2000(TcpDevice):
ret.initialize()
return ret
def get_slit_motor(self, motor_id, encoder_index, name=None):
if name is None:
name=str(motor_id)
ret = LEEM2000SlitMotor(name, motor_id, encoder_index, self)
ret.initialize()
return ret
def get_tilt(self, motor_id_pos, motor_id_neg, name=None):
if name is None:
name=str(motor_id_pos) + "_" + str(motor_id_neg)
@@ -150,6 +157,12 @@ class LEEM2000(TcpDevice):
ret.initialize()
return ret
def get_motor(self, motor_id, name=None):
if name is None:
name=str(motor_id)
ret = LEEM2000Motor(name, motor_id, self)
ret.initialize()
return ret
def get_manip_readback(self, timeout = None, retries = None):
ret = microscope.send_receive("gmv", timeout, retries)
@@ -265,6 +278,45 @@ class LEEM2000ManipMotor(PositionerBase):
pos_mm= self.microscope.get_manip_readback()[self.encoder_index]
return pos_mm*1000.0
class LEEM2000SlitMotor(PositionerBase):
def __init__(self, name, motor_id, encoder_index, microscope):
PositionerBase.__init__(self, name, PositionerConfig())
self.motor_id = motor_id
self.encoder_index = encoder_index
self.microscope = microscope
self.pos = None
def doRead(self):
if self.pos is None:
self.pos = float(self.doReadReadback())
return self.pos
def doWrite(self, val):
self.microscope.move_motor(self.motor_id, val)
self.pos = None
def doReadReadback(self):
pos_step = self.microscope.get_value(str(self.encoder_index))
#pos_mm= self.microscope.get_manip_readback()[self.encoder_index]
return pos_step*0.700
class LEEM2000Motor(PositionerBase):
def __init__(self,name, motor_id, microscope):
PositionerBase.__init__(self,name, PositionerConfig())
self.motor_id = motor_id
self.microscope = microscope
self.pos = None
def doRead(self):
#self.microscope.get_value(str(self.motor_id))
return self.pos
def doWrite(self, val):
self.microscope.move_motor(self.motor_id, val)
self.pos = val
class LEEM2000Tilt(RegisterBase):
def __init__(self,name, motor_id_pos, motor_id_neg, microscope):
RegisterBase.__init__(self,name)
@@ -300,7 +352,13 @@ add_device (microscope.get_child("FIL","fil"), True)
add_device (microscope.get_child("STV","start_voltage"), True)
add_device (microscope.get_child("OBJDX","obj_align_x"), True)
add_device (microscope.get_child("OBJDY","obj_align_y"), True)
add_device (microscope.get_child("HMOTSLIT","slitttt"), True)
add_device (microscope.get_child("HMOTSLIT","slit_motion_pos"), True)
#add_device (microscope.get_child("76","slit_motion_pos"), True)
#add_device (microscope.get_child("HMOTCAX","ca_motion_pos"), True)
#add_device (microscope.get_child("HMOTCAY","ca_correction_pos"), True)
add_device (microscope.get_motor(1, "ca_correction"), True)
add_device (microscope.get_motor(2, "ca_motion"), True)
add_device (microscope.get_slit_motor(7, 76, "slit_motion"), True)
microscope.setPolling(5000)
@@ -317,7 +375,7 @@ class TiltMotor(RegisterBase):
return self.position
def doWrite(self, pos):
if abs(pos)>8000:
if abs(pos)>10000:
raise Exception("Exceeded device range")
offset = pos -self.position
self.tilt_motor.write(offset)
@@ -355,6 +413,7 @@ azimuth_rot.precision=1
azimuth_rot.polling=5000
bv.polling=1000
fil.polling=1000
slit_motion.polling=1000
#Create a listener to the sensor, verifying the readback values.
class ListenerAzimuth (DeviceListener):