This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
mount_sample_id = None
|
||||
mount_sample_detected = None
|
||||
|
||||
def mount(segment, puck, sample, force=False, read_dm=False):
|
||||
"""
|
||||
"""
|
||||
global mount_sample_id, mount_sample_detected
|
||||
print "mount: ", segment, puck, sample, force
|
||||
start = time.time()
|
||||
|
||||
puck_address = get_puck_address(puck)
|
||||
if puck_address is None:
|
||||
puck_obj = get_puck_obj_by_id(puck)
|
||||
if puck_obj is not None:
|
||||
puck_address = puck_obj.name
|
||||
if puck_address is not None:
|
||||
print "puck address: ", puck_address
|
||||
segment = puck_address[:1]
|
||||
puck = int(puck_address[1:])
|
||||
#Initial checks
|
||||
assert_valid_address(segment, puck, sample)
|
||||
assert_puck_detected(segment, puck)
|
||||
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.wait_ready()
|
||||
@@ -31,25 +44,31 @@ def mount(segment, puck, sample, force=False, read_dm=False):
|
||||
robot.move_dewar()
|
||||
|
||||
robot.get_dewar(segment, puck, sample)
|
||||
|
||||
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
|
||||
|
||||
if read_dm:
|
||||
barcode_reader.start_read(10.0)
|
||||
robot.move_scanner()
|
||||
robot.move_scanner()
|
||||
time.sleep(1.0)
|
||||
|
||||
robot.move_gonio()
|
||||
|
||||
|
||||
if read_dm:
|
||||
dm = barcode_reader.get_readout()
|
||||
print "Datamatrix: " , dm
|
||||
mount_sample_id = barcode_reader.get_readout()
|
||||
print "Datamatrix: " , mount_sample_id
|
||||
else:
|
||||
mount_sample_id = None
|
||||
|
||||
smart_magnet.set_mount_current()
|
||||
try:
|
||||
robot.put_gonio()
|
||||
robot.move_dewar()
|
||||
sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
#TODO: Should do on finally?
|
||||
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, sample_detected)
|
||||
if sample_detected == False:
|
||||
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
|
||||
if mount_sample_detected == False:
|
||||
raise Exception("No pin detected on gonio")
|
||||
return [mount_sample_detected, mount_sample_id]
|
||||
finally:
|
||||
smart_magnet.set_default_current()
|
||||
|
||||
Reference in New Issue
Block a user