示例#1
0
 def __init__(self, parent=None, device='', prefix=''):
     super().__init__(parent)
     self.prefix = prefix
     self.device = SiriusPVName(device)
     self.cam_prefix = self.device.substitute(propty=self.prefix)
     self.setObjectName(self.device.sec + 'App')
     self._setupUi()
示例#2
0
    def __init__(self, parent=None, prefix=''):

        self.prefix = prefix
        self._inj_prefix = SiriusPVName(
            'AS-Glob:AP-InjCtrl').substitute(prefix=prefix)

        super().__init__(
            parent=parent,
            init_channel=self._inj_prefix.substitute(propty='RFKillBeam-Cmd'),
            icon=qta.icon('mdi.skull-outline'), label='',
            pressValue=1)
        self.initial_icon = self.icon()

        self.showConfirmDialog = True
        self.confirmMessage = \
            'This action will kill the stored beam.\n' \
            'Are you sure you want to proceed?'

        self.setObjectName('rfkill')
        self.setStyleSheet("""
            #rfkill{
                min-width:30px; max-width:30px;
                min-height:30px; max-height:30px;
                icon-size:25px;}""")

        self._pv_mon = _ConnSignal(
            self._inj_prefix.substitute(propty='RFKillBeam-Mon'))
        self._pv_mon.new_value_signal[int].connect(self._handle_enable_state)
示例#3
0
文件: main.py 项目: lnls-sirius/hla
    def __init__(self, parent=None, prefix=_VACA_PREFIX, device=None):
        """Initialize object."""
        QWidget.__init__(self, parent=parent)
        self.prefix = prefix
        self.device = SiriusPVName(device)
        self.scrn_prefix = self.device.substitute(prefix=prefix)
        self._receivedData = False
        self.setObjectName(self.scrn_prefix.sec + 'App')

        self.screen_type_conn = SiriusConnectionSignal(
            self.scrn_prefix.substitute(propty='ScrnType-Sts'))
        self.screen_type_conn.new_value_signal.connect(
            self.updateCalibrationGridFlag)
        self._calibrationgrid_flag = self.screen_type_conn.getvalue()
        self.save_files.connect(self._saveGridLocalFiles)
        self.ch_ImgROIHeight = SiriusConnectionSignal(
            self.scrn_prefix.substitute(propty='ImgROIHeight-RB'))
        self.ch_ImgROIWidth = SiriusConnectionSignal(
            self.scrn_prefix.substitute(propty='ImgROIWidth-RB'))
        self.ch_ImgROIOffsetX = SiriusConnectionSignal(
            self.scrn_prefix.substitute(propty='ImgROIOffsetX-RB'))
        self.ch_ImgROIOffsetY = SiriusConnectionSignal(
            self.scrn_prefix.substitute(propty='ImgROIOffsetY-RB'))

        self._setupUi()
        self.setFocus(True)
        self.setFocusPolicy(Qt.StrongFocus)
        self._loadCalibrationGrid(default=True)
示例#4
0
 def __init__(self, parent=None, prefix=VACA_PREFIX):
     """Init."""
     super().__init__(parent)
     self.prefix = prefix
     self._inj_dev = SiriusPVName('AS-Glob:AP-InjCtrl')
     self._inj_prefix = self._inj_dev.substitute(prefix=prefix)
     self._setupUi()
示例#5
0
    def __init__(self, parent=None, prefix='', device=''):
        """Initialize object."""
        super().__init__(parent)
        self.prefix = prefix
        self.device = SiriusPVName(device)
        self.use_raw = self.device.sec == 'BO'
        self.dcct_prefix = self.device.substitute(prefix=prefix)

        self.acqmode_channel = SignalChannel(
            self.dcct_prefix.substitute(propty='MeasMode-Sel'))
        self.acqmode_channel.new_value_signal[int].connect(self.updateParams)
        self.normalnrsamp_channel = SignalChannel(
            self.dcct_prefix.substitute(propty='SampleCnt-RB'))
        self.normalnrsamp_channel.new_value_signal[int].connect(
            self.updateParams)
        self.fastnrsamp_channel = SignalChannel(
            self.dcct_prefix.substitute(propty='FastSampleCnt-RB'))
        self.fastnrsamp_channel.new_value_signal[int].connect(
            self.updateParams)
        self._acq_mode = None
        self._acq_normalnrsamp = None
        self._acq_fastnrsamp = None

        self._downsampling = 1
        self._smooth_method = 'Average'
        self._smooth_nracq = 1
        self._smooth_buffer = list()

        self._setupUi()
