Пример #1
0
    def __init__(self, inst, props, *args, **kwargs):
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        self._log.debug("__init__(%s, %s): Entering...", repr(inst),
                        repr(props))

        self.master = None
        self.integrationTime = 0.0
        self.avSamplesMax = 1000
        self.channels = []
        # @todo: this is not a good idea, better change it.
        # Maybe avoid ReadAll?
        self.measures = ['0', '0', '0', '0']

        self.lastvalues = []
        self.contAcqChannels = {}
        self.acqchannels = []
        self.state = None
        self.ranges = ['', '', '', '']
        self.filters = ['', '', '', '']
        self.dinversions = ['', '', '', '']
        self.offsets = ['', '', '', '']
        self.sampleRate = 0.0
        try:
            self.AemDevice = PyTango.DeviceProxy(self.Albaemname)
            self.state = self.AemDevice.getEmState()

        except Exception as e:
            self._log.error(
                "__init__(): Could not create a device from "
                "following device name: %s.\nException: %s", self.Albaemname,
                e)
    def __init__(self, inst, props, *args, **kwargs):
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        self._log.debug("__init__(%s, %s): Entering...", repr(inst),
                        repr(props))

        try:
            self._limaroi = PyTango.DeviceProxy(self.LimaROIDeviceName)
        except PyTango.DevFailed as e:
            raise RuntimeError('__init__(): Could not create a device proxy '
                               'from following device name: %s.\nException: '
                               '%s ' % (self.LimaROIDeviceName, e))

        self._limaroi.Stop()
        self._limaroi.clearAllRois()
        self._limaroi.Start()
        self._limaroi.write_attribute('BufferSize', self.LimaROIBufferSize)
        self._rois = {}
        self._rois_id = {}
        self._data_buff = {}
        self._state = None
        self._status = None
        self._repetitions = 0
        self._last_image_read = -1
        self._last_image_ready = -1
        self._start = False
        self._synchronization = AcqSynch.SoftwareTrigger
        self._abort_flg = False

        # event_type = PyTango.EventType.PERIODIC_EVENT
        # self._callback_id = self._limaroi.subscribe_event('state',
        #                                                   event_type,
        #                                                   self._callback)
        self._log.debug("__init__(%s, %s): Leaving...", repr(inst),
                        repr(props))
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self.amptekPX5 = tango.DeviceProxy(self.deviceName)
     self.amptekPX5.set_timeout_millis(7000)
     self.acqTime = 0
     self.sta = State.On
     self.acq = False
     self.timeout = 0  # not need for now
Пример #4
0
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._synchronization = AcqSynch.SoftwareTrigger
     self._latency_time = 0
     self.channels = self.MaxDevice * [
         None,
     ]
     self.reset()
Пример #5
0
 def __init__(self, inst, props, *args, **kwargs):
     """Constructor"""
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._log.info(
         'PiLCTriggerGateGenerator Initialization on {:s} ...'.format(
             self.tangoFQDN))
     self.proxy = DeviceProxy(self.tangoFQDN)
     self._log.info('SUCCESS')
     self.__start_time = None
Пример #6
0
 def __init__(self, inst, props, *args, **kwargs):
     """Constructor"""
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._log.info('Rigol MSO Initialization on {:s} ...'.format(
         self.resource))
     rm = visa.ResourceManager()
     self.mso = rm.open_resource('TCPIP::192.168.1.110::INSTR')
     self._log.info('SUCCESS')
     self.__start_time = time.time()
     self.__integ_time = 0
