From dbd0d7cfe423a94dde5d4fe2fbab0d7a61ee6ca6 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Tue, 8 Nov 2022 20:31:59 +0100 Subject: [PATCH] print name of undulator if it arrives; changed the undulator K accuracy --- devices/undulator.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/devices/undulator.py b/devices/undulator.py index 7f795ad..8f50d48 100644 --- a/devices/undulator.py +++ b/devices/undulator.py @@ -88,7 +88,7 @@ class Undulators(Adjustable): def change(): #TODO: replace by set_all_target_values_and_wait when print not needed anymore - tasks = [] + tasks = {} for (name, a), k_old, k_new in zip(self.adjs.items(), ks_current, ks_target): delta = k_old - k_new print(f"{name}: {k_old}\t->\t{k_new}\t({delta})") @@ -96,8 +96,14 @@ class Undulators(Adjustable): print(f"{name} skipped since target K is nan") continue t = a.set_target_value(k_new, hold=False) - tasks.append(t) - wait_for_all(tasks) + tasks[name] = t +# wait_for_all(tasks) + for n, t in tasks.items(): + print("waiting for ", n) + t.wait() + print("target reached ", n) + + print("starting radial motors") # make sure new K values have been written TODO: needed? sleep(2) # check if this can be shortened back to 0.5 @@ -156,7 +162,7 @@ class Undulators(Adjustable): class Undulator(PVAdjustable): - def __init__(self, name, accuracy=0.0005): + def __init__(self, name, accuracy=0.1): pvname_setvalue = name + ":K_SET" pvname_readback = name + ":K_READ" super().__init__(pvname_setvalue, pvname_readback=pvname_readback, accuracy=accuracy, active_move=True, name=name, internal=True)