示例#6
0
 def __init__(self,
              parent=None,
              prefix='',
              orientation='H',
              background='w'):
     """Init."""
     self.prefix = prefix
     self.orientation = orientation
     self.device = SiriusPVName('BO-Glob:DI-Tune-O')
     self.device = self.device.substitute(prefix=self.prefix,
                                          idx=orientation)
     image_channel = self.device.substitute(dev='TuneProc',
                                            propty='SpecArray-Mon')
     xaxis_channel = self.device.substitute(propty='TuneFracArray-Mon')
     yaxis_channel = self.device.substitute(propty='TimeArray-Mon')
     roioffx_channel = self.device.substitute(propty='ROIOffXConv-RB')
     roioffy_channel = self.device.substitute(propty='ROIOffYConv-RB')
     roiwidth_channel = self.device.substitute(propty='ROIWidthConv-RB')
     roiheight_channel = self.device.substitute(propty='ROIHeightConv-RB')
     super().__init__(parent=parent,
                      image_channel=image_channel,
                      xaxis_channel=xaxis_channel,
                      yaxis_channel=yaxis_channel,
                      roioffsetx_channel=roioffx_channel,
                      roioffsety_channel=roioffy_channel,
                      roiwidth_channel=roiwidth_channel,
                      roiheight_channel=roiheight_channel,
                      background=background)
     self.normalizeData = True
     self.ROIColor = QColor('cyan')
     self.format_tooltip = '{0:.3f}, {1:.3f}'
     self._idx2send = 0
     self.buffer = list()
     self.last_data = None
     self.nravgs = 1
示例#7
0
    def __init__(self, channel, prefix):
        """Initialize the Low Level object.

        callback is the callable to be called each time a low level PV changes
        its value.
        """
        super().__init__()
        self.channel = _PVName(channel)
        self.prefix = prefix
        self._dict_functs_for_write = self._define_dict_for_write()
        self._dict_functs_for_update = self._define_dict_for_update()
        self._dict_functs_for_read = self._define_dict_for_read()
        self._dict_convert_prop2pv = self._define_convertion_prop2pv()
        self._dict_convert_pv2prop = {
            val: key
            for key, val in self._dict_convert_prop2pv.items()
        }
        self._config_ok_values = dict()
        self._base_freq = _RFFREQ / _RFDIV

        self._writepvs = dict()
        self._readpvs = dict()
        self._locked = False

        evg_name = _LLTimeSearch.get_evg_name()
        self._base_freq_pv = _PV(LL_PREFIX + evg_name + ':FPGAClk-Cte')
        self._update_base_freq()
        self._base_freq_pv.add_callback(self._update_base_freq)

        _log.info(self.channel + ': Creating PVs.')
        for prop, pvname in self._dict_convert_prop2pv.items():
            pvnamerb = pvnamesp = None
            if not _PVName.is_write_pv(pvname):
                pvnamerb = pvname
                pvnamesp = _PVName.from_rb2sp(pvname)
            elif _PVName.is_cmd_pv(pvname):  # -Cmd is different!!
                self._writepvs[prop] = _PV(pvname)

            if pvnamerb is not None:
                self._readpvs[prop] = _PV(pvnamerb)
            if pvnamesp != pvnamerb and not prop.endswith('DevEnbl'):
                self._writepvs[prop] = _PV(pvnamesp)
                self._writepvs[prop]._initialized = False

        for prop, pv in self._writepvs.items():
            if not pv.wait_for_connection():
                _log.info(pv.pvname + ' not connected.')
        for prop, pv in self._readpvs.items():
            if not pv.wait_for_connection():
                _log.info(pv.pvname + ' not connected.')

        for prop, pv in self._writepvs.items():
            if _PVName.is_cmd_pv(pv.pvname):
                continue
            pv.add_callback(self._on_change_writepv)
            pv.connection_callbacks.append(self._on_connection_writepv)
        for prop, pv in self._readpvs.items():
            pv.add_callback(self._on_change_readpv)
            pv.connection_callbacks.append(self._on_connection)