Пример #7
0
    def __init__(self, inst, props, *args, **kwargs):
        """Class initialization."""
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        self._log.debug("__init__(%s, %s): Entering...", repr(inst),
                        repr(props))

        try:
            self.pandabox = PandA(self.PandaboxHost)
            self.pandabox.connect_to_panda()
        except (NameError, socket.gaierror):
            raise Exception('Unable to connect to PandABox.')

        # make sure PCAP block is reset
        self.pandabox.query('PCAP.ENABLE=ZERO')
        self.pandabox.query('*PCAP.DISARM=')

        try:
            self.data_socket = TCP(self.PandaboxHost, 8889, timeout=3)
            self.data_socket.open()
        except:
            raise Exception('Unable to open PandABox data stream.')

        # check if data stream starts correctly
        ack = self.data_socket.write_readline('\n')
        if "OK" not in ack:
            raise Exception('Acknowledge to data stream failed!')
        print "PandaboxCoTiCtrl: data stream listener starts...", ack
        self.data_buffer = ""
        self.header_okay_flag = False
        self.data_end_flag = False

        self.attributes = {}
        self.hw_trigger_cfg = {}
        self.hw_trigger_cfg['enable'] = self.PcapEnable
        self.hw_trigger_cfg['gate'] = self.PcapGate
        self.hw_trigger_cfg['trig'] = self.PcapTrig

        self.channels_order = []

        # channels and modes available
        self._modes = ['Value', 'Diff', 'Min', 'Max', 'Sum', 'Mean']
        self._channels = [
            'INENC1.VAL', 'INENC2.VAL', 'INENC3.VAL', 'INENC4.VAL',
            'CALC1.OUT', 'CALC2.OUT', 'COUNTER1.OUT', 'COUNTER2.OUT',
            'COUNTER3.OUT', 'COUNTER4.OUT', 'COUNTER5.OUT', 'COUNTER6.OUT',
            'COUNTER7.OUT', 'COUNTER8.OUT', 'FILTER1.OUT', 'FILTER2.OUT',
            'PGEN1.OUT', 'PGEN2.OUT', 'QDEC.OUT', 'FMC_IN.VAL1', 'FMC_IN.VAL2',
            'FMC_IN.VAL3', 'FMC_IN.VAL4', 'FMC_IN.VAL5', 'FMC_IN.VAL6',
            'FMC_IN.VAL7', 'FMC_IN.VAL8', 'PCAP.SAMPLES'
        ]

        self.index = 0
        self._repetitions = 0
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self.amptekPX5 = tango.DeviceProxy(self.deviceName)
     self.amptekPX5.SetTextConfiguration(["MCAC=%d" % 4096])
     self.amptekPX5.set_timeout_millis(7000)
     self.acqTime = 0
     self.sta = State.On
     self.acqStartTime = None
     self.spectrum = None
     self.icr = None
     self.tcr = None
     self.scas = {}
Пример #9
0
    def __init__(self, inst, props, *args, **kwargs):
        """Class initialization."""
        # self._log.setLevel(logging.DEBUG)
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        # self._log.setLevel(logging.INFO)
        self._log.debug("__init__(%s, %s): Entering...", repr(inst),
                        repr(props))

        self._master = None
        self._integration_time = 0.0

        # NOTE: this variable is not used at all ...
        # self.avSamplesMax = 1000

        # NOTE: Not sure that this is needed ...
        self._channels = []

        # TODO: Refactor the initialization of self._measures
        # self._measures = ['0', '0', '0', '0']
        self._measures = []

        # NOTE: the following attributes are not usefull at this moment ...
        self.lastvalues = []
        self.contAcqChannels = {}
        self.acqchannels = []
        # NOTE: If I'm not wrong this is fixed now ...
        self.sampleRate = 0.0

        self.state = None

        # TODO: Refactor the following lists
        self.ranges = ['', '', '', '']
        self.filters = ['', '', '', '']
        self.dinversions = ['', '', '', '']
        self.offsets = ['', '', '', '']

        try:
            # NOTE: ... thinking about a AlbaEMProxy class to handle the comms
            self.AemDevice = PyTango.DeviceProxy(self.Albaemname)
            self._ReadStateAndStatus()

        # TODO: Handle Exceptions properly
        except Exception as e:
            error_msg = "Could not connect with: {0}.".format(self.Albaemname)
            exception_msg = "Exception: {}".format(e)
            msg = '__init__(): {2}\n{1}'.format(error_msg, exception_msg)
            self._log.error(msg)
 def SetCtrlPar(self, parameter, value):
     param = parameter.lower()
     if param == 'exttriggerinput':
         self._em2.trigger_input = value
     elif param == 'acquisitionmode':
         self._em2.acquisition_mode = value
     else:
         CounterTimerController.SetCtrlPar(self, parameter, value)
 def GetCtrlPar(self, parameter):
     param = parameter.lower()
     if param == 'exttriggerinput':
         value = self._em2.trigger_input
     elif param == 'acquisitionmode':
         value = self._em2.acquisition_mode
     else:
         value = CounterTimerController.GetCtrlPar(self, parameter)
     return value
    def __init__(self, inst, props, *args, **kwargs):
        #        self._log.setLevel(logging.DEBUG)
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        self._log.debug("__init__(%s, %s): Entering...", repr(inst),
                        repr(props))

        try:
            self.AIDevice = tango.DeviceProxy(self.AdlinkAIDeviceName)
            cmdlist = [c.cmd_name for c in self.AIDevice.command_list_query()]
            if 'ClearBuffer' not in cmdlist:
                msg = ("__init__(): Looks like ADlink device server "
                       "version is too old for this controller version. "
                       "Please upgrade Device server\n")
                raise RuntimeError(msg)

        except tango.DevFailed as e:
            self._log.error(
                "__init__(): Could not create a device proxy from "
                "following device name: %s.\nException: %s",
                self.AdlinkAIDeviceName, e)
            raise

        # TODO: Change the names of the variables to _name_without_capital_case
        self.sd = {}
        self.formulas = {}
        self.sharedFormula = {}
        self.intTime = 0
        self.dataBuff = {}

        self._apply_formulas = {}
        self._master_channel = None
        self._id_callback = None
        self._index_queue = queue.Queue()
        self._last_index_read = -1
        self._hw_state = None
        self._new_data = False
        self._state = State.On
        self._status = 'The Device is in ON.'
        self._synchronization = None
        self._repetitions = 0
        self._latency_time = 1e-6  # 1 us
        self._start_wait_time = 0.05
        self._skip_start = self.SkipStart.lower() == 'true'
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._synchronization = AcqSynch.SoftwareTrigger
     self.channels = self.MaxDevice * [None, ]
     self.start_time = None
     self.integ_time = None
     self.monitor_count = None
     self.repetitions = None
     self.latency_time = None
     self.acq_cycle_time = None
     self.estimated_duration = None
     self.read_channels = {}
     self.counting_channels = {}
     # name of synchronizer element
     self._synchronizer = None
     # synchronizer element (core)
     self.__synchronizer_obj = None
     # flag whether the controller was armed for hardware synchronization
     self._armed = False
    def __init__(self, inst, props, *args, **kwargs):
        """Class initialization."""
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        msg = "__init__(%s, %s): Entering...", repr(inst), repr(props)
        self._log.debug(msg)

        self._em2 = Em2(self.AlbaEmHost, self.Port, self.ZmqPort)
        self._synchronization = AcqSynch.SoftwareTrigger
        self._latency_time = 0.001  # In fact, it is just 320us
        self._use_sw_trigger = True
        self._started = False
        self._aborted = False
        self._nb_points_read_per_start = 0
        self._nb_points_expected_per_start = 0
        self._nb_points_fetched = 0
        self._new_data = {}
        self._state = State.On
        self._status = 'On'

        self.formulas = {1: 'value', 2: 'value', 3: 'value', 4: 'value'}
