GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit 07f7c8c4 authored by bliss administrator's avatar bliss administrator

Changed configuration of motor calibration positions

parent 719173b9
......@@ -336,7 +336,7 @@ def init_srot():
srot.dial = 0
srot.position = 0
pos = setup_globals.sample_changer.parameters.calibration_positions['srot']
pos = setup_globals.SampleChanger.calibration_positions['srot']
start=time.time()
srot.controller.home_search(srot,1,pos)
......
......@@ -19,77 +19,38 @@ from PyTango import DeviceProxy
class SampleChanger:
def __init__(self):
self.samples_device = DeviceProxy("id19/tomo-samples/all")
self.robot_device = DeviceProxy("id19/tomo-sample/changer")
self.parameters = ParametersWardrobe('SampleChanger')
def __init__(self, name, config):
self.parameters.add('robot_positions',dict())
self.parameters.add('experiment_positions',dict())
self.parameters.add('calibration_positions',dict())
tango_server = config['tango_server'][0]
self.samples_device = DeviceProxy(tango_server['samples'])
self.robot_device = DeviceProxy(tango_server['robot'])
if 'MrTomo' in get_current_session().object_names:
self.tomo = 'MrTomo'
positions = config['positions'][0]
mr_positions = positions['Mr'][0]
# calibration positions
calibration_positions = {}
calibration_positions['srot'] = 172.5 # user position
calibration_positions = mr_positions['calibration'].to_dict()
robot_positions = mr_positions['robot'].to_dict()
experiment_positions = mr_positions['experiment'].to_dict()
elif 'HrTomo' in get_current_session().object_names:
self.tomo = 'HrTomo'
positions = config['positions'][0]
hr_positions = positions['Hr']
# robot positions
robot_positions = {}
robot_positions['yrot'] = -223.0 # dial position
robot_positions['xc'] = 250.0 # user position
robot_positions['srot'] = 0.0 # dial position
robot_positions['sx'] = 0.0 # dial position
robot_positions['sy'] = 0.0 # dial position
robot_positions['sz'] = -287.0 # dial position
# experiment positions
experiment_positions = {}
experiment_positions['sz'] = 0.0 # user position
experiment_positions['yrot'] = 0.0 # user position
else:
if 'HrTomo' in get_current_session().object_names:
self.tomo = HrTomo
self.shutter = HrTomo.shutter
# calibration positions
calibration_positions = {}
calibration_positions['srot'] = 248 # user position
# robot positions
robot_positions = {}
robot_positions['yrot'] = -16.0 # user position
#robot_positions['xc'] = 760.0 # user position
robot_positions['xc'] = 226 # user position
robot_positions['z0'] = 11.0 # user position
robot_positions['srot'] = 0.0 # dial position
robot_positions['sx'] = 0.0 # dial position
robot_positions['sy'] = 0.0 # dial position
robot_positions['sz'] = 30.0 # dial position
# experiment positions
experiment_positions = {}
experiment_positions['xc'] = HrTomo.parameters.sample_detector_distance
experiment_positions['sz'] = 30.0 # user position
experiment_positions['yrot'] = 0.0 # user position
experiment_positions['z0'] = 11.0 # user position
calibration_positions = hr_positions['calibration'].to_dict()
robot_positions = hr_positions['robot'].to_dict()
experiment_positions = hr_positions['experiment'].to_dict()
else:
print('No sample change positions defined for this setup')
self.parameters.purge()
return
else:
print('No sample change positions defined for this setup')
return
self.parameters.robot_positions = robot_positions
self.parameters.experiment_positions = experiment_positions
self.parameters.calibration_positions = calibration_positions
self.robot_positions = robot_positions
self.experiment_positions = experiment_positions
self.calibration_positions = calibration_positions
self.sample_positions=list()
for col in ['A','B','C']:
......@@ -183,7 +144,7 @@ class SampleChanger:
except Exception as exception:
self._tango_error(exception)
return
self.parameters.experiment_positions['sz'] = align_sz
self.experiment_positions['sz'] = align_sz
def delete_sample(self):
......@@ -720,6 +681,7 @@ class SampleChanger:
# Execute scan sequence
#
def execute_scan_sequence(self):
tomo = config.get(self.tomo)
start_scan = UserYesNo(label="Do you want to run the scan sequence now?",defval=True)
ret = display(start_scan, title='Execute scan sequence')
......@@ -732,15 +694,15 @@ class SampleChanger:
if self.tomo_sequence[sample]['scan'][0] == 'fasttomo':
self.tomo.half_turn_scan(scan_name='fasttomo',sample_name=self.tomo_sequence[sample]['name'])
tomo.half_turn_scan(scan_name='fasttomo',sample_name=self.tomo_sequence[sample]['name'])
elif self.tomo_sequence[sample]['scan'][0] == 'fasttomo360':
self.tomo.full_turn_scan(scan_name='fasttomo360',sample_name=self.tomo_sequence[sample]['name'])
tomo.full_turn_scan(scan_name='fasttomo360',sample_name=self.tomo_sequence[sample]['name'])
elif self.tomo_sequence[sample]['scan'][0] == 'zseries':
self.tomo.zseries(self.tomo_sequence[sample]['scan'][1],self.tomo_sequence[sample]['scan'][2],scan_name='zseries',sample_name=self.tomo_sequence[sample]['name'])
tomo.zseries(self.tomo_sequence[sample]['scan'][1],self.tomo_sequence[sample]['scan'][2],scan_name='zseries',sample_name=self.tomo_sequence[sample]['name'])
self.unload_sample()
......@@ -797,7 +759,7 @@ class SampleChanger:
return
else:
# if not aligned, go to the default experiment positions
align_pos = [0,0,self.parameters.experiment_positions['sz']]
align_pos = [0,0,self.experiment_positions['sz']]
print("\nMove to sample change position")
self.change_position()
......@@ -1078,25 +1040,25 @@ class SampleChanger:
# Move the detector away
det_pos = xc.position
print(f"Current detector position: {det_pos}")
if self.parameters.robot_positions['xc'] > det_pos:
det_pos = self.parameters.robot_positions['xc']
if self.robot_positions['xc'] > det_pos:
det_pos = self.robot_positions['xc']
print("\nMove the detector away")
print("Move detector to: {det_pos}")
umv(xc,det_pos)
pos1 = self.parameters.robot_positions['yrot']
pos1 = self.robot_positions['yrot']
umv(yrot,pos1)
if 'z0' in self.parameters.robot_positions:
pos = self.parameters.robot_positions['z0']
if 'z0' in self.robot_positions:
pos = self.robot_positions['z0']
print(f"\nMove z0 to: {pos}")
umv(z0,pos)
# move the dial positions
pos1 = self.parameters.robot_positions['srot']
pos2 = self.parameters.robot_positions['sx']
pos3 = self.parameters.robot_positions['sy']
pos4 = self.parameters.robot_positions['sz']
pos1 = self.robot_positions['srot']
pos2 = self.robot_positions['sx']
pos3 = self.robot_positions['sy']
pos4 = self.robot_positions['sz']
print(f"\nMove sz to {pos4}")
umv(srot,pos1,sx,pos2,sy,pos3,sz,pos4)
......@@ -1112,16 +1074,16 @@ class SampleChanger:
print(f"\nMove sz to: {sz_pos}")
umv(sx,sx_pos,sy,sy_pos,sz,sz_pos)
if 'z0' in self.parameters.experiment_positions:
pos = self.parameters.experiment_positions['z0']
if 'z0' in self.experiment_positions:
pos = self.experiment_positions['z0']
print(f"\nMove z0 to: {pos}")
umv(z0,pos)
pos = self.parameters.experiment_positions['yrot']
pos = self.experiment_positions['yrot']
print(f"\nMove yrot to: {pos}")
umv(yrot,pos)
pos = self.parameters.experiment_positions['xc']
pos = self.experiment_positions['xc']
print("\nMove the detector closer")
print(f"Move detector to: {pos}")
umv(xc,pos)
......@@ -1232,7 +1194,7 @@ def radio_all_samples(expo_time_tomo=0.5,expo_time_vis=0.5):
sample_changer = SampleChanger()
tomo = sample_changer.tomo
tomo = config.get(self.tomo)
tomo_ccd = tomo.tomo_ccd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment