Commit c3302228 authored by Vincent Michel's avatar Vincent Michel

Add default chain support for the PEPU

parent d1088686
......@@ -38,6 +38,7 @@ from bliss.scanning.acquisition.motor import LinearStepTriggerMaster, MeshStepTr
from bliss.scanning.acquisition.lima import LimaAcquisitionMaster
from bliss.scanning.acquisition.ct2 import CT2AcquisitionMaster
from bliss.scanning.acquisition.mca import BaseMcaCounter, McaAcquisitionDevice
from bliss.scanning.acquisition.pepu import PepuCounter, PepuAcquisitionDevice
from bliss.common import session,measurementgroup
try:
from bliss.scanning.writer import hdf5 as default_writer
......@@ -150,7 +151,20 @@ def _counters_tree(counters, scan_pars):
counters=counter_list)
tree.setdefault(None, []).append(acq_device)
# End MCA specific block #
# PEPU specific block
pepu_counters = {}
for counter in counters:
if isinstance(counter, PepuCounter):
pepu_counters.setdefault(counter.controller, []).append(counter)
for counter_list in pepu_counters.values():
counters -= set(counter_list)
for pepu, counter_list in pepu_counters.items():
acq_device = PepuAcquisitionDevice(
pepu, npoints=npoints, counters=counter_list)
tree.setdefault(None, []).append(acq_device)
# End specific block #
reader_counters = ordereddict()
for cnt in counters:
......
......@@ -69,8 +69,9 @@ class PepuAcquisitionDevice(AcquisitionDevice):
self.pepu = pepu
self.stream = None
self.counters = []
self.frequency = frequency
self.counters = list(counters)
self.add_counters(counters)
self.trig = Trigger(start, trigger)
# Counter management
......@@ -126,6 +127,10 @@ class PepuCounter(object):
self.channel = channel
self.acquisition_controller = None
@property
def controller(self):
return self.channel.pepu
@property
def name(self):
return self.channel.name
......
......@@ -46,8 +46,8 @@ def pepu():
pepu.software_trigger.side_effect = lambda: trigger.put(None)
pepu.mock_points = []
yield pepu
# stream.start.assert_called_once_with()
# stream.stop.assert_called_once_with()
stream.start.assert_called_once_with()
stream.stop.assert_called_once_with()
def test_pepu_soft_scan(beacon, pepu):
......@@ -95,14 +95,13 @@ def test_pepu_continuous_soft_scan(beacon, pepu):
def test_pepu_default_chain_ascan(beacon, pepu):
pytest.xfail()
# Get controllers
m0 = beacon.get('m0')
# Add data
pepu.mock_points = [[y+x/10. for y in range(1, 15)] for x in range(10)]
# Run scan
scan = scans.ascan(
m0, 0, 10, 3, 0.1, *pepu.counters, return_scan=True, save=False)
m0, 0, 10, 10, 0.01, *pepu.counters, return_scan=True, save=False)
# Checks
data = scans.get_data(scan)
for i, counter in enumerate(pepu.counters, 1):
......
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