diff --git a/slic/devices/endstations/alvra_prime.py b/slic/devices/endstations/alvra_prime.py index 6eaef1aab..30a96a94d 100644 --- a/slic/devices/endstations/alvra_prime.py +++ b/slic/devices/endstations/alvra_prime.py @@ -1,6 +1,7 @@ import sys sys.path.append("..") from ..general.motors import MotorRecord +from ..general.smaract import SmarActRecord from epics import PV class Huber: @@ -63,15 +64,17 @@ class Table: % (self.x,self.y,self.z,self.pitch,self.yaw,self.modeSP.get(as_string=True),self.status.get()) class Microscope: - def __init__(self, Id, alias_namespace=None, z_undulator=None, description=None): + def __init__(self, Id, gonio=None, rotat=None, alias_namespace=None, z_undulator=None, description=None): self.Id = Id - + ### Microscope motors ### self.focus = MotorRecord(Id+':FOCUS') self.zoom = MotorRecord(Id+':ZOOM') - self._smaractaxes = { - 'gonio': '_xmic_gon', # will become self.gonio - 'rot': '_xmic_rot'} # """ self.rot +# self._smaractaxes = { +# 'gonio': '_xmic_gon', # will become self.gonio +# 'rot': '_xmic_rot'} # """ self.rot + self.gonio = SmarActRecord(gonio) #TODO: can this be None? + self.rot = SmarActRecord(rotat) #TODO: can this be None? def __str__(self): return "Microscope positions\nfocus: %s\nzoom: %s\ngonio: %s\nrot: %s"\ diff --git a/slic/devices/general/smaract.py b/slic/devices/general/smaract.py index 70af8cdd0..31f43a6f3 100644 --- a/slic/devices/general/smaract.py +++ b/slic/devices/general/smaract.py @@ -182,6 +182,8 @@ class SmarActRecord: def get_current_value(self): return self._rbv.get() + wm = get_current_value + # def set_current_value(self,value): # return self._drive.put(value) @@ -278,7 +280,9 @@ class SmarActStage: def __init__(self, axes, name=None, z_undulator=None, description=None): self._keys = axes.keys() for axis in self._keys: - self.__dict__[axis] = axes[axis] + ax = axes[axis] + ax = SmarActRecord(ax) + self.__dict__[axis] = ax self.name = name def __str__(self): diff --git a/slic/devices/loptics/alvra_experiment.py b/slic/devices/loptics/alvra_experiment.py index 0c4f7b829..fabe44855 100755 --- a/slic/devices/loptics/alvra_experiment.py +++ b/slic/devices/loptics/alvra_experiment.py @@ -122,17 +122,23 @@ class Laser_Exp: def get_adjustable_positions_str(self): - ostr = '*****Laser motor positions*****\n' + ostr = 'Laser motor positions\n' - for tkey,item in self.__dict__.items(): + res = {} + for key, item in self.__dict__.items(): if hasattr(item,'get_current_value'): pos = item.get_current_value() - ostr += ' ' + tkey.ljust(10) + ' : % 14g\n'%pos elif hasattr(item,'get'): - pos = item.get() - ostr += ' ' + tkey.ljust(10) + ' : % 14g\n'%pos + pos = item.get() + else: + continue + res[key] = pos + + length = max(len(k) for k in res) + 1 + lines = sorted("{}:{}{}".format(k, " "*(length-len(k)), v) for k, v in res.items()) + ostr += "\n".join(lines) return ostr - + #def pos(self): diff --git a/slic/devices/xoptics/attenuator_aramis.py b/slic/devices/xoptics/attenuator_aramis.py index 4289663ff..98161adb7 100755 --- a/slic/devices/xoptics/attenuator_aramis.py +++ b/slic/devices/xoptics/attenuator_aramis.py @@ -8,13 +8,6 @@ class AttenuatorAramis: self._pv_status_int = PV(self.Id+':IDX_RB') pass - - def __call__(self): - pass - def __str__(self): - pass - def __status__(self): - pass def updateE(self,energy = None): if energy == None: energy = PV("SARUN03-UIND030:FELPHOTENE").value @@ -57,9 +50,10 @@ class AttenuatorAramis: s += '%s'%self.get_status()[0] return s + __str__ = __repr__ + def __call__(self,*args,**kwargs): self.set_transmission(*args,**kwargs) -