Пример #15
0
    def __init__(self, inst, props, *args, **kwargs):
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        self._log.debug("__init__(%s, %s): Entering...", repr(inst),
                        repr(props))

        try:
            self._limaccd = PyTango.DeviceProxy(self.LimaCCDDeviceName)
            # self._limaccd.reset()
        except PyTango.DevFailed as e:
            raise RuntimeError('__init__(): Could not create a device proxy '
                               'from following device name: %s.\nException: '
                               '%s ' % (self.LimaCCDDeviceName, e))

        self._data_buff = {}
        self._hw_state = None
        self._last_image_read = -1
        self._repetitions = 0
        self._state = None
        self._status = None
        self._new_data = False
        self._int_time = 0
        self._latency_time = self.LatencyTime
        self._expected_scan_images = 0
        self._hardware_trigger = self.HardwareSync
        self._synchronization = AcqSynch.SoftwareTrigger
        self._hasTrashDir = os.path.isdir(str(self.TrashDir))
        self._abort_flg = False
        self._load_flag = False
        self._start_flg = False

        # Get the Detector Saving Modes allowed
        formats = self._limaccd.command_inout('getAttrStringValueList',
                                              'saving_format')
        self._saving_formats_allowed = formats

        # Check if the LimaCCD has the instrument name attribute
        attrs = self._limaccd.get_attribute_list()
        if 'instrument_name' in attrs:
            self._instrument_name = None
        else:
            self._instrument_name = ''
Пример #16
0
    def __init__(self, inst, props, *args, **kwargs):
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        self.channels_names = self.channelsNames.split(",")
        self.used_channels = []
        self._latency_time = self.latencyTime
        self._channel_config = {}
        self._last_index_read = {}
        self._new_index_ready = -1
        self._first_encoder = {}
        self._start_pos = {}
        self._shape = (1, )
        self._samples = 0
        self._sscan = False

        try:
            self._addr = 'http://{}:{}'.format(self.host, self.port)
            self._proxy = ServerProxy(self._addr)
            self._log.debug('Connected to  %s', self._addr)
        except Exception as e:
            self._log.error('Can not connect to %s: %s', self._addr, e)
            raise RuntimeError(e)
