Commit df3718f1 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Tango: add apply_corrections property and attribute (RO)

parent a86b77fa
......@@ -1674,6 +1674,8 @@ Add LimaCCDs and SlsDetector class devices.
| id10/slsdetector/eiger500k->config_fname | /users/opid00/eiger/eiger_v3.1.1/config/ |
| | beb-021-020-direct-FO-10g.config |
+----------------------------------------------------------+------------------------------------------------------+
| id10/slsdetector/eiger500k->apply_corrections | 0 |
+----------------------------------------------------------+------------------------------------------------------+
| id10/slsdetector/eiger500k->pixel_depth_cpu_affinity_map | | { 4: ((((CPU( 6), CPU( 7)), (CPU(18), CPU(19))), |
| | | ((CPU( 9), CPU(10)), (CPU(21), CPU(22)))), |
| | | CPU(*chain(range(1, 6), range(12, 18))), |
......
......@@ -13,6 +13,7 @@ Properties
Property name Mandatory Default value Description
=============================== =============== =============== ==============================================================
config_fname Yes - Path to the SlsDetector config file
apply_corrections No True Perform corrections on each frame
high_voltage No 0 Initial detector high voltage (V)
(set to 150 if already tested)
fixed_clock_div No 0 Initial detector fixed-clock-div
......@@ -42,6 +43,7 @@ Attribute name RW Type Description
=============================== ======= ======================= ===========================================================
config_fname ro DevString Path to the SlsDetector config file
hostname_list ro DevVarStringArray The list of the Eiger half-modules' hostnames
apply_corrections ro DevBoolean Pixel software corrections are applied on each frame
dac_name_list ro DevVarStringArray The list of the DAC signals' names
dac_<signal_name> rw DevVarLongArray Array with the DAC <signal_name> value for each half-module, in A/D units
dac_name_list_mv ro DevVarStringArray The list of the DAC signals' names supporting milli-volt units
......
......@@ -221,6 +221,11 @@ class SlsDetector(PyTango.Device_4Impl):
deb.Return("config_fname=%s" % self.config_fname)
attr.set_value(self.config_fname)
@Core.DEB_MEMBER_FUNCT
def read_apply_corrections(self, attr):
deb.Return("apply_corrections=%s" % self.apply_corrections)
attr.set_value(self.apply_corrections)
@Core.DEB_MEMBER_FUNCT
def putCmd(self, cmd):
deb.Param("cmd=%s" % cmd)
......@@ -530,6 +535,9 @@ class SlsDetectorClass(PyTango.DeviceClass):
'tolerate_lost_packets':
[PyTango.DevBoolean,
"Initial tolerance to lost packets", True],
'apply_corrections':
[PyTango.DevBoolean,
"Apply frame corrections", True],
'pixel_depth_cpu_affinity_map':
[PyTango.DevVarStringArray,
"Default PixelDepthCPUAffinityMap as Python string(s) defining a dict: "
......@@ -579,6 +587,10 @@ class SlsDetectorClass(PyTango.DeviceClass):
[[PyTango.DevString,
PyTango.SPECTRUM,
PyTango.READ, 64]],
'apply_corrections':
[[PyTango.DevBoolean,
PyTango.SCALAR,
PyTango.READ]],
'dac_name_list':
[[PyTango.DevString,
PyTango.SPECTRUM,
......@@ -659,11 +671,28 @@ _SlsDetectorEiger = None
_SlsDetectorCorrection = None
_SlsDetectorControl = None
def get_control(config_fname, **keys) :
def get_control(config_fname, full_config_fname=None, apply_corrections=None,
**keys) :
global _SlsDetectorCam, _SlsDetectorHwInter, _SlsDetectorEiger
global _SlsDetectorCorrection, _SlsDetectorControl
def to_bool(x, default_val=False):
if x is None:
return default_val
elif type(x) is str:
x = x.lower()
if x == 'true':
return True
elif x == 'false':
return False
else:
return bool(int(x))
else:
return bool(x)
apply_corrections = to_bool(apply_corrections, True)
if _SlsDetectorControl is None:
full_config_fname = keys.pop('full_config_fname', None)
if full_config_fname:
p = Process(target=setup_partial_config,
args=(config_fname, full_config_fname))
......@@ -679,7 +708,8 @@ def get_control(config_fname, **keys) :
_SlsDetectorHwInter = SlsDetectorHw.Interface(_SlsDetectorCam)
if _SlsDetectorCam.getType() == SlsDetectorHw.EigerDet:
_SlsDetectorEiger = SlsDetectorHw.Eiger(_SlsDetectorCam)
_SlsDetectorCorrection = _SlsDetectorEiger.createCorrectionTask()
if apply_corrections:
_SlsDetectorCorrection = _SlsDetectorEiger.createCorrectionTask()
else:
raise ValueError("Unknown detector type: %s" %
_SlsDetectorCam.getType())
......
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