Files
sf-rf/script/jitter_scan.py
2016-06-28 11:13:06 +02:00

77 lines
2.3 KiB
Python

import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
latency = 1.3
SECTION = "SINSB02"
start = -170.0
stop = 180.0
step = 10.0
def elogllrf(subject, message, attachments = [], system, subsystem, section):
"""
Add entry to ELOG.
"""
if author is None:
author = "pshell" + controller.getUser().name
entry = ""
cmd = 'G_CS_ELOG_add -l "' + logbook+ '" '
cmd = cmd + '-a "Author=' + author + '" '
cmd = cmd + '-a "Entry=' + entry + '" '
cmd = cmd + '-a "Subject=' + subject + '" '
cmd = cmd + '-a "Section=' + section + '" '
cmd = cmd + '-a "System=' + system + '" '
cmd = cmd + '-a "Subsystem=' + subsystem + '" '
cmd = cmd + '-a "Machine=' + machine + '" '
cmd = cmd + '-a "Domain=All"'
for attachment in attachments:
cmd = cmd + '-f "' + attachment + '" '
cmd = cmd + '-x -n 1'
cmd = cmd + ' "' + message + '"'
print cmd
#os.system (cmd)
#print os.popen(cmd).read()
import subprocess
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
if (err is not None) and err!="":
raise Exception(err)
print out
print "SECTION = ", SECTION
print "Start = ", start
print "Stop = ", stop
print "Step = ", step
# controlled variabales
#cv_rf_phase = Channel(SECTION + "-RLLE-DSP:PHASE-REFERENCE")
#cv_rf_amplt = Channel(SECTION + "-RLLE-DSP:AMPLT-REFERENCE")
# measured variables
#mv_ref_jit_amplt = Channel(SECTION + "-RLLE-REF10:SIG-AMPLT-JIT-P2P-REL")
#mv_ref_jit_PHASE = Channel(SECTION + "-RLLE-REF10:SIG-PHASE-JIT-P2P")
#mv_iqm_jit_amplt = Channel(SECTION + "-RIQM-DCP10:FOR-AMPLT-JIT-P2P-REL")
#mv_iqm_jit_PHASE = Channel(SECTION + "-RIQM-DCP10:FOR-PHASE-JIT-P2P")
#mv_pre_jit_amplt = Channel(SECTION + "-RPRE-DCP10:FOR-AMPLT-JIT-P2P-REL")
#mv_pre_jit_PHASE = Channel(SECTION + "-RPRE-DCP10:FOR-PHASE-JIT-P2P")
#mv_kly_jit_amplt = Channel(SECTION + "-RKLY-DCP10:FOR-AMPLT-JIT-P2P-REL")
#mv_kly_jit_PHASE = Channel(SECTION + "-RKLY-DCP10:FOR-PHASE-JIT-P2P")
#r = lscan(cv_rf_phase, (mv_ref_jit_amplt,mv_ref_jit_PHASE,mv_iqm_jit_amplt,mv_iqm_jit_PHASE,mv_pre_jit_amplt,mv_pre_jit_PHASE,mv_kly_jit_amplt,mv_kly_jit_PHASE), start, stop, step , latency=latency)
elogllrf("Hallo Test", "Das ist meine Nachricht...", [], "LLRF", "General", "SINEG01","SwissFEL","LLRF")