added switch for enabling/disabling CHIC adjustment

This commit is contained in:
2021-08-27 16:52:06 +02:00
parent dddb64a1d7
commit 2b8de02e58

View File

@ -15,7 +15,7 @@ N_UND_CHIC = 14
class Undulators(Adjustable):
def __init__(self, n_unds, n_und_ref, chic_fudge_offset=0, scaled=True, ID="ATHOS_UNDULATORS", name="Athos Undulators", units="eV"):
def __init__(self, n_unds, n_und_ref, chic_fudge_offset=0, adjust_chic=True, scaled=True, ID="ATHOS_UNDULATORS", name="Athos Undulators", units="eV"):
super().__init__(ID, name=name, units=units)
self.n_unds = n_unds = list(n_unds)
@ -34,6 +34,7 @@ class Undulators(Adjustable):
self.adjs = {name: Undulator(name) for name in und_names}
self.chic = CHIC(chic_fudge_offset, name, units)
self.adjust_chic = adjust_chic
self.scaled = scaled
self.convert = ConverterEK()
@ -73,6 +74,7 @@ class Undulators(Adjustable):
t = a.set_target_value(k_new, hold=False)
tasks.append(t)
wait_for_all(tasks)
if self.adjust_chic:
print("CHIC adjustment follows")
self.chic.set_target_value(value, hold=False).wait() #TODO: test whether an additional sleep is needed
print("CHIC adjustment done")