Commit 10cd9102 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

counters: removed not needed flag

parent f21ca1ea
...@@ -132,7 +132,7 @@ def _counters_tree(counters, scan_pars): ...@@ -132,7 +132,7 @@ def _counters_tree(counters, scan_pars):
for reader, counters in reader_counters.iteritems(): for reader, counters in reader_counters.iteritems():
if isinstance(reader, (SamplingCounter.GroupedReadHandler, SamplingCounter)): if isinstance(reader, (SamplingCounter.GroupedReadHandler, SamplingCounter)):
acq_device = SamplingCounterAcquisitionDevice(reader, auto_add_channel=len(counters)==0, **scan_pars) acq_device = SamplingCounterAcquisitionDevice(reader, **scan_pars)
for cnt in counters: for cnt in counters:
acq_device.add_counter(cnt) acq_device.add_counter(cnt)
tree.setdefault(None, list()).append(acq_device) tree.setdefault(None, list()).append(acq_device)
...@@ -150,7 +150,7 @@ def _counters_tree(counters, scan_pars): ...@@ -150,7 +150,7 @@ def _counters_tree(counters, scan_pars):
master_acq_device, _ = default_master_configuration(cnt, tmp_scan_pars) master_acq_device, _ = default_master_configuration(cnt, tmp_scan_pars)
master_integrating_counter[cnt.acquisition_controller] = master_acq_device master_integrating_counter[cnt.acquisition_controller] = master_acq_device
if isinstance(reader, IntegratingCounter.GroupedReadHandler): if isinstance(reader, IntegratingCounter.GroupedReadHandler):
acq_device = IntegratingCounterAcquisitionDevice(reader, auto_add_channel=len(counters)==0, **scan_pars) acq_device = IntegratingCounterAcquisitionDevice(reader, **scan_pars)
for cnt in counters: for cnt in counters:
acq_device.add_counter(cnt) acq_device.add_counter(cnt)
tree.setdefault(master_acq_device, list()).append(acq_device) tree.setdefault(master_acq_device, list()).append(acq_device)
......
...@@ -15,7 +15,7 @@ from bliss.common.measurement import GroupedReadMixin ...@@ -15,7 +15,7 @@ from bliss.common.measurement import GroupedReadMixin
from bliss.common.utils import all_equal from bliss.common.utils import all_equal
class BaseCounterAcquisitionDevice(AcquisitionDevice): class BaseCounterAcquisitionDevice(AcquisitionDevice):
def __init__(self, counter, count_time, auto_add_channel, **keys): def __init__(self, counter, count_time, **keys):
npoints = max(1, keys.pop('npoints', 1)) npoints = max(1, keys.pop('npoints', 1))
prepare_once = keys.pop('prepare_once', npoints > 1) prepare_once = keys.pop('prepare_once', npoints > 1)
start_once = keys.pop('start_once', npoints > 1) start_once = keys.pop('start_once', npoints > 1)
...@@ -31,7 +31,7 @@ class BaseCounterAcquisitionDevice(AcquisitionDevice): ...@@ -31,7 +31,7 @@ class BaseCounterAcquisitionDevice(AcquisitionDevice):
self.__counter_names = list() self.__counter_names = list()
self._nb_acq_points = 0 self._nb_acq_points = 0
if auto_add_channel: if not isinstance(counter, GroupedReadMixin):
self.channels.append(AcquisitionChannel(counter.name, numpy.double, (1,))) self.channels.append(AcquisitionChannel(counter.name, numpy.double, (1,)))
self.__counter_names.append(counter.name) self.__counter_names.append(counter.name)
...@@ -63,7 +63,7 @@ class BaseCounterAcquisitionDevice(AcquisitionDevice): ...@@ -63,7 +63,7 @@ class BaseCounterAcquisitionDevice(AcquisitionDevice):
class SamplingCounterAcquisitionDevice(BaseCounterAcquisitionDevice): class SamplingCounterAcquisitionDevice(BaseCounterAcquisitionDevice):
SIMPLE_AVERAGE,TIME_AVERAGE,INTEGRATE = range(3) SIMPLE_AVERAGE,TIME_AVERAGE,INTEGRATE = range(3)
def __init__(self, counter, count_time=None, mode=SIMPLE_AVERAGE, auto_add_channel=True, **keys): def __init__(self, counter, count_time=None, mode=SIMPLE_AVERAGE, **keys):
""" """
Helper to manage acquisition of a sampling counter. Helper to manage acquisition of a sampling counter.
...@@ -73,13 +73,12 @@ class SamplingCounterAcquisitionDevice(BaseCounterAcquisitionDevice): ...@@ -73,13 +73,12 @@ class SamplingCounterAcquisitionDevice(BaseCounterAcquisitionDevice):
the *TIME_AVERAGE* which sum all integration then divide by the sum the *TIME_AVERAGE* which sum all integration then divide by the sum
of time spend to measure all values. And *INTEGRATION* which sum all integration of time spend to measure all values. And *INTEGRATION* which sum all integration
and then normalize it when the *count_time*. and then normalize it when the *count_time*.
auto_add_channel -- specify if channel is directly added from counter (default: True)
Other keys are: Other keys are:
* npoints -- number of point for this acquisition * npoints -- number of point for this acquisition
* prepare_once -- * prepare_once --
* start_once -- * start_once --
""" """
BaseCounterAcquisitionDevice.__init__(self, counter, count_time, auto_add_channel, **keys) BaseCounterAcquisitionDevice.__init__(self, counter, count_time, **keys)
self._event = event.Event() self._event = event.Event()
self._stop_flag = False self._stop_flag = False
...@@ -173,8 +172,8 @@ class SamplingCounterAcquisitionDevice(BaseCounterAcquisitionDevice): ...@@ -173,8 +172,8 @@ class SamplingCounterAcquisitionDevice(BaseCounterAcquisitionDevice):
class IntegratingCounterAcquisitionDevice(BaseCounterAcquisitionDevice): class IntegratingCounterAcquisitionDevice(BaseCounterAcquisitionDevice):
def __init__(self, counter, count_time=None, auto_add_channel=True, **keys): def __init__(self, counter, count_time=None, **keys):
BaseCounterAcquisitionDevice.__init__(self, counter, count_time, auto_add_channel, **keys) BaseCounterAcquisitionDevice.__init__(self, counter, count_time, **keys)
def prepare(self): def prepare(self):
self.device.prepare(*self.grouped_read_counters) self.device.prepare(*self.grouped_read_counters)
......
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