diff --git a/phases/full_polarization.py b/phases/full_polarization.py index 9a0feae..c90c12b 100644 --- a/phases/full_polarization.py +++ b/phases/full_polarization.py @@ -50,8 +50,9 @@ class UndPhases(Adjustable): def set_target_value(self, value): tasks = [p.set_target_value(value) for p in self.phases] - for t in tasks: + for t, p in zip(tasks, self.phases): t.wait() + print("done:", p.name) def is_moving(self): @@ -91,6 +92,9 @@ class UndPhase(Adjustable): radial = antiparallel2gap(k, phase, self.params) radial = round(radial, 4) #TODO: why? + # workaround for safety measure + if self.radial.get_current_value() <= 5.1: + self.radial.set_target_value(5.1).wait() self.shift.set_target_value(shift).wait() self.radial.set_target_value(radial).wait() @@ -116,10 +120,12 @@ class UndShiftRadialBase(PVAdjustable): #TODO: better name? lambda: f(value) ) t.start() - sleep(0.3) - self.pv_on.put(1) - sleep(0.3) - self.pv_go.put(1) + for i in range(2): #TODO: replace by active wait + sleep(i * 10) + sleep(0.3) + self.pv_on.put(1) + sleep(0.3) + self.pv_go.put(1) t.wait() @@ -175,10 +181,12 @@ class UndShiftQuadrants(Adjustable): vals = (value, -value, 0, 0) tasks = [self.adjs.__dict__[n].set_target_value(v) for n, v in zip(names, vals)] - sleep(0.3) - self.pv_on.put(1) - sleep(0.3) - self.pv_go.put(1) + for i in range(2): #TODO: replace by active wait + sleep(i * 10) + sleep(0.3) + self.pv_on.put(1) + sleep(0.3) + self.pv_go.put(1) for t in tasks: t.wait() @@ -221,7 +229,7 @@ if __name__ == "__main__": print(dirname(__file__)) basedir = dirname(__file__) #phase = 123 - phase = 90 + phase = 80 check_phase(phase) und_first = 10 und_last = 22 @@ -260,7 +268,8 @@ if __name__ == "__main__": ups = UndPhases("SATUN-PHASES", params, isparallel=False) sleep(0.3) print(ups.phases[0], ups.phases[0].shift) - ups.phases[0].set_target_value(phase).wait() +# ups.phases[0].set_target_value(phase).wait() + ups.set_target_value(phase).wait() print(ups.phases[0], ups.phases[0].shift)