Esempio n. 1
0
 def __init__(self, poolpath=[], loglevel=None):
     self.ctrl_manager = ControllerManager()
     if loglevel:
         self.ctrl_manager.setLogLevel(loglevel)
     self.ctrl_manager.set_pool(self)
     self.ctrl_manager.setControllerPath(poolpath)
     self.elements = {}
     self.elements_by_full_name = {}
     self._freeId = 1
Esempio n. 2
0
class FakePool(object):
    ''' Fake class to simulate the behavior of the Pool class
    '''
    acq_loop_sleep_time = 0.1
    acq_loop_states_per_value = 10
    motion_loop_sleep_time = 0.1
    motion_loop_states_per_position = 10
    drift_correction = True

    def __init__(self, poolpath=[], loglevel=None):
        self.ctrl_manager = ControllerManager()
        if loglevel:
            self.ctrl_manager.setLogLevel(loglevel)
        self.ctrl_manager.set_pool(self)
        self.ctrl_manager.setControllerPath(poolpath)
        self.elements = {}
        self.elements_by_full_name = {}
        self._freeId = 1

    def add_element(self, element):
        self.elements[element.id] = element
        self.elements_by_full_name[element.full_name] = element

    def get_element(self, id):
        return self.elements[id]

    def get_element_by_full_name(self, full_name):
        return self.elements_by_full_name[full_name]

    def get_free_id(self):
        while True:
            try:
                self.get_element(self._freeId)
                self._freeId += 1
            except KeyError:
                return self._freeId

    def get_free_name(self, base_name):
        num = 1
        while True:
            try:
                self.get_element_by_full_name(base_name + "%s" % num)
                num += 1
            except KeyError:
                return base_name + "%s" % num

    def get_manager(self):
        return self.ctrl_manager

    def cleanup(self):
        self.ctrl_manager.cleanUp()
        self.ctrl_manager.reInit()
        self.elements = {}
        self.elements_by_full_name = {}
Esempio n. 3
0
class FakePool(object):
    ''' Fake class to simulate the behavior of the Pool class
    '''
    acq_loop_sleep_time = 0.1
    acq_loop_states_per_value = 10
    motion_loop_sleep_time = 0.1
    motion_loop_states_per_position = 10
    drift_correction = True

    def __init__(self, poolpath=[], loglevel=None):
        self.ctrl_manager = ControllerManager()
        if loglevel:
            self.ctrl_manager.setLogLevel(loglevel)
        self.ctrl_manager.set_pool(self)
        self.ctrl_manager.setControllerPath(poolpath)
        self.elements = {}
        self.elements_by_full_name = {}
        self._freeId = 1

    def add_element(self, element):
        self.elements[element.id] = element
        self.elements_by_full_name[element.full_name] = element

    def get_element(self, id):
        return self.elements[id]

    def get_element_by_full_name(self, full_name):
        return self.elements_by_full_name[full_name]

    def get_free_id(self):
        while True:
            try:
                self.get_element(self._freeId)
                self._freeId += 1
            except KeyError:
                return self._freeId

    def get_free_name(self, base_name):
        num = 1
        while True:
            try:
                self.get_element_by_full_name(base_name + "%s" % num)
                num += 1
            except KeyError:
                return base_name + "%s" % num

    def get_manager(self):
        return self.ctrl_manager

    def cleanup(self):
        self.ctrl_manager.cleanUp()
        self.ctrl_manager.reInit()
        self.elements = {}
        self.elements_by_full_name = {}
Esempio n. 4
0
    def __init__(self, full_name, name=None):
        self._path_id = None
        self._motion_loop_states_per_position = self.Default_MotionLoop_StatesPerPosition
        self._motion_loop_sleep_time = self.Default_MotionLoop_SleepTime
        self._acq_loop_states_per_value = self.Default_AcqLoop_StatesPerValue
        self._acq_loop_sleep_time = self.Default_AcqLoop_SleepTime
        self._drift_correction = self.Default_DriftCorrection
        self._remote_log_handler = None

        # dict<str, dict<str, str>>
        # keys are acquisition channel names and value is a dict describing the
        # channel containing:
        #  - 'name': with value being the channel name (given by user)
        #  - 'full_name': acq channel full name (ex: tango attribute)
        #  - 'origin': 'local' if local to this server or 'remote' if a remote
        #    channel
        self._extra_acquisition_element_names = CaselessDict()

        PoolContainer.__init__(self)
        PoolObject.__init__(self,
                            full_name=full_name,
                            name=name,
                            id=InvalidId,
                            pool=self,
                            elem_type=ElementType.Pool)
        self._monitor = PoolMonitor(self, "PMonitor", auto_start=False)
        # self.init_local_logging()
        ControllerManager().set_pool(self)
Esempio n. 5
0
class FakePool(object):
    ''' Fake class to simulate the behaviour of the Pool class
    '''
    acq_loop_sleep_time = 0.1
    acq_loop_states_per_value = 10

    elements = {}

    def __init__(self):
        self.ctrl_manager = ControllerManager()
        self.ctrl_manager.set_pool(self)
        self.ctrl_manager.setControllerPath([])

    def add_element(self, element):
        self.elements[element.id] = element

    def get_element(self, id):
        return self.elements[id]
Esempio n. 6
0
 def __init__(self, poolpath=[], loglevel=None):
     self.ctrl_manager = ControllerManager()
     if loglevel:
         self.ctrl_manager.setLogLevel(loglevel)
     self.ctrl_manager.set_pool(self)
     self.ctrl_manager.setControllerPath(poolpath)
     self.elements = {}
     self.elements_by_full_name = {}
     self._freeId = 1
Esempio n. 7
0
 def __init__(self):
     self.ctrl_manager = ControllerManager()
     self.ctrl_manager.set_pool(self)
     self.ctrl_manager.setControllerPath([])
Esempio n. 8
0
 def ctrl_manager(self):
     return ControllerManager()
 def setUp(self):
     """Create a ControllerManager"""
     self.cm = ControllerManager()