Commit f0a81fd5 authored by augustin_s's avatar augustin_s 🐍
Browse files

added warning if Ks are not all close to each other

parent ead72320
......@@ -147,6 +147,15 @@ class Undulators(Adjustable):
a = self.adjs[und_name_cal]
k = a.get_current_value()
energy = self.K_to_eV(k)
all_ks = [a.get_current_value() for a in self.adjs.values()]
checks = np.isclose(all_ks, k, rtol=0, atol=0.001)
if not all(checks):
print("Warning: Ks are not all close:")
for name, k, chk in zip(self.adjs.keys(), all_ks, checks):
if not chk:
print(name, k)
return float(energy) * 1000 # keV -> eV
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment