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)
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()
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()
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)
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
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()
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)
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
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()
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)
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()
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
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
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 __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'
def _setupStrengthWidget(self): scrollarea = QScrollArea() self.nconfig_data = QWidget() flay_configdata = QFormLayout() psnames = self._get_PSNames() self._map_psnames2wigdets = dict() for ps in psnames: ps = SiriusPVName(ps) if ps in ramp.BoosterRamp.PSNAME_DIPOLES: ps_value = QLabel(str(self.norm_config[ps])+' GeV', self) flay_configdata.addRow(QLabel(ps + ': ', self), ps_value) else: ps_value = QDoubleSpinBoxPlus(self.nconfig_data) ps_value.setDecimals(6) ps_value.setMinimum(-10000) ps_value.setMaximum(10000) ps_value.setValue(self.norm_config[ps]) ps_value.valueChanged.connect(self._handleStrenghtsSet) if ps.dev in {'QD', 'QF', 'QS'}: unit_txt = '1/m' elif ps.dev in {'SD', 'SF'}: unit_txt = '1/m²' else: unit_txt = 'urad' label_unit = QLabel(unit_txt, self) label_unit.setStyleSheet("min-width:2.5em; max-width:2.5em;") hb = QHBoxLayout() hb.addWidget(ps_value) hb.addWidget(label_unit) flay_configdata.addRow(QLabel(ps + ': ', self), hb) ps_value.setObjectName(ps) ps_value.setStyleSheet("min-height:1.29em; max-height:1.29em;") self._map_psnames2wigdets[ps] = ps_value self.nconfig_data.setObjectName('data') self.nconfig_data.setStyleSheet(""" #data{background-color: transparent;}""") self.nconfig_data.setLayout(flay_configdata) scrollarea.setWidget(self.nconfig_data) self.cb_checklims = QCheckBox('Set limits according to energy', self) self.cb_checklims.setChecked(False) self.cb_checklims.stateChanged.connect(self._handleStrengtsLimits) self.bt_graph = QPushButton(qta.icon('mdi.chart-line'), '', self) self.bt_graph.clicked.connect(self._show_kicks_graph) gbox = QGroupBox() gbox.setObjectName('strengths') gbox.setStyleSheet('#strengths{min-width:20em;}') glay = QGridLayout() glay.addWidget(scrollarea, 0, 0, 1, 2) glay.addWidget(self.cb_checklims, 1, 0, alignment=Qt.AlignLeft) glay.addWidget(self.bt_graph, 1, 1, alignment=Qt.AlignRight) gbox.setLayout(glay) return gbox
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()
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)
def _get_pvname(self, psname, propty): """Get PV name for psname and propty.""" psname = SiriusPVName(psname) if psname.dev in ('FCH', 'FCV'): fofbctl = SiriusPVName('IA-'+psname.sub[:2]+'RaBPM:BS-FOFBCtrl') if propty in ['ACQTriggerRep-Sel', 'ACQTriggerEvent-Sel']: pvname = fofbctl.substitute(prefix=self._prefix, propty=propty) elif 'Current-Mon' in propty: nick = psname.sub[2:] + '-' + psname.dev channel = _PVHandler.CONV_FASTCORR2CHANNEL[nick] propty = 'GENConvArrayDataCH'+str(channel) pvname = fofbctl.substitute(prefix=self._prefix, propty=propty) else: pvname = psname.substitute(prefix=self._prefix, propty=propty) else: pvname = psname.substitute(prefix=self._prefix, propty=propty) return pvname
def __init__(self, parent=None, prefix='', section=''): """Initialize object.""" super().__init__(parent) self.prefix = prefix self.section = section if self.section == 'BO': self._label = 'Booster Ramp' self._pvname = SiriusPVName('BO-Glob:AP-CurrInfo:RampEff-Mon' ).substitute(prefix=self.prefix) else: self._label = 'Injection' self._pvname = SiriusPVName('SI-Glob:AP-CurrInfo:InjEff-Mon' ).substitute(prefix=self.prefix) self._wavEff = list() self._inj_idx = 0 self._eje_idx = -1 self._init_indices = False self._setupUi()
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()
def setupmenus(self): main_menu = self.menuBar() main_menu.setNativeMenuBar(False) icon = qta.icon('mdi.timer', color=get_appropriate_color('AS')) menu = main_menu.addMenu('&Devices') action = menu.addAction('EVG') evg = SiriusPVName(LLTimeSearch.get_evg_name()) Window = create_window_from_widget(_EVG, title=evg, icon=icon) connect_window(action, Window, None, prefix=self.prefix, device=evg) menu_evr = menu.addMenu('EVRs') for evr in LLTimeSearch.get_device_names(filters={'dev': 'EVR'}): action = menu_evr.addAction(evr) Window = create_window_from_widget(_EVR, title=evr, icon=icon) connect_window(action, Window, None, prefix=self.prefix, device=evr) menu_eve = menu.addMenu('EVEs') for eve in LLTimeSearch.get_device_names(filters={'dev': 'EVE'}): action = menu_eve.addAction(eve) Window = create_window_from_widget(_EVE, title=eve, icon=icon) connect_window(action, Window, None, prefix=self.prefix, device=eve) menu_afc = menu.addMenu('AMCs') for afc in LLTimeSearch.get_device_names( filters={'dev': 'AMCFPGAEVR'}): action = menu_afc.addAction(afc) Window = create_window_from_widget(_AFC, title=afc, icon=icon) connect_window(action, Window, None, prefix=self.prefix, device=afc) menu_fout = menu.addMenu('Fouts') for fout in LLTimeSearch.get_device_names(filters={'dev': 'Fout'}): action = menu_fout.addAction(fout) Window = create_window_from_widget(_FOUT, title=fout, icon=icon) connect_window(action, Window, None, prefix=self.prefix, device=fout) action = main_menu.addAction('&Monitor') connect_newprocess(action, ['sirius-hla-as-ti-control.py', '-t', 'monitor'], parent=self, is_window=True)
def _create_pvs(self, propty): new_pvs = dict() for psn in self.BPM_NAMES: pvname = SiriusPVName(psn).substitute(prefix=self._prefix, propty=propty) if pvname in self._pvs: continue new_pvs[pvname] = _PV(pvname, auto_monitor=False, connection_timeout=0.01) self._pvs.update(new_pvs)
def _get_values(self, propty): for psn in self.BPM_NAMES: pvname = SiriusPVName(psn).substitute(prefix=self._prefix, propty=propty) self._pvs[pvname].wait_for_connection() values = list() for psn in self.BPM_NAMES: pvname = SiriusPVName(psn).substitute(prefix=self._prefix, propty=propty) try: val = self._pvs[pvname].get() except ChannelAccessException: val = None if val is None: val = 0 elif propty.startswith('Intlk') and propty.endswith('-Mon'): val = 1 if val == 0 else 0 values.append(val) return values
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;}')
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)
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)
def __init__(self, parent=None, prefix='', device=''): """Initialize.""" super().__init__(parent) self.prefix = prefix self.device = SiriusPVName(device) self.section = self.device.sec self.setObjectName(self.section + 'App') self.setWindowTitle(device) self.setWindowIcon( qta.icon('mdi.current-dc', color=util.get_appropriate_color(self.section))) self._setupUi() self.setFocusPolicy(Qt.StrongFocus)
def __init__(self, parent=None, prefix='', section='', orientation='H', background=None): """Init.""" super().__init__(parent) self.prefix = prefix self.section = section.upper() self.orientation = orientation self.device = SiriusPVName('AC-Glob:DI-Tune-O') self.device = self.device.substitute(sec=self.section, idx=self.orientation, prefix=self.prefix) if self.section == 'BO': self.trigger = SiriusPVName('BO-Glob:TI-TuneProc') self.background = background self.setWindowTitle(self.device + ' Detailed Settings') self.setObjectName(self.section + 'App') self._setupUi() self.setFocusPolicy(Qt.StrongFocus)
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)