RoiCounters DevFailed behaviour
I am trying to find the cause of #2655 (closed) and it seems to be a mixture of several things. One of these things is a DevFailed
exception from readCounters
(proxy None). We capture the DevFailed
but cause another error downstream (TypeError) because we returns 0D arrays.
class RoiCounters(IntegratingCounterController):
def get_values(self, from_index, *counters):
roi_counter_size = len(RoiStat)
try:
raw_data = self._proxy.readCounters(from_index)
except DevFailed:
return [numpy.array(-1)] * len(counters)
...
class IntegratingCounterAcquisitionSlave(BaseCounterAcquisitionSlave):
def reading(self):
from_index = 0
while (
not self.npoints or self._nb_acq_points < self.npoints
) and not self._stop_flag:
counters = list(self._counters.keys())
data = [
counters[i].conversion_function(x)
for i, x in enumerate(self.device.get_values(from_index, *counters))
]
# >>>> THE FOLLOWING LINE RAISES A TYPE ERROR
if not all_equal([len(d) for d in data]):
raise RuntimeError("Read data can't have different sizes")
@matias.guijarro @pguillou @claustre Hiding lima problems like this makes for difficult debugging. At least do a log_exception
here and return [numpy.array([-1])] * len(counters)
.
Edit: I personally wouldn't capture DevFailed at all.