forked from slaclab/Q0Measurement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runFE.py
36 lines (28 loc) · 1.19 KB
/
runFE.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from __future__ import print_function, division
from container import Cryomodule
from subprocess import CalledProcessError
from sys import stdout, stderr
from time import sleep
#GRAD_PV = "SEL_ASET"
GRAD_PV = "ADES"
if __name__ == "__main__":
# noinspection PyUnboundLocalVariable
#cavity = (Cryomodule(int(raw_input("SLAC CM: ")),
# int(raw_input("JLAB CM: ")))
# .cavities[int(raw_input("Cavity: "))])
cavity = Cryomodule(16, 2).cavities[7]
try:
#if GRAD_PV == "SEL_ASET":
#cavity.checkAndSetOnTime()
#cavity.phaseCavity()
# step size of 0.5 corresponds to roughly 0.2 MV/m
cavity.walkToGradient(desiredGradient=15.3, step=0.5, loopTime=2.5,
getFieldEmissionData=False, pv=GRAD_PV)
cavity.walkToGradient(desiredGradient=8, step=0.1, loopTime=45,
getFieldEmissionData=True, pv=GRAD_PV)
#cavity.powerDown()
except(CalledProcessError, IndexError, OSError, ValueError,
AssertionError) as e:
stderr.write("\nProcedure failed with error:\n{E}\n\n".format(E=e))
sleep(0.01)
cavity.powerDown()