149 lines
2.6 KiB
Python
149 lines
2.6 KiB
Python
from time import sleep
|
|
from epics import caget, caput
|
|
from slic.utils import as_shortcut
|
|
|
|
|
|
KSET_FMT = "SATUN{:02}-UIND030:K_SET"
|
|
RADIALGO_FMT = "SATUN{:02}-UIND030:RADIAL-GO"
|
|
#PHASESET_FMT = "SATUN{:02}-CHIC:PHASE"
|
|
N_UND_CHIC = 14
|
|
N_UNDS = list(range(6, 22+1))
|
|
N_UNDS.remove(N_UND_CHIC)
|
|
|
|
|
|
#FMT_G1 = "SATUN{:02}-CHIC:G1"
|
|
#FMT_G2 = "SATUN{:02}-CHIC:G2"
|
|
#FMT_GD = "SATUN{:02}-UDLY060:GAP-D-SET"
|
|
#FMT_GU = "SATUN{:02}-UDLY060:GAP-U-SET"
|
|
|
|
|
|
#ksets = {n: caget(KSET_FMT.format(n)) for n in n_unds}
|
|
#ksets
|
|
|
|
|
|
color1 = {
|
|
6: 3.2133440611047375,
|
|
7: 3.2133806668053135,
|
|
8: 3.2133806668053135,
|
|
9: 3.2133806668053135,
|
|
10: 3.2133806668053135,
|
|
11: 3.2133806668053135,
|
|
12: 3.201342229977879,
|
|
13: 3.189306875960779,
|
|
|
|
15: 1.7020000000000002,
|
|
16: 3.702,
|
|
17: 2.202,
|
|
18: 3.202,
|
|
19: 2.402,
|
|
20: 2.9966,
|
|
21: 2.8912,
|
|
22: 2.4858000000000002
|
|
}
|
|
|
|
|
|
color2 = {
|
|
6: 3.0528,
|
|
7: 3.4528000000000003,
|
|
8: 3.6528,
|
|
9: 2.8528000000000002,
|
|
10: 3.7,
|
|
11: 2.9528000000000003,
|
|
12: 2.7407,
|
|
13: 3.1286,
|
|
|
|
15: 2.702,
|
|
16: 2.702,
|
|
17: 2.702,
|
|
18: 2.702,
|
|
19: 2.702,
|
|
20: 2.702,
|
|
21: 2.700649,
|
|
22: 2.6992979999999998
|
|
}
|
|
|
|
|
|
colors_both = {
|
|
6: 3.2133440611047375,
|
|
7: 3.2133806668053135,
|
|
8: 3.2133806668053135,
|
|
9: 3.2133806668053135,
|
|
10: 3.2133806668053135,
|
|
11: 3.2133806668053135,
|
|
12: 3.201342229977879,
|
|
13: 3.189306875960779,
|
|
|
|
15: 2.702,
|
|
16: 2.702,
|
|
17: 2.702,
|
|
18: 2.702,
|
|
19: 2.702,
|
|
20: 2.702,
|
|
21: 2.700649,
|
|
22: 2.6992979999999998
|
|
}
|
|
|
|
|
|
#colors_reset = colors_both
|
|
#phases_reset = {
|
|
# 6: 6.271830001886656,
|
|
# 7: 4.2,
|
|
# 8: 11.700000000000001,
|
|
# 9: 4.2,
|
|
# 10: 333.76497589650967,
|
|
# 11: 5.9,
|
|
# 12: 5.800000000000001,
|
|
|
|
# 13: 303.1292805364285,
|
|
# 15: 26.939664715067693,
|
|
# 16: 131.94293079970862,
|
|
# 17: 276.5058000202555,
|
|
# 18: 287.6856327168946,
|
|
# 19: 207.38583858800666,
|
|
# 20: 128.34546121694189,
|
|
# 21: 61.3287322695885
|
|
#}
|
|
|
|
|
|
|
|
def put_color(cols):
|
|
for n, k in cols.items():
|
|
pv = KSET_FMT.format(n)
|
|
caput(pv, k)
|
|
# press the go buttons ...
|
|
for n in cols:
|
|
pv = RADIALGO_FMT.format(n)
|
|
caput(pv, 1)
|
|
print("color done")
|
|
|
|
#def put_phases(phs):
|
|
# for n, k in phs.items():
|
|
# pv = PHASESET_FMT.format(n)
|
|
# caput(pv, k)
|
|
# print("phases done")
|
|
|
|
|
|
|
|
@as_shortcut
|
|
def enable_color1():
|
|
put_color(color1)
|
|
|
|
@as_shortcut
|
|
def enable_color2():
|
|
put_color(color2)
|
|
|
|
@as_shortcut
|
|
def enable_colors_both():
|
|
put_color(colors_both)
|
|
|
|
#@as_shortcut
|
|
#def reset_undulators():
|
|
# put_color(colors_reset)
|
|
# sleep(2)
|
|
# put_phases(phases_reset)
|
|
|
|
|
|
|
|
|
|
|