diff --git a/phases/full_polarization.py b/phases/full_polarization.py index 98b89fb..45b2926 100644 --- a/phases/full_polarization.py +++ b/phases/full_polarization.py @@ -42,8 +42,8 @@ class UndPhases(Adjustable): allows to set the same phase to all undulators """ - def __init__(self, ID, params, isparallel=True, und_names=None, **kwargs): - super().__init__(ID, **kwargs) + def __init__(self, ID, params, isparallel=True, und_names=None, units="°", **kwargs): + super().__init__(ID, units=units, **kwargs) self.params = params if und_names is None: @@ -83,8 +83,8 @@ class UndPhase(Adjustable): allows to set the phase of one undulator """ - def __init__(self, ID, params, isparallel, **kwargs): - super().__init__(ID, **kwargs) + def __init__(self, ID, params, isparallel, units="°", **kwargs): + super().__init__(ID, **kwargs, units=units) self.params = params self.isparallel = isparallel self.shift = UndShift(ID) if isparallel else UndShiftQuadrants(ID) @@ -168,7 +168,7 @@ class UndShiftQuadrants(Adjustable): def __init__(self, ID, accuracy=0.001): ID += "SHIFT" - super().__init__(ID, units="xxx") + super().__init__(ID, units=None) self.opposites = opposites = { "TL": "BR", @@ -190,6 +190,18 @@ class UndShiftQuadrants(Adjustable): self.pv_go = PV(ID + "-GO") + @property + def units(self): + units = self._units + if units is not None: + return units + return self.adjs["TL"].units + + @units.setter + def units(self, value): + self._units = value + + def set_target_value(self, value): which = "TL" if value >= 0 else "BL" opposite = self.opposites[which]