Commit e22bb43a authored by Matias Guijarro's avatar Matias Guijarro Committed by Vincent Michel
Browse files

removed 'type' of AcquisitionDevice and AcquisitionMaster objects

The type should only be linked with AcquisitionChannels ; we can
imagine to have a device with multiple channels of different types.
parent a99dd065
......@@ -8,9 +8,9 @@ import sys
class CalcAcquisitionDevice(AcquisitionDevice):
def __init__(self, name, src_acq_devices_list, func, output_channels_list, type="zerod"):
def __init__(self, name, src_acq_devices_list, func, output_channels_list):
AcquisitionDevice.__init__(
self, None, name, type, trigger_type=AcquisitionDevice.HARDWARE)
self, None, name, trigger_type=AcquisitionDevice.HARDWARE)
self.src_acq_devices_list = src_acq_devices_list
self.func = func
self.channels.extend(output_channels_list)
......
......@@ -21,7 +21,7 @@ class BaseCounterAcquisitionDevice(AcquisitionDevice):
prepare_once = keys.pop('prepare_once', True)
start_once = keys.pop('start_once', npoints > 1)
AcquisitionDevice.__init__(self, counter, counter.name, "zerod",
AcquisitionDevice.__init__(self, counter, counter.name,
npoints=npoints,
trigger_type=AcquisitionDevice.SOFTWARE,
prepare_once=prepare_once,
......
......@@ -35,7 +35,7 @@ class LimaAcquisitionMaster(AcquisitionMaster):
trigger_type = AcquisitionMaster.SOFTWARE if 'INTERNAL' in acq_trigger_mode else AcquisitionMaster.HARDWARE
if isinstance(device, lima.Lima):
device = device.proxy
AcquisitionMaster.__init__(self, device, device.user_detector_name, "lima", acq_nb_frames,
AcquisitionMaster.__init__(self, device, device.user_detector_name, acq_nb_frames,
trigger_type=trigger_type,
prepare_once=prepare_once, start_once=start_once)
self.save_flag = save_flag
......
......@@ -22,8 +22,8 @@ import sys
class MotorMaster(AcquisitionMaster):
def __init__(self, axis, start, end, time=0, undershoot=None,
trigger_type=AcquisitionMaster.HARDWARE,
backnforth=False, type="axis", **keys):
AcquisitionMaster.__init__(self, axis, axis.name, type,
backnforth=False, **keys):
AcquisitionMaster.__init__(self, axis, axis.name,
trigger_type=trigger_type, **keys)
self.movable = axis
self.start_pos = start
......@@ -75,7 +75,7 @@ class MotorMaster(AcquisitionMaster):
class SoftwarePositionTriggerMaster(MotorMaster):
def __init__(self, axis, start, end, npoints=1, **kwargs):
self._positions = numpy.linspace(start, end, npoints + 1)[:-1]
MotorMaster.__init__(self, axis, start, end, type="zerod", **kwargs)
MotorMaster.__init__(self, axis, start, end, **kwargs)
self.channels.append(AcquisitionChannel(axis.name, numpy.double, (1,)))
self.__nb_points = npoints
......@@ -132,7 +132,7 @@ class JogMotorMaster(AcquisitionMaster):
Stop the movement if return value != True
if end_jog_func is None should be stopped externally.
"""
AcquisitionMaster.__init__(self, axis, axis.name, "axis")
AcquisitionMaster.__init__(self, axis, axis.name)
self.movable = axis
self.start_pos = start
self.undershoot = undershoot
......@@ -217,7 +217,7 @@ class _StepTriggerMaster(AcquisitionMaster):
mot_group = Group(*self._axes)
group_name = '/'.join((x.name for x in self._axes))
AcquisitionMaster.__init__(self, mot_group, group_name, "zerod",
AcquisitionMaster.__init__(self, mot_group, group_name,
trigger_type=trigger_type, **keys)
self.channels.extend(
......@@ -247,7 +247,8 @@ class _StepTriggerMaster(AcquisitionMaster):
def trigger(self):
self.trigger_slaves()
self.channels.update_from_iterable([axis.position() for axis in self._axes])
self.channels.update_from_iterable(
[axis.position() for axis in self._axes])
self.wait_slaves()
......
......@@ -26,7 +26,7 @@ class MusstAcquisitionDevice(AcquisitionDevice):
vars -- all variable you want to set before the musst program starts
"""
AcquisitionDevice.__init__(
self, musst_dev, "musst", "zerod", trigger_type=AcquisitionDevice.HARDWARE)
self, musst_dev, musst_dev.name, trigger_type=AcquisitionDevice.HARDWARE)
self.musst = musst_dev
self.program = program
if program_template_replacement is not None:
......
......@@ -12,7 +12,7 @@ import time
class TestAcquisitionDevice(AcquisitionDevice):
def __init__(self, device, sleep_time=1, **keys):
AcquisitionDevice.__init__(self, device, device, "test", **keys)
AcquisitionDevice.__init__(self, device, device, **keys)
self.sleep_time = sleep_time
def __str__(self):
......@@ -39,7 +39,7 @@ class TestAcquisitionDevice(AcquisitionDevice):
class TestAcquisitionMaster(AcquisitionMaster):
def __init__(self, device):
AcquisitionMaster.__init__(self, device, device, "test")
AcquisitionMaster.__init__(self, device, device.name)
def __str__(self):
return '(master) ' + self.device
......
......@@ -15,8 +15,7 @@ import weakref
class SoftwareTimerMaster(AcquisitionMaster):
def __init__(self, count_time, sleep_time=None, **keys):
AcquisitionMaster.__init__(self, None, "timer", "zerod",
**keys)
AcquisitionMaster.__init__(self, None, 'timer', **keys)
self.count_time = count_time
self.sleep_time = sleep_time
self.channels.append(AcquisitionChannel(
......
......@@ -124,20 +124,17 @@ class DeviceIteratorWrapper(object):
class AcquisitionMaster(object):
#SAFE, FAST = (0, 1)
HARDWARE, SOFTWARE = range(2)
def __init__(self, device, name, type, npoints=None, trigger_type=SOFTWARE,
prepare_once=False, start_once=False): # , trigger_mode=AcquisitionMaster.FAST):
def __init__(self, device, name, npoints=None, trigger_type=SOFTWARE,
prepare_once=False, start_once=False):
self.__device = device
self.__name = name
self.__type = type
self.__parent = None
self.__slaves = list()
self.__triggers = list()
self.__channels = AcquisitionChannelList(self)
self.__npoints = npoints
#self.__trigger_mode = trigger_mode
self.__trigger_type = trigger_type
self.__prepare_once = prepare_once
self.__start_once = start_once
......@@ -162,10 +159,6 @@ class AcquisitionMaster(object):
def name(self):
return self.__name
@property
def type(self):
return self.__type
@property
def slaves(self):
return self.__slaves
......@@ -244,18 +237,17 @@ class AcquisitionMaster(object):
class AcquisitionDevice(object):
HARDWARE, SOFTWARE = range(2)
def __init__(self, device, name, data_type, npoints=0, trigger_type=SOFTWARE,
def __init__(self, device, name, npoints=0, trigger_type=SOFTWARE,
prepare_once=False, start_once=False):
self.__device = device
self.__parent = None
self.__name = name
self.__type = data_type
self._reading_task = None
self.__trigger_type = trigger_type
self.__channels = AcquisitionChannelList(self)
self.__npoints = npoints
self.__prepare_once = prepare_once
self.__start_once = start_once
self._reading_task = None
@property
def parent(self):
......@@ -285,10 +277,6 @@ class AcquisitionDevice(object):
def name(self):
return self.__name
@property
def type(self):
return self.__type
@property
def channels(self):
return self.__channels
......
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