示例#8
0
 def __init__(self, parent=None, prefix=VACA_PREFIX):
     """Init."""
     pref_dev = SiriusPVName(EVG_NAME).substitute(prefix=prefix)
     super().__init__(
         parent=parent,
         init_channel=pref_dev.substitute(propty='EvtSyncStatus-Mon'))
     self.setOffColor(self.Red)
     self.setOnColor(self.LightGreen)
示例#9
0
 def _on_change_pv_thread(self, pvname, value, **kwargs):
     pvn = _PVName.from_sp2rb(pvname)
     is_sp = _PVName.is_sp_pv(pvname)
     fun = self._dict_functs_for_update[self._dict_convert_pv2prop[pvn]]
     props = fun(is_sp, value)
     for hl_prop, val in props.items():
         if val is not None:
             self.run_callbacks(self.channel, hl_prop, val, is_sp=is_sp)
示例#10
0
 def _get_properties_suffix(self):
     dbase = self.get_database()
     props = dict()
     for pvname in dbase:
         if not _PVName.is_sp_pv(pvname) and not _PVName.is_cte_pv(pvname):
             prop, suf = self._get_prop_name(pvname, with_suffix=True)
             props[prop] = suf
     return props
示例#11
0
文件: main.py 项目: lnls-sirius/hla
 def __init__(self, parent=None, prefix=_VACA_PREFIX, scrn=''):
     """Init."""
     super().__init__(parent=parent)
     self._prefix = prefix
     self._scrn = SiriusPVName(scrn)
     self._scrn_pref = self._scrn.substitute(prefix=prefix)
     self.setObjectName(self._scrn.sec + 'App')
     self._setupUi()
示例#12
0
 def __init__(self, parent=None, device=None, prefix=None):
     """Init."""
     super().__init__(parent=parent)
     self.prefix = prefix
     self.device = SiriusPVName(device)
     self.scrn_prefix = self.device.substitute(prefix=self.prefix)
     self.setWindowTitle('Screen Calibration')
     self.setObjectName(self.scrn_prefix.sec + 'App')
     self._setupUi()
示例#13
0
    def _setupScrnsCorrsWidget(self):
        lay = QVBoxLayout()
        lay.setContentsMargins(0, 0, 0, 0)

        headerline = self._create_headerline(
            (('', 0), ('Screen', 6.5), ('Cam', 3.5), ('Type-Sel', 5),
             ('Type-Sts', 5), ('', 0), ('', 1.29), ('CH', 5), ('Kick-SP', 5),
             ('Kick-Mon', 5), ('', 0), ('', 1.29), ('CV', 5), ('Kick-SP', 5),
             ('Kick-Mon', 5), ('', 0)))
        headerline.setSizePolicy(QSzPlcy.Preferred, QSzPlcy.Maximum)
        lay.addWidget(headerline)

        for scrn_idx, devices in enumerate(self._devices):
            scrnprefix, ch_group, cv_group = devices

            scrnprefix = SiriusPVName(scrnprefix)
            scrn_details = self._create_scrn_summwidget(scrnprefix, scrn_idx)
            scrn_details.setObjectName(scrnprefix)
            scrn_details.layout().setContentsMargins(0, 9, 0, 9)

            ch_widget = QWidget()
            ch_widget.setLayout(QVBoxLayout())
            ch_widget.layout().setContentsMargins(0, 9, 0, 9)
            for ch in ch_group:
                ch = SiriusPVName(ch)
                ch_details = self._create_corr_summwidget(ch)
                ch_details.setObjectName(ch)
                ch_widget.layout().addWidget(ch_details)

            cv_widget = QWidget()
            cv_widget.setLayout(QVBoxLayout())
            cv_widget.layout().setContentsMargins(0, 9, 0, 9)
            for cv in cv_group:
                cv = SiriusPVName(cv)
                cv_details = self._create_corr_summwidget(cv)
                cv_details.setObjectName(cv)
                cv_widget.layout().addWidget(cv_details)

            hlay_scrncorr = QHBoxLayout()
            hlay_scrncorr.setContentsMargins(0, 0, 0, 0)
            hlay_scrncorr.addStretch()
            hlay_scrncorr.addWidget(scrn_details)
            hlay_scrncorr.addStretch()
            hlay_scrncorr.addWidget(ch_widget)
            hlay_scrncorr.addStretch()
            hlay_scrncorr.addWidget(cv_widget)
            hlay_scrncorr.addStretch()
            widget_scrncorr = QWidget()
            widget_scrncorr.setObjectName('widget_correctors_scrn')
            widget_scrncorr.setLayout(hlay_scrncorr)
            widget_scrncorr.setStyleSheet(
                '#widget_correctors_scrn {border-top: 2px solid gray;}')
            lay.addWidget(widget_scrncorr)

        self.corr_wid.setLayout(lay)
