Files
sf-op/script/test/GunEnergyScanSet.py
2017-12-05 09:01:44 +01:00

25 lines
1009 B
Python

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