Commit 926dbf35 authored by Matias Guijarro's avatar Matias Guijarro Committed by Sebastien Petitdemange
Browse files

scanning/acquisition/counter.py: fixed bug with SIMPLE_AVERAGE / TIME_AVERAGE

parent fab1bc26
...@@ -117,10 +117,11 @@ class SamplingCounterAcquisitionDevice(AcquisitionDevice): ...@@ -117,10 +117,11 @@ class SamplingCounterAcquisitionDevice(AcquisitionDevice):
end_read = time.time() end_read = time.time()
read_time = end_read - start_read read_time = end_read - start_read
if self.__mode != SamplingCounterAcquisitionDevice.TIME_AVERAGE: if self.__mode == SamplingCounterAcquisitionDevice.TIME_AVERAGE:
acc_value += read_value
else:
acc_value += read_value * (end_read - start_read) acc_value += read_value * (end_read - start_read)
else:
acc_value += read_value
nb_read += 1 nb_read += 1
acc_read_time += end_read - start_read acc_read_time += end_read - start_read
...@@ -130,9 +131,9 @@ class SamplingCounterAcquisitionDevice(AcquisitionDevice): ...@@ -130,9 +131,9 @@ class SamplingCounterAcquisitionDevice(AcquisitionDevice):
gevent.sleep(0) # Be able to kill the task gevent.sleep(0) # Be able to kill the task
self._nb_acq_points += 1 self._nb_acq_points += 1
if self.__mode == SamplingCounterAcquisitionDevice.TIME_AVERAGE: if self.__mode == SamplingCounterAcquisitionDevice.TIME_AVERAGE:
data = acc_value / nb_read
else:
data = acc_value / acc_read_time data = acc_value / acc_read_time
else:
data = acc_value / nb_read
if self.__mode == SamplingCounterAcquisitionDevice.INTEGRATE: if self.__mode == SamplingCounterAcquisitionDevice.INTEGRATE:
data *= self.count_time data *= self.count_time
......
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