From 16ba1f8829509285d368faa7af255b3785d6275c Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Thu, 2 Dec 2021 13:33:37 +0100 Subject: [PATCH] 2 colors toggles for N2O repeat, also press the radial Go button in the toggles; commented code for phases reset --- colors.py | 148 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 99 insertions(+), 49 deletions(-) diff --git a/colors.py b/colors.py index 7509499..4dc3a51 100644 --- a/colors.py +++ b/colors.py @@ -1,82 +1,127 @@ +from time import sleep from epics import caget, caput from slic.utils import as_shortcut -KSET_FMT = "SATUN{:02}-UIND030:K_SET" +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: 2.22, - 7: 3.22, - 8: 3.22, - 9: 3.22, - 10: 3.22, - 11: 3.2150000000000003, - 12: 3.21, - 13: 3.205, - 15: 2.40762, - 16: 2.74837, - 17: 2.91624, - 18: 3.42306, - 19: 2.53846, - 20: 2.76525, - 21: 2.65308, - 22: 2.18091 + 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: 2.26391, - 7: 3.72, - 8: 2.96096, - 9: 3.44431, - 10: 3.4889, - 11: 3.13665, - 12: 3.27923, - 13: 2.83135, - 15: 2.7198458495604054, - 16: 2.7198458495604054, - 17: 2.7198, - 18: 2.7198458495604054, - 19: 2.7198458495604054, - 20: 2.7144, - 21: 2.708949212510313, - 22: 2.7035008678547685 + 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: 2.22, - 7: 3.22, - 8: 3.22, - 9: 3.22, - 10: 3.22, - 11: 3.2150000000000003, - 12: 3.21, - 13: 3.205, - 15: 2.7198458495604054, - 16: 2.7198458495604054, - 17: 2.7198, - 18: 2.7198458495604054, - 19: 2.7198458495604054, - 20: 2.7144, - 21: 2.708949212510313, - 22: 2.7035008678547685 + 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 @@ -91,6 +136,11 @@ def enable_color2(): def enable_colors_both(): put_color(colors_both) +#@as_shortcut +#def reset_undulators(): +# put_color(colors_reset) +# sleep(2) +# put_phases(phases_reset)