recover smartmagnet use in mount & unmount scripts
- they were removed for the smargon tests
This commit is contained in:
+38
-15
@@ -62,11 +62,22 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
assert_mount_position()
|
||||
do_unmount = False
|
||||
print "%4.1f s asserted " % (tg() - t1,)
|
||||
|
||||
|
||||
# detect sample before moving to cold
|
||||
if smart_magnet.get_supress() == True:
|
||||
smart_magnet.set_supress(False)
|
||||
time.sleep(0.2)
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
Controller.getInstance().logEvent("Sample Detection", str(sample_det))
|
||||
|
||||
print "%4.1f s SMC checked" % (tg() - t1,)
|
||||
|
||||
|
||||
|
||||
mounting_in_same_segment = False
|
||||
mounting_in_same_segment = False
|
||||
|
||||
try:
|
||||
try:
|
||||
if sample_det == True:
|
||||
if was_warm and previous_segment in COLD_SEGMENTS:
|
||||
print " was warm previous %s %s %s" % (previous_segment, COLD_SEGMENTS, previous_mounted)
|
||||
robot.move_cold()
|
||||
@@ -81,6 +92,10 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
print "%4.1f s ....done" % (tg() - t1,)
|
||||
|
||||
do_unmount = True
|
||||
if sample_det == True:
|
||||
raise Exception("Pin detected on gonio")
|
||||
|
||||
|
||||
|
||||
if is_normal and not robot.is_cold():
|
||||
print "mount():83 needs_chilling"
|
||||
@@ -117,7 +132,7 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
if (not robot.is_dewar()) and (not mounting_in_same_segment):
|
||||
robot.move_dewar()
|
||||
print "%4.1f s get_dewar" % (tg() - t1,)
|
||||
print "%4.1f s get_dewar" % (tg() - t1,)
|
||||
robot.get_dewar(segment, puck, sample, mounting_in_same_segment=mounting_in_same_segment)
|
||||
|
||||
|
||||
if read_dm:
|
||||
@@ -139,14 +154,14 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
|
||||
print "%4.1f s moving cryo out" % (tg() - t1,)
|
||||
curpos = cryopos.getPosition()
|
||||
curpos = cryopos.getPosition()
|
||||
speed = cryopos.getSpeed() / 1000.
|
||||
movetime = int(round(3000 + abs(15. - curpos) / speed))
|
||||
cryopos.move(15.0, movetime)
|
||||
speed = cryopos.getSpeed() / 1000.
|
||||
movetime = int(round(3000 + abs(15. - curpos) / speed))
|
||||
cryopos.move(15.0, movetime)
|
||||
cryopos.waitValueInRange(15.0, 1.0, movetime)
|
||||
|
||||
|
||||
print " ....done\n%4.1f s putting_gonio with pin_offset = %.1f mm" % (tg() - t1, pin_offset)
|
||||
robot.put_gonio()
|
||||
print " ....done\n%4.1f s putting_gonio with pin_offset = %.1f mm" % (tg() - t1, pin_offset)
|
||||
robot.put_gonio()
|
||||
print "%4.1f s .....done" % (tg() - t1,)
|
||||
|
||||
if is_normal:
|
||||
print "%4.1f s async moving cryo to 5mm " % (tg() - t1,)
|
||||
@@ -179,14 +194,22 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
else:
|
||||
robot.move_cold()
|
||||
|
||||
|
||||
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, True, mount_sample_id)
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
Controller.getInstance().logEvent("Sample Detection", str(mount_sample_detected))
|
||||
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")
|
||||
|
||||
|
||||
if is_force_dry():
|
||||
smart_magnet.set_default_current()
|
||||
print "%4.1f Auto dry async" % (tg() - t1,)
|
||||
log("Starting auto dry", False)
|
||||
set_exec_pars(then = "dry()")
|
||||
|
||||
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
|
||||
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
|
||||
return [mount_sample_detected, mount_sample_id]
|
||||
finally:
|
||||
finally:
|
||||
print "%4.1f s magnet suppress/default current" % (tg() - t1,)
|
||||
smart_magnet.set_default_current()
|
||||
smart_magnet.set_supress(True)
|
||||
|
||||
@@ -55,6 +55,20 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
Controller.getInstance().logEvent("Unmount Sample", str(segment) + str(puck) + str(sample))
|
||||
|
||||
try:
|
||||
if smart_magnet.get_supress() == True:
|
||||
smart_magnet.set_supress(False)
|
||||
time.sleep(0.2)
|
||||
|
||||
#smart_magnet.apply_reverse()
|
||||
#smart_magnet.apply_resting()
|
||||
|
||||
if not force:
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.5, timeout = 3.0)
|
||||
Controller.getInstance().logEvent("Sample Detection", str(sample_det))
|
||||
if sample_det == False:
|
||||
raise Exception("No pin detected on gonio")
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
if is_normal:
|
||||
@@ -82,6 +96,11 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
|
||||
robot.get_gonio()
|
||||
|
||||
smart_magnet.apply_reverse()
|
||||
smart_magnet.apply_resting()
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
Controller.getInstance().logEvent("Sample Detection", str(mount_sample_detected))
|
||||
|
||||
if is_aux:
|
||||
robot.move_aux()
|
||||
robot.put_aux(sample)
|
||||
@@ -94,6 +113,8 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
robot.put_dewar(segment, puck, sample)
|
||||
|
||||
set_setting("mounted_sample_position", None)
|
||||
return False
|
||||
return mount_sample_detected
|
||||
finally:
|
||||
pass
|
||||
if not auto_unmount:
|
||||
smart_magnet.set_default_current()
|
||||
smart_magnet.set_supress(True)
|
||||
|
||||
Reference in New Issue
Block a user