38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
dry_run = False
|
|
do_elog = True
|
|
|
|
if get_exec_pars().source == CommandSource.ui:
|
|
las_offset_deg = 0.0
|
|
plt = None
|
|
else:
|
|
las_offset_deg = args[0]
|
|
plt = args[1]
|
|
cur_las_delay = 0.0
|
|
if Laser == "Alcor":
|
|
cur_las_delay = caget("SLGOS01-TSPL-ALC:CURR_DELTA_T")
|
|
elif Laser == "Jaguar":
|
|
cur_las_delay = caget("SLGJG-TSPL-JAG:CURR_DELTA_T")
|
|
new_las_delay = cur_las_delay - 333.467 * las_offset_deg / 360.0
|
|
if not dry_run:
|
|
if Laser == "Alcor":
|
|
caput("SLGOS01-TSPL-ALC:NEW_DELTA_T" , new_las_delay )
|
|
caput("SLGOS01-TSPL-ALC:SET_NEW_PHASE.PROC" , 1 )
|
|
elif Laser == "Jaguar":
|
|
caput("SLGJG-TSPL-JAG:NEW_DELTA_T" , new_las_delay )
|
|
caput("SLGJG-TSPL-JAG:SET_NEW_PHASE.PROC" , 1 )
|
|
if do_elog:
|
|
title = "Set laser delay"
|
|
log_msg = ""
|
|
if Laser == "Alcor":
|
|
log_msg = "SLGOS01-TSPL-ALC:NEW_DELTA_T: %0.4f" % new_las_delay + " ps (was %0.2f" % cur_las_delay + " ps)\n"
|
|
elif Laser == "Jaguar":
|
|
log_msg = "SLGJG-TSPL-JAG:NEW_DELTA_T: %0.4f" % new_las_delay + " ps (was %0.2f" % cur_las_delay + " ps)\n"
|
|
attachments = []
|
|
if plt is not None:
|
|
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
|
|
file_name = os.path.abspath(get_context().setup.getContextPath() + "/GunEnergyScanLasSet.png")
|
|
plt.saveSnapshot(file_name , "png")
|
|
attachments = [file_name]
|
|
elog(title, log_msg, attachments)
|
|
show_message("Success setting laser delay")
|