示例#14
0
 def readall(self, is_sp=False):
     """Read all."""
     values = dict()
     for prop, suf in self._all_props_suffix.items():
         if _PVName.is_cmd_pv(suf) or (is_sp and not _PVName.is_rb_pv(suf)):
             continue
         value = self.read(prop, is_sp=is_sp)
         if value is None or not value:
             continue
         values[prop] = value
     return values
示例#15
0
 def __init__(self, parent=None, device=None, prefix=None):
     """Init."""
     super().__init__(parent=parent)
     self.prefix = prefix
     self.device = SiriusPVName(device)
     self.scrn_prefix = self.device.substitute(prefix=prefix)
     self.setWindowTitle('Screen Settings Details')
     self.setObjectName(self.scrn_prefix.sec+'App')
     self.centralwidget = QWidget(self)
     self._setupUi()
     self.setCentralWidget(self.centralwidget)
示例#16
0
 def get_map2readpvs(self):
     """Get the database."""
     dbase = self.get_database()
     map2readpvs = dict()
     for pvname in dbase:
         if _PVName.is_cte_pv(pvname) or _PVName.is_cmd_pv(pvname):
             continue
         prop = self._get_prop_name(pvname)
         map2readpvs[pvname] = _partial(
                         self.read, prop, is_sp=_PVName.is_sp_pv(pvname))
     return map2readpvs
示例#17
0
 def __init__(self, parent=None, prefix=VACA_PREFIX):
     super().__init__(parent,
                      label='',
                      icon=qta.icon('fa5s.sync'),
                      pressValue=1)
     pref_dev = SiriusPVName(EVG_NAME).substitute(prefix=prefix)
     self.setToolTip('Update Events Table')
     self.channel = pref_dev.substitute(propty='UpdateEvt-Cmd')
     self.setObjectName('but')
     self.setStyleSheet(
         '#but{min-width:25px; max-width:25px; icon-size:20px;}')
示例#18
0
 def __init__(self, parent=None, prefix=VACA_PREFIX):
     """Init."""
     pref_dev = SiriusPVName(EVG_NAME).substitute(prefix=prefix)
     color_list = 7 * [
         self.DarkGreen,
     ]
     color_list[3] = self.LightGreen  # Injection
     color_list[5] = self.Yellow  # Preparing Injection
     super().__init__(
         parent=parent,
         init_channel=pref_dev.substitute(propty_name='STATEMACHINE'),
         color_list=color_list)
示例#19
0
 def __init__(self, parent=None, prefix=VACA_PREFIX):
     """Init."""
     pref_dev = SiriusPVName(EVG_NAME).substitute(prefix=prefix)
     color_list = 7 * [
         self.LightGreen,
     ]
     color_list[0] = self.DarkGreen  # Initializing
     color_list[1] = self.DarkGreen  # Stopped
     color_list[4] = self.Yellow  # Preparing Continuous
     color_list[6] = self.Yellow  # Restarting Continuous
     super().__init__(
         parent=parent,
         init_channel=pref_dev.substitute(propty_name='STATEMACHINE'),
         color_list=color_list)