Пример #17
0
    def __init__(self, inst, props, *args, **kwargs):
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        self._state = State.On
        self._status = 'Status ON'
        self._latency_time = 0
        self._last_iba_img = None
        self._last_ccd_img = None
        self._int_time = None
        self._started = False
        self._attrs_values = {}
        self._axes_to_read = set()
        self._synchronization = AcqSynch.SoftwareTrigger
        try:
            # IBA:
            self._iba = PyTango.DeviceProxy(self.devName)

            # CCD:
            img_prop = self._iba.get_property("ImageDevice")
            self._ccdName = img_prop['ImageDevice'][0]
            # FIXME: if the iba is configured in a different tangoDB,
            # this ImageDevice name won't have it
            self._ccd = PyTango.DeviceProxy(self._ccdName)

            # Configure IBA Mode to EVENT
            prop_mode = self._iba.get_property('Mode')['Mode'][0]
            if prop_mode.lower() != 'event':
                self._log.warning(
                    'Changing %s Property Mode from %s to '
                    'EVENT', self.devName, prop_mode)
                self._iba.put_property({'Mode': 'EVENT'})
                self._iba.Init()
                time.sleep(0.5)

            # manipulate the attrList to accept string arrays, and space
            # separated string
            self._attr_list = self.attrList.split()

        except Exception as e:
            self._log.error("%s::__init__() Exception: %s" %
                            (self.kls, str(e)))
    def __init__(self, inst, props, *args, **kwargs):
        CounterTimerController.__init__(self, inst, props, *args, **kwargs)
        try:
            # IBA:
            self._ibaProxy = PyTango.DeviceProxy(self.devName)
            # CCD:
            img_prop = self._ibaProxy.get_property("ImageDevice")
            self._ccdName = img_prop['ImageDevice'][0]
            # FIXME: if the iba is configured in a different tangoDB,
            # this ImageDevice name won't have it
            self._ccdProxy = PyTango.DeviceProxy(self._ccdName)
            # internal vblees
            self._backupDict = {}
            self.expTimeValue = None  # seconds
            self.attr2read = []
            self.attrValues = []
            self.__flag_loadOne = False
            self.__flag_ccdImgCt = None
            self.__flag_ibaImgCt = None
            self.__flag_backup = False
            # basic state
            self.ctrlState = (State.On, "")
            # manipulate the attrList to accept string arrays, and space
            # separated string
            if (type(self.attrList) in [list, tuple]
                and len(self.attrList) == 1) \
                    or (type(self.attrList) == str):

                bar = copy(self.attrList)
                if type(bar) in [list, tuple]:
                    bar = bar[0]
                if type(bar) == str:
                    bar = bar.split(" ")
                self.attrList = copy(bar)
                self._log.info("the attrList had to be manipulated to "
                               "convert to DevVarStringArray")
            # to be check this manipulation
        except Exception as e:
            self._log.error("%s::__init__() Exception: %s" % (self.kls,
                                                              str(e)))
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._synchronization = AcqSynch.SoftwareTrigger
     self._latency_time = 0
     self.channels = self.MaxDevice * [None, ]
     self.reset()
 def __init__(self, inst, props, *args, **kwargs):
     """Constructor"""
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._log.info('Initialized')
     self.axis_extra_pars = {}
Пример #22
0
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._axes_taurus_attr = {}
Пример #23
0
 def __init__(self, inst, props, *args, **kwargs):
     """Constructor"""
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self.int_time = 0
     self.start_time = 0
Пример #24
0
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self.acq_time = 1.
     self.acq_end_time = time.time()
     self.start_counts = 0
Пример #25
0
 def __init__(self, inst, props, *args, **kwargs):
     ReadTangoAttributes.__init__(self)
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
Пример #26
0
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self.channels = self.MaxDevice*[None,]
     self.reset()
Пример #27
0
 def SetCtrlPar(self, parameter, value):
     CounterTimerController.SetCtrlPar(self, parameter, value)
Пример #28
0
 def __init__(self, inst, props, *args, **kwargs):
     ReadTangoAttributes.__init__(self)
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
Пример #29
0
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._axes_taurus_attr = {}
Пример #30
0
 def GetCtrlPar(self, parameter):
     value = CounterTimerController.GetCtrlPar(self, parameter)
     return value
Пример #31
0
 def __init__(self, inst, props, *args, **kwargs):
     CounterTimerController.__init__(self, inst, props, *args, **kwargs)
     self._integ_time = None
     self._start_time = None
     self._file = None