32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
dry_run = False
|
|
do_elog = True
|
|
|
|
if get_exec_pars().source == CommandSource.ui:
|
|
bph_ref_user = 0.0
|
|
plt = None
|
|
else:
|
|
bph_ref_user = args[0]
|
|
plt = args[1]
|
|
|
|
rph_ref_new = rph_ref_guess + (bph_ref_guess - bph_ref_user)
|
|
phaseOffset = -rph_ref_new
|
|
bph_ref_new = rph_ref_new + phaseOffset
|
|
print "Setting phase offset: ", phaseOffset
|
|
if not dry_run:
|
|
caput('SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE', phaseOffset)
|
|
caput('SINEG01-RSYS:CMD-LOAD-CALIB-BEAM', 1)
|
|
|
|
if do_elog:
|
|
log_msg = "RF phase reference: %0.1f" % rph_ref_new + "deg \n"
|
|
log_msg = log_msg + "Phase offset: %0.1f" % phaseOffset + "deg \n"
|
|
log_msg = log_msg + "Beam phase reference: %0.1f" % bph_ref_new + "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() + "/SchottkyScanSetPlot.png")
|
|
plt.saveSnapshot(file_name , "png")
|
|
attachments = [file_name]
|
|
elog("SchottkyScanSet", log_msg, attachments)
|
|
|
|
show_message("Success setting phase reference")
|