示例#20
0
    def __init__(self, parent=None, prefix=_vaca_prefix, device=''):
        """Init."""
        BaseObject.__init__(self, prefix)
        SiriusMainWindow.__init__(self, parent)

        self.prefix = prefix
        self.device = SiriusPVName(device)
        self.devpref = self.device.substitute(prefix=prefix)

        self.setObjectName('SIApp')
        self.setWindowTitle(device + ' Orbit Interlock Control Window')

        self._setupUi()

        self.setFocusPolicy(Qt.StrongFocus)
示例#21
0
文件: main.py 项目: lnls-sirius/hla
    def __init__(self, parent=None, prefix=''):
        """Init."""
        super().__init__(parent)
        self._prefix = prefix
        self._inj_dev = SiriusPVName('AS-Glob:AP-InjCtrl')
        self._inj_prefix = self._inj_dev.substitute(prefix=prefix)
        self.setWindowTitle('Injection Controls')
        self.setObjectName('ASApp')
        self.setWindowIcon(
            qta.icon('fa5s.syringe', color=get_appropriate_color('AS')))

        self._setupUi()

        self.setFocus(True)
        self.setFocusPolicy(Qt.StrongFocus)
示例#22
0
    def __init__(self, parent=None, filters=None):
        """Call super and set on/off colors."""
        QLed.__init__(self, parent)
        PyDMWidget.__init__(self)
        self.onColor = PyDMLed.Red
        self.offColor = PyDMLed.LightGreen

        self.prefix = VACA_PREFIX
        self.devname = PVName('LI-01:PS-Spect')
        self.prefixed_name = self.devname.substitute(prefix=self.prefix)
        self.filter = filters

        self.intlkstatus_ch = SiriusConnectionSignal(
            self.prefixed_name.substitute(propty='StatusIntlk-Mon'))
        self.intlkstatus_ch.connection_slot = self.connectionStateChanged
        self.intlkwarn_ch = SiriusConnectionSignal(
            self.prefixed_name.substitute(propty='IntlkWarn-Mon'))
        self.intlkwarn_ch.connection_slot = self.connectionStateChanged
        self.channel = self.intlkstatus_ch.address

        self.intlkwarn_bit = _PSe.LINAC_INTLCK_WARN.index('LoadI Over Thrs')

        self.intlkstatus_val = None
        self.intlkwarn_val = None
        self.intlkstatus_conn = None
        self.intlkwarn_conn = None

        self.intlkstatus_ch.new_value_signal[int].connect(self._update_values)
        self.intlkwarn_ch.new_value_signal[int].connect(self._update_values)
示例#23
0
 def __init__(self, parent, prefix=VACA_PREFIX, **kws):
     init_channel = SiriusPVName(
         'AS-Glob:AP-InjCtrl:InjStatus-Mon').substitute(prefix=prefix)
     self.labels = get_status_labels('Inj')
     super().__init__(parent, init_channel, **kws)
     self.offColor = self.LightGreen
     self.onColor = self.Red
示例#24
0
    def psnames(self, new):
        if not new:
            self._psnames = new
            self._x_data = _np.array([0, ])
            self._tooltips = ['', ]
            self._sector = ''
        else:
            self._x_data = _np.array(_MASearch.get_mapositions(map(
                lambda x: x.substitute(dis='MA'), new)))
            self._psnames = [psn for _, psn in sorted(zip(self._x_data, new))]
            self._x_data = _np.sort(self._x_data)
            self._tooltips = [
                psn.get_nickname(dev=True) for psn in self._psnames]
            self._sector = SiriusPVName(new[0]).sec

        if self._sector == 'TB':
            self._c0 = 21.2477
        elif self._sector == 'TS':
            self._c0 = 26.8933
        elif self._sector == 'BO':
            self._c0 = 496.8
        elif self._sector == 'SI':
            self._c0 = 518.396
        else:
            self._c0 = 1.0

        self.curve.receiveXWaveform(self._x_data)
        self.mean.receiveXWaveform(self._x_data)
