Commit f05131a9 authored by Laurent Claustre's avatar Laurent Claustre

Merge branch 'slsdetector-v3' into 'master'

SlsDetector v3

See merge request !15
parents 6e424d4c 35225f8a
......@@ -49,7 +49,7 @@ from Lima import Core
from Lima import SlsDetector as SlsDetectorHw
from Lima.Server.AttrHelper import get_attr_4u, get_attr_string_value_list
def ConstListAttr(nl, vl=None, Defs=SlsDetectorHw.Defs):
def ConstListAttr(nl, vl=None, namespc=SlsDetectorHw.Defs):
def g(x):
n = ''
was_cap = True
......@@ -61,7 +61,7 @@ def ConstListAttr(nl, vl=None, Defs=SlsDetectorHw.Defs):
return n
if vl is None:
vl = [getattr(Defs, n) for n in nl]
vl = [getattr(namespc, n) for n in nl]
return OrderedDict([(g(n), v) for n, v in zip(nl, vl)])
......@@ -76,6 +76,9 @@ class SlsDetector(PyTango.Device_4Impl):
MilliVoltSuffix = '_mv'
ModelAttrs = ['parallel_mode', 'clock_div', 'high_voltage',
'threshold_energy']
def __init__(self,*args) :
PyTango.Device_4Impl.__init__(self,*args)
self.init_device()
......@@ -116,8 +119,8 @@ class SlsDetector(PyTango.Device_4Impl):
nl = ['FullSpeed', 'HalfSpeed', 'QuarterSpeed', 'SuperSlowSpeed']
self.__ClockDiv = ConstListAttr(nl)
vl, nl = self.cam.getValidReadoutFlags()
self.__ReadoutFlags = ConstListAttr(nl, vl)
nl = ['Parallel', 'NonParallel', 'Safe']
self.__ParallelMode = ConstListAttr(nl, namespc=SlsDetectorHw.Eiger)
nl = ['PixelDepth4', 'PixelDepth8', 'PixelDepth16', 'PixelDepth32']
bdl = map(lambda x: getattr(SlsDetectorHw, x), nl)
......@@ -173,7 +176,11 @@ class SlsDetector(PyTango.Device_4Impl):
if stats_tok[1] in ['do_hist']:
stats_name = '_'.join(stats_tok)
return get_attr_4u(self, stats_name, SlsDetectorHw.SimpleStat)
return get_attr_4u(self, name, self.cam)
obj = self.cam
for attr in self.ModelAttrs:
if attr in name:
obj = self.model
return get_attr_4u(self, name, obj)
@Core.DEB_MEMBER_FUNCT
def read_config_fname(self, attr):
......@@ -232,14 +239,14 @@ class SlsDetector(PyTango.Device_4Impl):
@Core.DEB_MEMBER_FUNCT
def read_all_trim_bits(self, attr):
val_list = self.cam.getAllTrimBitsList()
val_list = self.model.getAllTrimBitsList()
deb.Return("val_list=%s" % val_list)
attr.set_value(val_list)
@Core.DEB_MEMBER_FUNCT
def write_all_trim_bits(self, attr):
for i, val in self.get_write_mod_idx_val_list(attr):
self.cam.setAllTrimBits(i, val)
self.model.setAllTrimBits(i, val)
@Core.DEB_MEMBER_FUNCT
def get_write_mod_idx_val_list(self, attr):
......@@ -480,11 +487,15 @@ class SlsDetectorClass(PyTango.DeviceClass):
[[PyTango.DevLong,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 64]],
'high_voltage':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'clock_div':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'readout_flags':
'parallel_mode':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment