added undulator no. 6; added a missing self; commented warning print; adjusted accuracy

This commit is contained in:
2021-06-22 13:39:39 +02:00
parent cc625b35f9
commit 67a8ac8ff4

View File

@ -9,7 +9,7 @@ from slic.core.scanner.scanbackend import wait_for_all #, stop_all
# 14 is the CHIC
n_unds = [
7, 8, 9, 10, 11, 12, 13,
6, 7, 8, 9, 10, 11, 12, 13,
15, 16, 17, 18, 19, 20, 21, 22
]
@ -21,7 +21,7 @@ und_name_cal = "SATUN12-UIND030"
class Undulators(Adjustable):
def __init__(self, scaled=True):
super().__init__(name="Athos Undulators", units="eV")
super().__init__(name="z Athos Undulators", units="eV")
self.adjs = {name: Undulator(name) for name in und_names}
self.scaled = scaled
@ -41,7 +41,7 @@ class Undulators(Adjustable):
ks_current = [a.get_current_value(readback=False) for a in self.adjs.values()]
if scaled:
if self.scaled:
header = "scaled: "
ks_target = self.scale.K(value, ks_current)
else:
@ -74,11 +74,11 @@ class Undulators(Adjustable):
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(f"Warning: Ks are not all close to {k}:")
for name, k, chk in zip(self.adjs.keys(), all_ks, checks):
if not chk:
print(name, k)
# if not all(checks):
# print(f"Warning: Ks are not all close to {k}:")
# for name, k, chk in zip(self.adjs.keys(), all_ks, checks):
# if not chk:
# print(name, k)
return energy
@ -90,7 +90,7 @@ class Undulators(Adjustable):
class Undulator(PVAdjustable):
def __init__(self, name, accuracy=0.00001):
def __init__(self, name, accuracy=0.0001):
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)