示例#25
0
 def set_psnames(self, psnames):
     """Set psnames."""
     self._psnames = _dcopy(psnames)
     if SiriusPVName(self._psnames[0]).dev in ('FCH', 'FCV'):
         self._propsymb_2_defval = _PVHandler.PROPSYMB_2_DEFVAL_FCS
     else:
         self._propsymb_2_defval = _PVHandler.PROPSYMB_2_DEFVAL_DEF
示例#26
0
    def __init__(self, parent=None, init_channel=None, init_tooltip='', **kws):
        super().__init__(parent, **kws)
        self.setToolTip(init_tooltip)
        self.channel = init_channel

        self.pvname = SiriusPVName(self.channels()[0].address)
        dev = self.pvname.device_name

        self.labels = list()
        if self.pvname.dis == 'PS':
            self.labels = get_ps_diag_status_labels(dev)
        elif self.pvname.sec == 'LI':
            self.labels = get_li_diag_status_labels(dev)
        elif self.pvname.dis == 'PU':
            self.labels = get_pu_diag_status_labels()
        elif self.pvname.dis == 'RF':
            self.labels = get_rf_diag_status_labels(dev)

        self.dc_command = ''
        if dev.dis == 'PS':
            self.dc_command = ['sirius-hla-as-ps-detail.py', dev]
        elif dev.dis == 'PU':
            if dev.sec == 'LI':
                self.dc_command = 'sirius-hla-li-pu-modltr.py'
            else:
                self.dc_command = ['sirius-hla-as-pu-detail.py', dev]
        elif dev.dis == 'RF':
            if dev.sec == 'LI':
                self.dc_command = 'sirius-hla-li-rf-llrf.py'
            else:
                sec = self.pvname.sec.lower()
                self.dc_command = 'sirius-hla-'+sec+'-rf-control.py'
        elif dev.dis == 'EG':
            self.dc_command = 'sirius-hla-li-eg-control.py'
示例#27
0
        def _create_id_menu(self):
            menu = LEVEL1('ID', self)
            menu.setObjectName('IDApp')

            All = LEVEL2A('All', menu)
            self.connect_newprocess(All,
                                    ['sirius-hla-si-id-control.py', '-isall'])
            self.add_object_to_level1(menu, All)

            idlist = [
                'SI-06SB:ID-APU22', 'SI-07SP:ID-APU22', 'SI-08SB:ID-APU22',
                'SI-09SA:ID-APU22', 'SI-11SP:ID-APU58'
            ]
            for idname in idlist:
                idname = SiriusPVName(idname)
                beamline = IDSearch.conv_idname_2_beamline(idname)
                text = '{0} - {1} ({2})'.format(
                    idname.dev, idname.sub, beamline) \
                    if LEVEL2A == QAction else beamline
                APU = LEVEL2A(text, menu)
                self.connect_newprocess(
                    APU, ['sirius-hla-si-id-control.py', '-dev', idname])
                self.add_object_to_level1(menu, APU)

            return menu
def get_all_psnames():
    """."""
    pss = PSSearch()
    # psn = pss.get_psnames() + li_psnames
    psn = pss.get_psnames()
    psnames = [SiriusPVName(psname) for psname in psn]
    return psnames
示例#29
0
 def __init__(self, parent=None, device='', convertion_set=True,
              orientation='V'):
     super().__init__(parent)
     self._dev = SiriusPVName(device)
     self._conv_set = convertion_set
     self._ori = orientation
     self._setupUi()
示例#30
0
 def __init__(self, parent=None, device='', convertion_set=True):
     super().__init__(parent=parent)
     self._dev = SiriusPVName(device)
     sec = 'ID' if 'BL' in self._dev else self._dev.sec
     self._conv_set = convertion_set
     self.setObjectName(sec+'App')
     self._setupui()