added units
This commit is contained in:
@ -42,8 +42,8 @@ class UndPhases(Adjustable):
|
|||||||
allows to set the same phase to all undulators
|
allows to set the same phase to all undulators
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ID, params, isparallel=True, und_names=None, **kwargs):
|
def __init__(self, ID, params, isparallel=True, und_names=None, units="°", **kwargs):
|
||||||
super().__init__(ID, **kwargs)
|
super().__init__(ID, units=units, **kwargs)
|
||||||
self.params = params
|
self.params = params
|
||||||
|
|
||||||
if und_names is None:
|
if und_names is None:
|
||||||
@ -83,8 +83,8 @@ class UndPhase(Adjustable):
|
|||||||
allows to set the phase of one undulator
|
allows to set the phase of one undulator
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ID, params, isparallel, **kwargs):
|
def __init__(self, ID, params, isparallel, units="°", **kwargs):
|
||||||
super().__init__(ID, **kwargs)
|
super().__init__(ID, **kwargs, units=units)
|
||||||
self.params = params
|
self.params = params
|
||||||
self.isparallel = isparallel
|
self.isparallel = isparallel
|
||||||
self.shift = UndShift(ID) if isparallel else UndShiftQuadrants(ID)
|
self.shift = UndShift(ID) if isparallel else UndShiftQuadrants(ID)
|
||||||
@ -168,7 +168,7 @@ class UndShiftQuadrants(Adjustable):
|
|||||||
def __init__(self, ID, accuracy=0.001):
|
def __init__(self, ID, accuracy=0.001):
|
||||||
ID += "SHIFT"
|
ID += "SHIFT"
|
||||||
|
|
||||||
super().__init__(ID, units="xxx")
|
super().__init__(ID, units=None)
|
||||||
|
|
||||||
self.opposites = opposites = {
|
self.opposites = opposites = {
|
||||||
"TL": "BR",
|
"TL": "BR",
|
||||||
@ -190,6 +190,18 @@ class UndShiftQuadrants(Adjustable):
|
|||||||
self.pv_go = PV(ID + "-GO")
|
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):
|
def set_target_value(self, value):
|
||||||
which = "TL" if value >= 0 else "BL"
|
which = "TL" if value >= 0 else "BL"
|
||||||
opposite = self.opposites[which]
|
opposite = self.opposites[which]
|
||||||
|
Reference in New Issue
Block a user