Files
sf-op/script/RFscan/GunEnergyScanRfSetNew.py
root 571ead1c9e
2018-09-24 08:35:56 +02:00

26 lines
1.1 KiB
Python

dry_run = False
do_elog = True
if get_exec_pars().source == CommandSource.ui:
bph_ref_user = 90.0
plt = None
else:
bph_ref_user = args[0]
plt = args[1]
phase_offset_old = caget("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE")
phase_offset_new = phase_offset_old - (bph_ref_user - 90.0)
if not dry_run:
caput("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE" , phase_offset_new )
caput("SINEG01-RSYS:CMD-LOAD-CALIB-BEAM" , 1 )
if do_elog:
title = "Set gun phase"
log_msg = "SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE: %8.2f" % phase_offset_new + " deg (was %8.2f" % phase_offset_old + " deg)\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() + "/GunEnergyScanRfSet.png")
plt.saveSnapshot(file_name , "png")
attachments = [file_name]
elog(title, log_msg, attachments)
show_message("Success setting phase reference")