added warning if Ks are not all close to each other

This commit is contained in:
2021-01-30 16:24:08 +01:00
parent ead72320f6
commit f0a81fd5b9

View File

@ -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