Commit 026d5cb7 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by Samuel Debionne
Browse files

[CLIENT] Add flexible counter names in Detector.Processing

parent 0b8018d5
...@@ -628,6 +628,8 @@ class Detector: ...@@ -628,6 +628,8 @@ class Detector:
self.__has_roi_counters = False self.__has_roi_counters = False
self.__uuid = uuid self.__uuid = uuid
self.__devs = [ tango.DeviceProxy(instance) for instance in instances] self.__devs = [ tango.DeviceProxy(instance) for instance in instances]
self.__names = [n for n in json.loads(self.__devs[0].counters).keys()
if n.startswith('nb_frames_')]
for d in self.__devs: for d in self.__devs:
d.set_green_mode(tango.GreenMode.Gevent) d.set_green_mode(tango.GreenMode.Gevent)
d.set_timeout_millis(int(Detector.DefaultTimeout * 1000)) d.set_timeout_millis(int(Detector.DefaultTimeout * 1000))
...@@ -639,7 +641,7 @@ class Detector: ...@@ -639,7 +641,7 @@ class Detector:
@property @property
def counters(self): def counters(self):
"""" Returns the progress counters """ """" Returns the progress counters """
Counter = namedtuple('Counter', ['nb_frames_source', 'nb_frames_reconstructed', 'nb_frames_counters', 'nb_frames_sparsified', 'nb_frames_dense_saved', 'nb_frames_sparse_saved']) Counter = namedtuple('Counter', self.__names)
return [ Counter(**json.loads(dev.counters)) for dev in self.__devs ] return [ Counter(**json.loads(dev.counters)) for dev in self.__devs ]
def popRoiCounters(self, nb_frames): def popRoiCounters(self, nb_frames):
...@@ -672,7 +674,11 @@ class Detector: ...@@ -672,7 +674,11 @@ class Detector:
# Finished when all counters are equal to nb_frames # Finished when all counters are equal to nb_frames
def countersFinished(c): def countersFinished(c):
return not self.__has_roi_counters or c.nb_frames_counters == nb_frames return not self.__has_roi_counters or c.nb_frames_counters == nb_frames
return all([ countersFinished(c) and c.nb_frames_sparse_saved == nb_frames for c in self.counters ]) def savingFinished(c):
not_finished = [n for n in self.__names
if n.endswith('saved') and getattr(c, n) != nb_frames]
return not not_finished
return all([ countersFinished(c) and savingFinished(c) for c in self.counters ])
def _eraseProcessing(self, uuid): def _eraseProcessing(self, uuid):
[ recv.erasePipeline(str(uuid)) for recv in self.__recvs ] [ recv.erasePipeline(str(uuid)) for recv in self.__recvs ]
......
Supports Markdown
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