def _setupCoeffSettingsWidget(self): ld_coefchoo = QLabel('Choose Set', self, alignment=Qt.AlignRight) cb_coefchoo = PyDMEnumComboBox(self, self.dev_pref + ':LDSET') pb_coefload = PyDMPushButton(parent=self, label='Apply Set', icon=qta.icon('mdi.upload'), init_channel=self.dev_pref + ':BO_CPCOEFF', pressValue=1) pb_coefload.setStyleSheet("icon-size:20px;") pb_coefvrfy = PyDMPushButton(parent=self, label='Verify Set', icon=qta.icon('mdi.check-circle-outline'), init_channel=self.dev_pref + ':BO_CVERIFY', pressValue=1) pb_coefvrfy.setStyleSheet("icon-size:20px;") ld_gen = QLabel('<h4>Generate Coefficients</h4>', self, alignment=Qt.AlignCenter) ld_gengain = QLabel('Gain [0-1]', self, alignment=Qt.AlignRight) sb_gengain = PyDMSpinbox(self, self.dev_pref + ':FLT_GAIN') sb_gengain.showStepExponent = False ld_genphs = QLabel('Phase [°]', self, alignment=Qt.AlignRight) sb_genphs = PyDMSpinbox(self, self.dev_pref + ':FLT_PHASE') sb_genphs.showStepExponent = False ld_genfreq = QLabel('Frequency [0-1]', self, alignment=Qt.AlignRight) sb_genfreq = PyDMSpinbox(self, self.dev_pref + ':FLT_FREQ') sb_genfreq.showStepExponent = False ld_genntap = QLabel('Number of taps', self, alignment=Qt.AlignRight) sb_genntap = PyDMSpinbox(self, self.dev_pref + ':FLT_TAPS') sb_genntap.showStepExponent = False wid = QWidget(self) lay_genset = QGridLayout(wid) lay_genset.setVerticalSpacing(6) lay_genset.setHorizontalSpacing(9) lay_genset.addWidget(ld_gen, 0, 1, 1, 2) lay_genset.addWidget(ld_gengain, 1, 1) lay_genset.addWidget(sb_gengain, 1, 2) lay_genset.addWidget(ld_genphs, 2, 1) lay_genset.addWidget(sb_genphs, 2, 2) lay_genset.addWidget(ld_genfreq, 3, 1) lay_genset.addWidget(sb_genfreq, 3, 2) lay_genset.addWidget(ld_genntap, 4, 1) lay_genset.addWidget(sb_genntap, 4, 2) lay_genset.addWidget(ld_coefchoo, 5, 1) lay_genset.addWidget(cb_coefchoo, 5, 2) lay = QGridLayout() lay_genset.addLayout(lay, 6, 1, 1, 2) lay.addWidget(pb_coefload, 0, 0) lay.addWidget(pb_coefvrfy, 0, 2) lay.setColumnStretch(1, 2) lay_genset.setRowStretch(7, 2) lay_genset.setColumnStretch(0, 2) lay_genset.setColumnStretch(3, 2) return wid
def _setupFBSettingsWidget(self): gbox_settings = QGroupBox('FeedBack Settings', self) ld_fbpatt = QLabel('Feedback Mask', self) le_fbpatt = PyDMLineEdit(self, self.dev_pref + ':FB_PATTERN') ld_cfpatt = QLabel('Alternate Mask', self) le_cfpatt = PyDMLineEdit(self, self.dev_pref + ':CF_PATTERN') ld_alter_inuse = QLabel('Alternate Set In Use', self) led_alter_inuse = SiriusLedState( self, self.dev_pref + ':CF_PATTERN_SUB.VALB') ld_fbenbl = QLabel('Enable', self) pb_fbenbl = PyDMStateButton(self, self.dev_pref + ':FBCTRL') ld_coefsel = QLabel('Coeficient Set', self) cb_coefsel = PyDMEnumComboBox(self, self.dev_pref + ':SETSEL') ld_sftgain = QLabel('Shift Gain', self) sb_sftgain = PyDMSpinbox(self, self.dev_pref + ':SHIFTGAIN') sb_sftgain.showStepExponent = False ld_downspl = QLabel('Downsampling', self) sb_downspl = PyDMSpinbox(self, self.dev_pref + ':PROC_DS') sb_downspl.showStepExponent = False ld_satthrs = QLabel('Sat. Threshold [%]', self) sb_satthrs = PyDMSpinbox(self, self.dev_pref + ':SAT_THRESHOLD') sb_satthrs.showStepExponent = False lay_patt = QGridLayout() lay_patt.addWidget(ld_fbpatt, 0, 0) lay_patt.addWidget(le_fbpatt, 0, 1) lay_patt.addWidget(ld_cfpatt, 1, 0) lay_patt.addWidget(le_cfpatt, 1, 1) lay_patt.addWidget(ld_alter_inuse, 2, 0) lay_patt.addWidget(led_alter_inuse, 2, 1) lay = QGridLayout(gbox_settings) lay.addWidget(ld_fbenbl, 0, 1) lay.addWidget(pb_fbenbl, 0, 2) lay.addWidget(ld_downspl, 0, 4) lay.addWidget(sb_downspl, 0, 5) lay.addWidget(ld_coefsel, 1, 1) lay.addWidget(cb_coefsel, 1, 2) lay.addWidget(ld_sftgain, 1, 4) lay.addWidget(sb_sftgain, 1, 5) lay.addWidget(ld_satthrs, 2, 1) lay.addWidget(sb_satthrs, 2, 2) lay.addLayout(lay_patt, 4, 1, 1, 5) lay.setColumnStretch(0, 3) lay.setColumnStretch(6, 3) lay.setColumnStretch(3, 2) lay.setRowStretch(3, 2) lay.setRowStretch(5, 3) return gbox_settings
def _setupBCSettingsWidget(self): gbox_settings = QGroupBox('Bunch Cleaning Settings', self) ld_bcenbl = QLabel('Enable', self) cb_bcenbl = PyDMStateButton(self, self.dev_pref + ':CLEAN_ENABLE') ld_bcamp = QLabel('Amplitude', self) sb_bcamp = PyDMSpinbox(self, self.dev_pref + ':CLEAN_AMPL') sb_bcamp.showStepExponent = False lb_svamp = PyDMLabel(self, self.dev_pref + ':CLEAN_SAVE_AMPL') ld_bctune = QLabel('Tune', self) sb_bctune = PyDMSpinbox(self, self.dev_pref + ':CLEAN_TUNE') sb_bctune.showStepExponent = False lb_svfreq = PyDMLabel(self, self.dev_pref + ':CLEAN_SAVE_FREQ') ld_bcspan = QLabel('Span', self) le_bcspan = PyDMLineEdit(self, self.dev_pref + ':CLEAN_SPAN') lb_svspan = PyDMLabel(self, self.dev_pref + ':CLEAN_SAVE_SPAN') ld_bcper = QLabel('Period', self) le_bcper = PyDMLineEdit(self, self.dev_pref + ':CLEAN_PERIOD') lb_svper = PyDMLabel(self, self.dev_pref + ':CLEAN_SAVE_PERIOD') ld_bcpatt = QLabel('Mask', self) le_bcpatt = PyDMLineEdit(self, self.dev_pref + ':CLEAN_PATTERN') lay_clean = QGridLayout(gbox_settings) lay_clean.addWidget(QLabel('SAVED VALS.'), 0, 2) lay_clean.addWidget(ld_bcamp, 1, 0) lay_clean.addWidget(sb_bcamp, 1, 1) lay_clean.addWidget(lb_svamp, 1, 2) lay_clean.addWidget(ld_bctune, 2, 0) lay_clean.addWidget(sb_bctune, 2, 1) lay_clean.addWidget(lb_svfreq, 2, 2) lay_clean.addWidget(ld_bcspan, 3, 0) lay_clean.addWidget(le_bcspan, 3, 1) lay_clean.addWidget(lb_svspan, 3, 2) lay_clean.addWidget(ld_bcper, 4, 0) lay_clean.addWidget(le_bcper, 4, 1) lay_clean.addWidget(lb_svper, 4, 2) lay_clean.addWidget(ld_bcenbl, 5, 0) lay_clean.addWidget(cb_bcenbl, 5, 1) lay = QGridLayout() lay.addWidget(ld_bcpatt, 0, 0) lay.addWidget(le_bcpatt, 0, 1) lay_clean.addLayout(lay, 6, 0, 1, 3) return gbox_settings
def _setupFeedbackSettings(self): ld_fbenbl = QLabel('Enable', self) pb_fbenbl = PyDMStateButton(self, self.dev_pref+':FBCTRL') ld_coefsel = QLabel('Coeficient Set', self) cb_coefsel = PyDMEnumComboBox(self, self.dev_pref+':SETSEL') ld_sftgain = QLabel('Shift Gain', self) sb_sftgain = PyDMSpinbox(self, self.dev_pref+':SHIFTGAIN') sb_sftgain.showStepExponent = False ld_downspl = QLabel('Downsampling', self) sb_downspl = PyDMSpinbox(self, self.dev_pref+':PROC_DS') sb_downspl.showStepExponent = False ld_satthrs = QLabel('Sat. Threshold [%]', self) sb_satthrs = PyDMSpinbox(self, self.dev_pref+':SAT_THRESHOLD') sb_satthrs.showStepExponent = False lay = QGridLayout() lay.addWidget(ld_fbenbl, 1, 0) lay.addWidget(pb_fbenbl, 1, 1) lay.addWidget(ld_coefsel, 2, 0) lay.addWidget(cb_coefsel, 2, 1) lay.addWidget(ld_sftgain, 3, 0) lay.addWidget(sb_sftgain, 3, 1) lay.addWidget(ld_downspl, 4, 0) lay.addWidget(sb_downspl, 4, 1) lay.addWidget(ld_satthrs, 5, 0) lay.addWidget(sb_satthrs, 5, 1) if self._is_resumed: wid = QWidget() wid.setLayout(lay) fb_label = QLabel( '<h4>Feedback Settings</h4>', self, alignment=Qt.AlignCenter) lay.setContentsMargins(0, 0, 0, 0) lay.setVerticalSpacing(12) lay.addWidget(fb_label, 0, 0, 1, 2) else: wid = QGroupBox('Feedback Settings', self) wid.setLayout(lay) ld_gensts = QLabel('Setup Status', self) led_gensts = SiriusLedAlert(self, self.dev_pref+':ERRSUM') lay.addWidget(ld_gensts, 6, 0) lay.addWidget(led_gensts, 6, 1) return wid
def _setupPhaseServoLoopWidget(self): # # Phase Servo Loop ld_gpiolctrl = QLabel('Loop Ctrl', self) cb_gpiolctrl = PyDMStateButton(self, self.dev_pref + ':FBELT_SERVO_MODE') ld_gpiolsign = QLabel('Loop Sign', self) cb_gpiolsign = PyDMEnumComboBox(self, self.dev_pref + ':FBELT_SERVO_SIGN') ld_gpiogain = QLabel('Gain', self) sb_gpiogain = PyDMSpinbox(self, self.dev_pref + ':FBELT_SERVO_GAIN') sb_gpiogain.showStepExponent = False ld_gpiooff = QLabel('Offset', self) sb_gpiooff = PyDMSpinbox(self, self.dev_pref + ':FBELT_SERVO_OFFSET') sb_gpiooff.showStepExponent = False ld_gpiohtrk = QLabel('Hor. Trk.', self) cb_gpiohtrk = PyDMStateButton(self, self.dev_pref + ':FBELT_SERVO_X_TRACK') ld_gpiovtrk = QLabel('Vert. Trk.', self) cb_gpiovtrk = PyDMStateButton(self, self.dev_pref + ':FBELT_SERVO_Y_TRACK') gbox_phsloop = QGroupBox('Phase Servo Loop', self) lay_phsloop = QGridLayout(gbox_phsloop) lay_phsloop.addWidget(ld_gpiolctrl, 0, 0) lay_phsloop.addWidget(cb_gpiolctrl, 0, 1) lay_phsloop.addWidget(ld_gpiolsign, 1, 0) lay_phsloop.addWidget(cb_gpiolsign, 1, 1) lay_phsloop.addWidget(ld_gpiogain, 2, 0) lay_phsloop.addWidget(sb_gpiogain, 2, 1) lay_phsloop.addWidget(ld_gpiooff, 3, 0) lay_phsloop.addWidget(sb_gpiooff, 3, 1) lay_phsloop.addWidget(ld_gpiohtrk, 4, 0) lay_phsloop.addWidget(cb_gpiohtrk, 4, 1) lay_phsloop.addWidget(ld_gpiovtrk, 5, 0) lay_phsloop.addWidget(cb_gpiovtrk, 5, 1) return gbox_phsloop
def _setupMeasSettingsWidget(self, mode): if mode == 'Normal': prefix = self.dcct_prefix visible = True elif mode == 'Fast': prefix = self.dcct_prefix.substitute(propty_name=mode) visible = False l_smpcnt = QLabel('Sample Count: ', self) spinbox_SampleCnt = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-SP')) spinbox_SampleCnt.showStepExponent = False label_SampleCnt = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-RB')) hlay_smpcnt = QHBoxLayout() hlay_smpcnt.addWidget(spinbox_SampleCnt) hlay_smpcnt.addWidget(label_SampleCnt) l_measperiod = QLabel('Period [s]: ', self) spinbox_MeasPeriod = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-SP')) spinbox_MeasPeriod.showStepExponent = False label_MeasPeriod = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-RB')) hlay_measperiod = QHBoxLayout() hlay_measperiod.addWidget(spinbox_MeasPeriod) hlay_measperiod.addWidget(label_MeasPeriod) flay_modesettings = QFormLayout() flay_modesettings.addRow(l_smpcnt, hlay_smpcnt) flay_modesettings.addRow(l_measperiod, hlay_measperiod) flay_modesettings.setContentsMargins(0, 0, 0, 0) modesettings = QWidget(self) modesettings.setLayout(flay_modesettings) modesettings.setVisible(visible) return modesettings
def getTempWidget(self, pv_name, temp_type): ''' Display the temperature label widget ''' device_name = self.getDeviceName(pv_name) if temp_type == 'Thrd': widget = PyDMSpinbox(parent=self, init_channel=device_name + pv_name + temp_type) widget.showStepExponent = False else: widget = PyDMLabel(parent=self, init_channel=device_name + pv_name + temp_type) widget.showUnits = True return widget
def _setupDeltaControlLayout(self, axis=''): # pos label_pos = QLabel("<h4>Δ"+axis+"</h4>", self) sb_deltapos = PyDMSpinbox(self, self.posang_prefix.substitute( propty='DeltaPos'+axis.upper()+'-SP')) sb_deltapos.step_exponent = -2 sb_deltapos.update_step_size() sb_deltapos.showStepExponent = False lb_deltapos = PyDMLabel(self, self.posang_prefix.substitute( propty='DeltaPos'+axis.upper()+'-RB')) lb_deltapos.showUnits = True self._my_input_widgets.append(sb_deltapos) # ang label_ang = QLabel("<h4>Δ"+axis+"'</h4>", self) sb_deltaang = PyDMSpinbox(self, self.posang_prefix.substitute( propty='DeltaAng'+axis.upper()+'-SP')) sb_deltaang.step_exponent = -2 sb_deltaang.update_step_size() sb_deltaang.showStepExponent = False lb_deltaang = PyDMLabel(self, self.posang_prefix.substitute( propty='DeltaAng'+axis.upper()+'-RB')) lb_deltaang.showUnits = True self._my_input_widgets.append(sb_deltaang) lay = QGridLayout() lay.setVerticalSpacing(12) lay.setHorizontalSpacing(12) lay.addItem( QSpacerItem(10, 0, QSzPlcy.Expanding, QSzPlcy.Ignored), 0, 0) lay.addWidget(label_pos, 0, 1) lay.addWidget(sb_deltapos, 0, 2) lay.addWidget(lb_deltapos, 0, 3) lay.addWidget(label_ang, 1, 1) lay.addWidget(sb_deltaang, 1, 2) lay.addWidget(lb_deltaang, 1, 3) lay.addItem( QSpacerItem(10, 0, QSzPlcy.Expanding, QSzPlcy.Ignored), 0, 4) return lay
def _setupOtherControlsWidget(self): # # FBE ld_gpiomode = QLabel('Mode', self) cb_gpiomode = PyDMStateButton(self, self.dev_pref + ':FBELT_FAN_MODE') ld_gpiofanspd = QLabel('Fan Speed', self) lb_gpiofanspd = PyDMLabel(self, self.dev_pref + ':FBE_FANMON') lb_gpiofanspd.showUnits = True ld_gpiotempsp = QLabel('Temperature Setpoint', self) sb_gpiotempsp = PyDMSpinbox(self, self.dev_pref + ':FBELT_FAN_SETPT') sb_gpiotempsp.showStepExponent = False gbox_fbe = QGroupBox('Fan Control', self) lay_fbe = QGridLayout(gbox_fbe) lay_fbe.addWidget(ld_gpiomode, 0, 0) lay_fbe.addWidget(cb_gpiomode, 0, 1) lay_fbe.addWidget(ld_gpiofanspd, 1, 0) lay_fbe.addWidget(lb_gpiofanspd, 1, 1) lay_fbe.addWidget(ld_gpiotempsp, 2, 0) lay_fbe.addWidget(sb_gpiotempsp, 2, 1) return gbox_fbe
def _setupMonitorsWidget(self): # # ADC Average si_gpioadcav = MyScaleIndicator(self, self.dev_pref + ':CIC_MEAN') si_gpioadcav.setObjectName('si') si_gpioadcav.setStyleSheet('#si{min-height: 4em;}') gbox_adcav = QGroupBox('ADC Average', self) lay_adcav = QGridLayout(gbox_adcav) lay_adcav.addWidget(si_gpioadcav) # # Phase servo output si_gpioservodlt = MyScaleIndicator( self, self.dev_pref + ':FBELT_SERVO_DELTA') ld_gpioservomax = QLabel('<h4>Max</h4>', self, alignment=Qt.AlignCenter) sb_gpioservomax = PyDMSpinbox(self, self.dev_pref + ':FBELT_SERVO_MAXDELTA') sb_gpioservomax.showStepExponent = False gbox_phsout = QGroupBox('Phase Servo Output', self) lay_phsout = QGridLayout(gbox_phsout) lay_phsout.addWidget(si_gpioservodlt, 0, 0, 2, 1) lay_phsout.addWidget(ld_gpioservomax, 0, 1, alignment=Qt.AlignBottom) lay_phsout.addWidget(sb_gpioservomax, 1, 1, alignment=Qt.AlignTop) lay_phsout.setColumnStretch(0, 4) lay_phsout.setColumnStretch(1, 1) wid = QWidget() lay = QHBoxLayout(wid) lay.setContentsMargins(0, 0, 0, 0) lay.addWidget(gbox_adcav) lay.addWidget(gbox_phsout) lay.setStretch(0, 4) lay.setStretch(1, 5) return wid
def _setupUi(self): ld_maindev = QLabel('<h3>General Settings</h3>', self, alignment=Qt.AlignCenter) # # Delay Lines ld_adcclock = QLabel('ADC Clock', self) sb_adcclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL0') sb_adcclock.showStepExponent = False fr_adcclock = SiriusFrame(self, self.dev_pref + ':ECLDEL0_SUBWR') fr_adcclock.add_widget(sb_adcclock) ld_fidclock = QLabel('Fiducial Clock', self) sb_fidclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL1') sb_fidclock.showStepExponent = False fr_fidclock = SiriusFrame(self, self.dev_pref + ':ECLDEL1_SUBWR') fr_fidclock.add_widget(sb_fidclock) ld_fiducial = QLabel('Fiducial', self) sb_fiducial = PyDMSpinbox(self, self.dev_pref + ':ECLDEL2') sb_fiducial.showStepExponent = False fr_fiducial = SiriusFrame(self, self.dev_pref + ':ECLDEL2_SUBWR') fr_fiducial.add_widget(sb_fiducial) ld_dacclock = QLabel('DAC Clock', self) sb_dacclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL3') sb_dacclock.showStepExponent = False fr_dacclock = SiriusFrame(self, self.dev_pref + ':ECLDEL3_SUBWR') fr_dacclock.add_widget(sb_dacclock) gbox_delaylines = QGroupBox('Delay lines', self) lay_delaylines = QGridLayout(gbox_delaylines) lay_delaylines.addWidget(ld_adcclock, 0, 0) lay_delaylines.addWidget(fr_adcclock, 0, 1) lay_delaylines.addWidget(ld_fidclock, 1, 0) lay_delaylines.addWidget(fr_fidclock, 1, 1) lay_delaylines.addWidget(ld_fiducial, 2, 0) lay_delaylines.addWidget(fr_fiducial, 2, 1) lay_delaylines.addWidget(ld_dacclock, 3, 0) lay_delaylines.addWidget(fr_dacclock, 3, 1) # # Thresholds and offsets ld_lvl = QLabel('<h4>Level</h4>', self, alignment=Qt.AlignCenter) ld_enbl = QLabel('<h4>Enbl</h4>', self, alignment=Qt.AlignCenter) ld_v = QLabel('<h4>V</h4>', self, alignment=Qt.AlignCenter) ld_edge = QLabel('<h4>Edge</h4>', self, alignment=Qt.AlignCenter) ld_fid = QLabel('Fiducial', self) cb_fidlvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_FID') cb_fidlvlenbl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_FID_ENABLE') cb_fidlvlenbl.setStyleSheet('max-width:3em;') sb_fidv = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH9') sb_fidv.showStepExponent = False sb_fidv.showUnits = True fr_fidv = SiriusFrame(self, self.dev_pref + ':AD5644CH9_SUBWR') fr_fidv.add_widget(sb_fidv) ld_trg1 = QLabel('Trigger 1', self) cb_trg1lvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_TRIG1') cb_trg1lvlenbl = PyDMEnumComboBox( self, self.dev_pref + ':LEVEL_TRIG1_ENABLE') cb_trg1lvlenbl.setStyleSheet('max-width:3em;') sb_trg1lvlv = PyDMSpinbox(self, self.dev_pref + ':LEVEL_VTRIG1') sb_trg1lvlv.showStepExponent = False sb_trg1lvlv.showUnits = True fr_trg1lvlv = SiriusFrame(self, self.dev_pref + ':AD5644CH10_SUBWR') fr_trg1lvlv.add_widget(sb_trg1lvlv) cb_trg1edge = PyDMEnumComboBox(self, self.dev_pref + ':TRIG1INV') cb_trg1edge.setStyleSheet('max-width:3.2em;') ld_trg2 = QLabel('Trigger 2', self) cb_trg2lvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_TRIG2') cb_trg2lvlenbl = PyDMEnumComboBox( self, self.dev_pref + ':LEVEL_TRIG2_ENABLE') cb_trg2lvlenbl.setStyleSheet('max-width:3em;') sb_trg2lvlv = PyDMSpinbox(self, self.dev_pref + ':LEVEL_VTRIG2') sb_trg2lvlv.showStepExponent = False sb_trg2lvlv.showUnits = True fr_trg2lvlv = SiriusFrame(self, self.dev_pref + ':AD5644CH8_SUBWR') fr_trg2lvlv.add_widget(sb_trg2lvlv) cb_trg2edge = PyDMEnumComboBox(self, self.dev_pref + ':TRIG2INV') cb_trg2edge.setStyleSheet('max-width:3.2em;') ld_dacoff = QLabel('DAC Offset', self) sb_dacoff = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH11') sb_dacoff.showStepExponent = False sb_dacoff.showUnits = True fr_dacoff = SiriusFrame(self, self.dev_pref + ':AD5644CH11_SUBWR') fr_dacoff.add_widget(sb_dacoff) gbox_thoff = QGroupBox('Thresholds and Offsets', self) lay_thoff = QGridLayout(gbox_thoff) lay_thoff.addWidget(ld_lvl, 0, 1) lay_thoff.addWidget(ld_enbl, 0, 2) lay_thoff.addWidget(ld_v, 0, 3) lay_thoff.addWidget(ld_edge, 0, 4) lay_thoff.addWidget(ld_fid, 1, 0) lay_thoff.addWidget(cb_fidlvl, 1, 1) lay_thoff.addWidget(cb_fidlvlenbl, 1, 2) lay_thoff.addWidget(fr_fidv, 1, 3) lay_thoff.addWidget(ld_trg1, 2, 0) lay_thoff.addWidget(cb_trg1lvl, 2, 1) lay_thoff.addWidget(cb_trg1lvlenbl, 2, 2) lay_thoff.addWidget(fr_trg1lvlv, 2, 3) lay_thoff.addWidget(cb_trg1edge, 2, 4) lay_thoff.addWidget(ld_trg2, 3, 0) lay_thoff.addWidget(cb_trg2lvl, 3, 1) lay_thoff.addWidget(cb_trg2lvlenbl, 3, 2) lay_thoff.addWidget(fr_trg2lvlv, 3, 3) lay_thoff.addWidget(cb_trg2edge, 3, 4) lay_thoff.addWidget(ld_dacoff, 4, 0) lay_thoff.addWidget(fr_dacoff, 4, 3) lay_thoff.setColumnStretch(0, 3) lay_thoff.setColumnStretch(1, 2) lay_thoff.setColumnStretch(2, 1) lay_thoff.setColumnStretch(3, 5) lay_thoff.setColumnStretch(4, 1) # # FIR ld_sfir = QLabel('Shaper FIR ([C0 2^17 C2])', self) ld_firc0 = QLabel('C0', self) sb_firc0 = PyDMSpinbox(self, self.dev_pref + ':SHAPE_C0') sb_firc0.showStepExponent = False fr_firc0 = SiriusFrame(self, self.dev_pref + ':SHAPE_C0_SUBWR') fr_firc0.add_widget(sb_firc0) ld_firc2 = QLabel('C2', self) sb_firc2 = PyDMSpinbox(self, self.dev_pref + ':SHAPE_C2') sb_firc2.showStepExponent = False fr_firc2 = SiriusFrame(self, self.dev_pref + ':SHAPE_C2_SUBWR') fr_firc2.add_widget(sb_firc2) lay_fir = QHBoxLayout() lay_fir.addStretch() lay_fir.addWidget(ld_sfir) lay_fir.addStretch() lay_fir.addWidget(ld_firc0) lay_fir.addWidget(fr_firc0) lay_fir.addStretch() lay_fir.addWidget(ld_firc2) lay_fir.addWidget(fr_firc2) lay_fir.addStretch() lay = QGridLayout(self) lay.addWidget(ld_maindev, 0, 1, 1, 2) lay.addWidget(gbox_delaylines, 1, 1) lay.addWidget(gbox_thoff, 1, 2) lay.addLayout(lay_fir, 2, 1, 1, 2) lay.setColumnStretch(0, 3) lay.setColumnStretch(3, 3) lay.setRowStretch(3, 3) self.setStyleSheet("""SiriusFrame{max-height: 1.8em;}""")
def _setupUi(self): if self._driver_num is None: ld_drive = QLabel( '<h3>Drive Pattern Generator</h3>', self, alignment=Qt.AlignCenter) else: ld_drive = QWidget(self) ld_drive.setLayout(QHBoxLayout()) labd = QLabel( f'<h3>Driver {self._driver_num:d}, NCO BITS: </h3>', ld_drive, alignment=Qt.AlignRight) labd.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) lab = PyDMLabel( ld_drive, self.dev_pref+'BITS') lab.setStyleSheet('font-size: 13pt; font-weight: bold;') lab.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) ld_drive.layout().addStretch() ld_drive.layout().addWidget(labd) ld_drive.layout().addWidget(lab) ld_drive.layout().addStretch() ld_amp = QLabel('Amplitude', self) sb_amp = PyDMSpinbox(self, self.dev_pref+'AMPL') sb_amp.showStepExponent = False ld_freq = QLabel('Frequency', self) sb_freq = PyDMSpinbox(self, self.dev_pref+'FREQ') sb_freq.showStepExponent = False ld_wav = QLabel('Waveform', self) cb_wav = PyDMEnumComboBox(self, self.dev_pref+'WAVEFORM') ld_tmod = QLabel('Time MODulation', self) cb_tmod = PyDMStateButton(self, self.dev_pref+'MOD') ld_span = QLabel('Span', self) sb_span = PyDMSpinbox(self, self.dev_pref+'SPAN') sb_span.showStepExponent = False ld_perd = QLabel('Period', self) sb_perd = PyDMSpinbox(self, self.dev_pref+'PERIOD') sb_perd.showStepExponent = False ld_patt = QLabel('Drive Pattern', self) le_patt = PyDMLineEdit(self, self.dev_pref+'PATTERN') lb_actfreq = PyDMLabel(self, self.dev_pref+'FREQ_ACT_STRING') lb_actspan = PyDMLabel(self, self.dev_pref+'SPAN_ACT_STRING') lb_actperd = PyDMLabel(self, self.dev_pref+'PERIOD_ACT') lay = QGridLayout(self) lay.addWidget(ld_drive, 0, 1, 1, 3) lay.addWidget(ld_tmod, 2, 1) lay.addWidget(cb_tmod, 2, 2) lay.addWidget(ld_amp, 3, 1) lay.addWidget(sb_amp, 3, 2) lay.addWidget(ld_freq, 4, 1) lay.addWidget(lb_actfreq, 4, 3) lay.addWidget(sb_freq, 4, 2) lay.addWidget(ld_wav, 5, 1) lay.addWidget(cb_wav, 5, 2) lay.addWidget(ld_span, 6, 1) lay.addWidget(sb_span, 6, 2) lay.addWidget(lb_actspan, 6, 3) lay.addWidget(ld_perd, 7, 1) lay.addWidget(sb_perd, 7, 2) lay.addWidget(lb_actperd, 7, 3) lay.addWidget(ld_patt, 8, 1) lay.addWidget(le_patt, 8, 2, 1, 2) lay.addItem(QSpacerItem(1, 10), 9, 1) lay.addItem(QSpacerItem(1, 10), 13, 1) if self._driver_num in {None, 1}: pixmap = QPixmap(_os.path.join( _os.path.abspath(_os.path.dirname(__file__)), 'drive.png')) il_drive = QLabel(self) il_drive.setPixmap(pixmap) il_drive.setScaledContents(True) lay.addWidget(il_drive, 14, 1, 1, 3, alignment=Qt.AlignCenter) else: wid = QWidget(self) wid.setLayout(QHBoxLayout()) wid.layout().addStretch() propty = f':PHTRK_LOOPCTRL{self._driver_num:d}' pv = self._prefix + self._device + propty lab = SiriusLabel(self, init_channel=pv) lab.enum_strings = ['Tracking Off', 'Tracking On'] lab.displayFormat = lab.DisplayFormat.String frame = SiriusFrame(self, pv, is_float=True) frame.borderWidth = 2 frame.add_widget(lab) wid.layout().addWidget(frame) wid.layout().addStretch() lab = QLabel('Track. Freq: ', self) wid.layout().addWidget(lab) propty = f':PHTRK_FREQ{self._driver_num:d}' pv = self._prefix + self._device + propty freq = PyDMLabel(self, init_channel=pv) wid.layout().addWidget(freq) wid.layout().addStretch() lay.addWidget(wid, 14, 1, 1, 3) lay.setRowStretch(15, 5) lay.setColumnStretch(0, 5) lay.setColumnStretch(4, 5)
def _setupControlsWidget(self): ld_acqtime = QLabel('Acquisition Time [ms]', self) sb_acqtime = PyDMSpinbox(self, self.dev_pref + ':SB_ACQTIME') sb_acqtime.showStepExponent = False ld_bunid = QLabel('Bunch Number', self) sb_bunid = PyDMSpinbox(self, self.dev_pref + ':SB_BUNCH_ID') sb_bunid.showStepExponent = False ld_acqsmpl = QLabel('Acq Samples', self) lb_acqsmpl = PyDMLabel(self, self.dev_pref + ':SB_ACQ_SAMPLES') ld_currbun = QLabel('Current Bunch', self) lb_currbun = PyDMLabel(self, self.dev_pref + ':SB_RAW_BUNCH_ID') gbox_dtacq = QGroupBox('Data Acquisition', self) lay_dtacq = QGridLayout(gbox_dtacq) lay_dtacq.addWidget(ld_acqtime, 0, 0) lay_dtacq.addWidget(sb_acqtime, 0, 1) lay_dtacq.addWidget(ld_bunid, 1, 0) lay_dtacq.addWidget(sb_bunid, 1, 1) lay_dtacq.addWidget(ld_acqsmpl, 2, 0) lay_dtacq.addWidget(lb_acqsmpl, 2, 1) lay_dtacq.addWidget(ld_currbun, 3, 0) lay_dtacq.addWidget(lb_currbun, 3, 1) ld_trgexten = QLabel('Internal/External', self) cb_trgexten = PyDMEnumComboBox(self, self.dev_pref + ':SB_EXTEN') ld_trginsel = QLabel('Selection', self) cb_trginsel = PyDMEnumComboBox(self, self.dev_pref + ':SB_TRIG_IN_SEL') ld_trgarm = QLabel('Arm', self) cb_trgarm = PyDMStateButton(self, self.dev_pref + ':SB_ARM') lb_armmon = SiriusLedState(self, self.dev_pref + ':SB_ARM_MON') ld_trgbrarm = QLabel('Auto re-arm', self) cb_trgbrarm = PyDMStateButton(self, self.dev_pref + ':SB_BR_ARM') gbox_trig = QGroupBox('Trigger', self) lay_trig = QGridLayout(gbox_trig) lay_trig.addWidget(ld_trgexten, 0, 0) lay_trig.addWidget(cb_trgexten, 0, 1, 1, 2) lay_trig.addWidget(ld_trginsel, 1, 0) lay_trig.addWidget(cb_trginsel, 1, 1, 1, 2) lay_trig.addWidget(ld_trgarm, 2, 0) lay_trig.addWidget(cb_trgarm, 2, 1) lay_trig.addWidget(lb_armmon, 2, 2) lay_trig.addWidget(ld_trgbrarm, 3, 0) lay_trig.addWidget(cb_trgbrarm, 3, 1) ld_phtrkctrl = QLabel('<h4>Controls</h4>', self, alignment=Qt.AlignCenter) ld_bunnr = QLabel('Bunch Number', self) sb_bunnr = PyDMSpinbox(self, self.dev_pref + ':SB_BUNCH_ID') sb_bunnr.showStepExponent = False ld_gain = QLabel('Gain', self) sb_gain = PyDMSpinbox(self, self.dev_pref + ':PHTRK_GAIN') sb_gain.showStepExponent = False ld_sp = QLabel('Setpoint [deg]', self) sb_sp = PyDMSpinbox(self, self.dev_pref + ':PHTRK_SETPT') sb_sp.showStepExponent = False ld_range = QLabel('Range [kHz]', self) sb_range = PyDMSpinbox(self, self.dev_pref + ':PHTRK_RANGE') sb_range.showStepExponent = False ld_dec = QLabel('Decimation', self) sb_dec = PyDMSpinbox(self, self.dev_pref + ':PHTRK_DECIM') sb_dec.showStepExponent = False ld_rate = QLabel('Rate', self) lb_rate = PyDMLabel(self, self.dev_pref + ':PHTRK_RATE') lb_rate.showUnits = True ld_bw = QLabel('Bandwidth', self) lb_bw = PyDMLabel(self, self.dev_pref + ':PHTRK_BANDWIDTH') lb_bw.showUnits = True ld_loopctrl = QLabel('Loop Control', self) cb_loopctrl = PyDMStateButton(self, self.dev_pref + ':PHTRK_LOOPCTRL') ld_drv2 = QLabel('Use Drive 2', self) cb_drv2 = PyDMStateButton(self, self.dev_pref + ':DRIVE2_TRACK') ld_mod = QLabel('Modulation', self) cb_mod = PyDMStateButton(self, self.dev_pref + ':PHTRK_MOD') lay_phtrkctrl = QGridLayout() lay_phtrkctrl.addWidget(ld_phtrkctrl, 0, 0, 1, 2) lay_phtrkctrl.addWidget(ld_bunnr, 1, 0) lay_phtrkctrl.addWidget(sb_bunnr, 1, 1) lay_phtrkctrl.addWidget(ld_gain, 2, 0) lay_phtrkctrl.addWidget(sb_gain, 2, 1) lay_phtrkctrl.addWidget(ld_sp, 3, 0) lay_phtrkctrl.addWidget(sb_sp, 3, 1) lay_phtrkctrl.addWidget(ld_range, 4, 0) lay_phtrkctrl.addWidget(sb_range, 4, 1) lay_phtrkctrl.addWidget(ld_dec, 5, 0) lay_phtrkctrl.addWidget(sb_dec, 5, 1) lay_phtrkctrl.addWidget(ld_rate, 6, 0) lay_phtrkctrl.addWidget(lb_rate, 6, 1) lay_phtrkctrl.addWidget(ld_bw, 7, 0) lay_phtrkctrl.addWidget(lb_bw, 7, 1) lay_phtrkctrl.addWidget(ld_loopctrl, 8, 0) lay_phtrkctrl.addWidget(cb_loopctrl, 8, 1) lay_phtrkctrl.addWidget(ld_drv2, 9, 0) lay_phtrkctrl.addWidget(cb_drv2, 9, 1) lay_phtrkctrl.addWidget(ld_mod, 10, 0) lay_phtrkctrl.addWidget(cb_mod, 10, 1) ld_phtrkdata = QLabel('<h4>Data</h4>', self, alignment=Qt.AlignCenter) ld_mag = QLabel('Magnitude', self) lb_mag = PyDMLabel(self, self.dev_pref + ':PHTRK_MAG') lb_mag.showUnits = True ld_trgain = QLabel('Transfer Gain', self) lb_trgain = PyDMLabel(self, self.dev_pref + ':PHTRK_TFGAIN') lb_trgain.showUnits = True ld_nshift = QLabel('Normalizing Shift', self) lb_nshift = PyDMLabel(self, self.dev_pref + ':PHTRK_SHIFT') ld_phase = QLabel('Phase', self) lb_phase = PyDMLabel(self, self.dev_pref + ':PHTRK_PHASE') lb_phase.showUnits = True ld_error = QLabel('Error', self) lb_error = PyDMLabel(self, self.dev_pref + ':PHTRK_ERROR') lb_error.showUnits = True ld_trfreq = QLabel('Tracking Frequency', self) lb_trfreq = PyDMLabel(self, self.dev_pref + ':PHTRK_FREQ0') lb_trfreq.showUnits = True ld_trtune = QLabel('Tracking Tune', self) lb_trtune = PyDMLabel(self, self.dev_pref + ':PHTRK_TUNE') lay_phtrkdata = QGridLayout() lay_phtrkdata.addWidget(ld_phtrkdata, 0, 0, 1, 2) lay_phtrkdata.addWidget(ld_mag, 1, 0) lay_phtrkdata.addWidget(lb_mag, 1, 1) lay_phtrkdata.addWidget(ld_trgain, 2, 0) lay_phtrkdata.addWidget(lb_trgain, 2, 1) lay_phtrkdata.addWidget(ld_nshift, 3, 0) lay_phtrkdata.addWidget(lb_nshift, 3, 1) lay_phtrkdata.addWidget(ld_phase, 4, 0) lay_phtrkdata.addWidget(lb_phase, 4, 1) lay_phtrkdata.addWidget(ld_error, 5, 0) lay_phtrkdata.addWidget(lb_error, 5, 1) lay_phtrkdata.addWidget(ld_trfreq, 6, 0) lay_phtrkdata.addWidget(lb_trfreq, 6, 1) lay_phtrkdata.addWidget(ld_trtune, 7, 0) lay_phtrkdata.addWidget(lb_trtune, 7, 1) gbox_phtrk = QGroupBox('Phase Tracking', self) lay_phtrk = QGridLayout(gbox_phtrk) lay_phtrk.setHorizontalSpacing(20) lay_phtrk.addLayout(lay_phtrkctrl, 0, 0) lay_phtrk.addLayout(lay_phtrkdata, 1, 0) gbox_phtrk.setStyleSheet(""" PyDMLabel{ min-width: 6em; max-width: 6em; }""") wid = QWidget() lay = QGridLayout(wid) lay.addWidget(gbox_dtacq, 0, 0) lay.addWidget(gbox_trig, 1, 0) lay.addWidget(gbox_phtrk, 2, 0) return wid
def _setupWaveformsWidget(self): gp_mean = WfmGraph(self) gp_mean.setPlotTitle('Mean') gp_mean.getAxis('bottom').setLabel('Bunch number') gp_mean.getAxis('left').setLabel('CNT') gp_mean.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_MEAN', xchannel=self.dev_pref + ':' + self.TYPE + '_XSC', color=QColor('red'), lineStyle=Qt.SolidLine) gp_maxrms = WfmGraph(self) gp_maxrms.setPlotTitle('Max RMS Channel (filtered)') gp_maxrms.getAxis('bottom').setLabel('Time (ms)') gp_maxrms.getAxis('left').setLabel('CNT') gp_maxrms.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_MAXRMS', xchannel=self.dev_pref + ':' + self.TYPE + '_TSC', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_rms = WfmGraph(self) gp_rms.setPlotTitle('RMS') gp_rms.getAxis('bottom').setLabel('Bunch number') gp_rms.getAxis('left').setLabel('CNT') gp_rms.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_RMS', xchannel=self.dev_pref + ':' + self.TYPE + '_XSC', color=QColor('green'), lineStyle=Qt.SolidLine) gp_avgspe = WfmGraph(self) gp_avgspe.setPlotTitle('Average spectrum') gp_avgspe.getAxis('bottom').setLabel('Frequency (kHz)') gp_avgspe.getAxis('left').setLabel('dB') gp_avgspe.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_SPEC', xchannel=self.dev_pref + ':' + self.TYPE + '_FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_avgspe.add_marker( name='Marker 1', xchannel=self.dev_pref + ':' + self.TYPE + '_PEAKFREQ1', ychannel=self.dev_pref + ':' + self.TYPE + '_PEAK1', color=QColor('red'), symbol='o') gp_avgspe.add_marker( name='Marker 2', xchannel=self.dev_pref + ':' + self.TYPE + '_PEAKFREQ2', ychannel=self.dev_pref + ':' + self.TYPE + '_PEAK2', color=QColor('magenta'), symbol='s') lay_graph = QGridLayout() lay_graph.setContentsMargins(9, 9, 9, 9) lay_graph.addWidget(gp_mean, 0, 0) lay_graph.addWidget(gp_maxrms, 0, 1) lay_graph.addWidget(gp_rms, 1, 0) lay_graph.addWidget(gp_avgspe, 1, 1) ld_acqenbl = QLabel('Acq. Enable', self) cb_acqenbl = PyDMStateButton( self, self.dev_pref + ':' + self.TYPE + '_ACQ_EN') ld_acqsing = QLabel('Acq. Mode', self) cb_acqsing = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_ACQ_SINGLE') ld_mean = QLabel('Mean', self, alignment=Qt.AlignCenter) lb_mean = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_MEANVAL') ld_rms = QLabel('RMS', self, alignment=Qt.AlignCenter) lb_rms = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_RMSVAL') ld_ampp2p = QLabel('Amp P-P', self, alignment=Qt.AlignCenter) lb_ampp2p = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_AMP_PP') ld_maxrms = QLabel('Max RMS', self, alignment=Qt.AlignCenter) lb_maxrms = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_MAXRMSVAL') ld_bunpatt = QLabel('Bunch\npattern', self) le_bunpatt = PyDMLineEdit( self, self.dev_pref + ':' + self.TYPE + '_ACQ_PATTERN') ld_avg = QLabel('Sample Avg', self) sb_avg = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_SP_AVG') sb_avg.showStepExponent = False gbox_acqctrl = QGroupBox('Acquisition control', self) lay_acqctrl = QGridLayout(gbox_acqctrl) lay_acqctrl.addWidget(ld_acqenbl, 0, 0) lay_acqctrl.addWidget(cb_acqenbl, 0, 1) lay_acqctrl.addWidget(ld_acqsing, 1, 0) lay_acqctrl.addWidget(cb_acqsing, 1, 1) lay_acqctrl.addWidget(ld_avg, 2, 0) lay_acqctrl.addWidget(sb_avg, 2, 1) lay_acqctrl.addItem(QSpacerItem(15, 1, QSzPlcy.Fixed, QSzPlcy.Ignored), 0, 2, 3, 1) lay_acqctrl.addWidget(ld_mean, 0, 3) lay_acqctrl.addWidget(lb_mean, 0, 4) lay_acqctrl.addWidget(ld_ampp2p, 0, 5) lay_acqctrl.addWidget(lb_ampp2p, 0, 6) lay_acqctrl.addWidget(ld_rms, 1, 3) lay_acqctrl.addWidget(lb_rms, 1, 4) lay_acqctrl.addWidget(ld_maxrms, 1, 5) lay_acqctrl.addWidget(lb_maxrms, 1, 6) lay_acqctrl.addWidget(ld_bunpatt, 2, 3) lay_acqctrl.addWidget(le_bunpatt, 2, 4, 1, 3) # Markers ld_mk1 = QLabel('1', self, alignment=Qt.AlignCenter) ld_mk2 = QLabel('2', self, alignment=Qt.AlignCenter) ld_span = QLabel('Span (kHz)', self, alignment=Qt.AlignCenter) ld_mode = QLabel('Mode', self, alignment=Qt.AlignCenter) ld_val = QLabel('Value', self, alignment=Qt.AlignCenter) ld_pfrq = QLabel('Freq', self, alignment=Qt.AlignCenter) ld_tune = QLabel('Tune', self, alignment=Qt.AlignCenter) le_low1 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_LOW1') le_high1 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_HIGH1') cb_mode1 = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_SP_SEARCH1') lb_peak1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAK1') lb_peak1.showUnits = True lb_pfrq1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKFREQ1') lb_pfrq1.showUnits = True lb_tune1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKTUNE1') le_low2 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_LOW2') le_high2 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_HIGH2') cb_mode2 = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_SP_SEARCH2') lb_peak2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAK2') lb_peak2.showUnits = True lb_pfrq2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKFREQ2') lb_pfrq2.showUnits = True lb_tune2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKTUNE2') gbox_mark = QGroupBox('Markers', self) lay_mark = QGridLayout(gbox_mark) lay_mark.addWidget(ld_span, 0, 1, 1, 2) lay_mark.addWidget(ld_mode, 0, 3) lay_mark.addWidget(ld_val, 0, 4) lay_mark.addWidget(ld_pfrq, 0, 5) lay_mark.addWidget(ld_tune, 0, 6) lay_mark.addWidget(ld_mk1, 1, 0) lay_mark.addWidget(le_low1, 1, 1) lay_mark.addWidget(le_high1, 1, 2) lay_mark.addWidget(cb_mode1, 1, 3) lay_mark.addWidget(lb_peak1, 1, 4) lay_mark.addWidget(lb_pfrq1, 1, 5) lay_mark.addWidget(lb_tune1, 1, 6) lay_mark.addWidget(ld_mk2, 2, 0) lay_mark.addWidget(le_low2, 2, 1) lay_mark.addWidget(le_high2, 2, 2) lay_mark.addWidget(cb_mode2, 2, 3) lay_mark.addWidget(lb_peak2, 2, 4) lay_mark.addWidget(lb_pfrq2, 2, 5) lay_mark.addWidget(lb_tune2, 2, 6) wid = QWidget() lay = QGridLayout(wid) lay.setContentsMargins(0, 0, 0, 0) lay.addLayout(lay_graph, 0, 0, 1, 2) lay.addWidget(gbox_acqctrl, 1, 0) lay.addWidget(gbox_mark, 1, 1) lay.setRowStretch(0, 5) lay.setRowStretch(1, 1) lay.setColumnStretch(0, 1) lay.setColumnStretch(1, 1) return wid
def _setupCoefficientsEditWidget(self, parent=None): wid = QGroupBox('Edit Coefficients', parent or self) le_coefdesc = PyDMLineEdit(self, self.dev_pref + ':DESC_COEFF') graph_coefs = WfmGraph(wid) graph_coefs.add_scatter_curve(ychannel=self.dev_pref + ':COEFF', lineStyle=Qt.SolidLine) graph_fftmag = WfmGraph(wid) graph_fftmag.setObjectName('graph') graph_fftmag.setStyleSheet('#graph{min-height: 12em;}') graph_fftmag.setLabel('left', text='Magnitude [dB]') graph_fftmag.setLabel('bottom', text='Fractional Freq.') graph_fftmag.add_scatter_curve(ychannel=self.dev_pref + ':FTF_MAG', xchannel=self.dev_pref + ':FTF_FREQ', color=QColor('blue'), lineWidth=2, lineStyle=Qt.SolidLine, symbolSize=4) graph_fftmag.add_scatter_curve(ychannel=self.dev_pref + ':FTF_GTUNE', xchannel=self.dev_pref + ':FTF_FTUNE', name='Tune', color=QColor('red')) graph_fftphs = WfmGraph(wid) graph_fftphs.setLabel('left', text='Phase [°]') graph_fftphs.setLabel('bottom', text='Fractional Freq.') graph_fftphs.add_scatter_curve(ychannel=self.dev_pref + ':FTF_PHASE', xchannel=self.dev_pref + ':FTF_FREQ', color=QColor('blue'), lineWidth=2, lineStyle=Qt.SolidLine, symbolSize=4) graph_fftphs.add_scatter_curve(ychannel=self.dev_pref + ':FTF_PTUNE', xchannel=self.dev_pref + ':FTF_FTUNE', name='Tune', color=QColor('red')) ld_fractune = QLabel('<h4> Marker:</h4>', wid, alignment=Qt.AlignLeft | Qt.AlignVCenter) ld_ftval = QLabel('Frequency [0-1]', wid, alignment=Qt.AlignRight | Qt.AlignVCenter) sb_ftval = PyDMSpinbox(wid, self.dev_pref + ':FTF_TUNE') sb_ftval.showStepExponent = False ld_ftgain = QLabel('Gain [dB]', wid, alignment=Qt.AlignRight | Qt.AlignVCenter) lb_ftgain = Label(wid, self.dev_pref + ':FTF_GTUNE') lb_ftgain.precisionFromPV = False lb_ftgain.precision = 2 ld_ftphs = QLabel('Phase [°]', wid, alignment=Qt.AlignRight | Qt.AlignVCenter) lb_ftphs = Label(wid, self.dev_pref + ':FTF_PTUNE') lb_ftphs.precisionFromPV = False lb_ftphs.precision = 2 lay_genft = QGridLayout() lay_genft.setVerticalSpacing(6) lay_genft.setHorizontalSpacing(9) lay_genft.addWidget(ld_fractune, 0, 0) lay_genft.addWidget(ld_ftval, 0, 2) lay_genft.addWidget(sb_ftval, 0, 3) lay_genft.addWidget(ld_ftgain, 0, 5) lay_genft.addWidget(lb_ftgain, 0, 6) lay_genft.addWidget(ld_ftphs, 0, 8) lay_genft.addWidget(lb_ftphs, 0, 9) lay_genft.setRowStretch(1, 2) lay_genft.setRowStretch(4, 2) lay_genft.setRowStretch(7, 2) lay_genft.setRowStretch(10, 2) coef_edit_wid = self._setupCoeffSettingsWidget() lay = QGridLayout(wid) lay.setVerticalSpacing(15) lay.addWidget(coef_edit_wid, 0, 0, 2, 1) lay.addWidget(le_coefdesc, 0, 1) lay.addWidget(graph_coefs, 1, 1) lay.addWidget(graph_fftmag, 2, 0) lay.addWidget(graph_fftphs, 2, 1) lay.addLayout(lay_genft, 3, 0, 1, 2) return wid
def _setupUi(self): ld_timing = QLabel('<h3>Timing</h3>', self, alignment=Qt.AlignCenter) # Feedback Timing ld_adcdelay = QLabel('ADC Delay [ps]', self) sb_adcdelay = PyDMSpinbox(self, self.dev_pref + ':TADC') sb_adcdelay.showStepExponent = False ld_dacdelay = QLabel('DAC Delay [ps]', self) sb_dacdelay = PyDMSpinbox(self, self.dev_pref + ':TDAC') sb_dacdelay.showStepExponent = False ld_outdelay = QLabel('Output Delay', self) sb_outdelay = PyDMSpinbox(self, self.dev_pref + ':DELAY') sb_outdelay.showStepExponent = False gbox_fbti = QGroupBox('Feedback Timing', self) lay_fbti = QGridLayout(gbox_fbti) lay_fbti.addWidget(ld_adcdelay, 0, 0) lay_fbti.addWidget(sb_adcdelay, 0, 1) lay_fbti.addWidget(ld_dacdelay, 1, 0) lay_fbti.addWidget(sb_dacdelay, 1, 1) lay_fbti.addWidget(ld_outdelay, 2, 0) lay_fbti.addWidget(sb_outdelay, 2, 1) # Timing Control ld_clkrst = QLabel('Clock Reset', self) pb_clkrst = SiriusPushButton(self, init_channel=self.dev_pref + ':CLKRST', pressValue=1, releaseValue=0) pb_clkrst.setText('Reset') pb_clkrst.setToolTip('Reset Clock') pb_clkrst.setIcon(qta.icon('fa5s.sync')) pb_clkrst.setObjectName('conf') ld_fidsigoff = QLabel('FID Signal Offset [ps]', self) sb_fidsigoff = SiriusSpinbox(self, self.dev_pref + ':OFF_FIDS') sb_fidsigoff.showStepExponent = False sb_fidsigoff.limitsFromChannel = False sb_fidsigoff.setMinimum(0) sb_fidsigoff.setMaximum(3000) ld_fiddelay = QLabel('Fiducial Delay', self) sb_fiddelay = PyDMSpinbox(self, self.dev_pref + ':FID_DELAY') sb_fiddelay.showStepExponent = False fr_fiddelay = SiriusFrame(self, self.dev_pref + ':FID_DELAY_SUBWR') fr_fiddelay.add_widget(sb_fiddelay) gbox_tictrl = QGroupBox('Timing Control', self) lay_tictrl = QGridLayout(gbox_tictrl) lay_tictrl.addWidget(ld_clkrst, 0, 0) lay_tictrl.addWidget(pb_clkrst, 0, 1) lay_tictrl.addWidget(ld_fidsigoff, 1, 0) lay_tictrl.addWidget(sb_fidsigoff, 1, 1) lay_tictrl.addWidget(ld_fiddelay, 2, 0) lay_tictrl.addWidget(fr_fiddelay, 2, 1) # Frequency counters ld_fcntch0 = QLabel('Input Clock', self) lb_fcntch0 = PyDMLabel(self, self.dev_pref + ':FREQ_CNT_CH0') lb_fcntch0.showUnits = True ld_fcntch1 = QLabel('ACLK (RF/2)', self) lb_fcntch1 = PyDMLabel(self, self.dev_pref + ':FREQ_CNT_CH1') lb_fcntch1.showUnits = True ld_fcntch2 = QLabel('ACLK3 (RF/3)', self) lb_fcntch2 = PyDMLabel(self, self.dev_pref + ':FREQ_CNT_CH2') lb_fcntch2.showUnits = True ld_fcntch3 = QLabel('DAC Clock', self) lb_fcntch3 = PyDMLabel(self, self.dev_pref + ':FREQ_CNT_CH3') lb_fcntch3.showUnits = True ld_fcntch4 = QLabel('RF/4 Processing Clock', self) lb_fcntch4 = PyDMLabel(self, self.dev_pref + ':FREQ_CNT_CH4') lb_fcntch4.showUnits = True gbox_fcnts = QGroupBox('Frequency counters', self) lay_fcnts = QGridLayout(gbox_fcnts) lay_fcnts.addWidget(ld_fcntch0, 0, 0) lay_fcnts.addWidget(lb_fcntch0, 0, 1) lay_fcnts.addWidget(ld_fcntch1, 1, 0) lay_fcnts.addWidget(lb_fcntch1, 1, 1) lay_fcnts.addWidget(ld_fcntch2, 2, 0) lay_fcnts.addWidget(lb_fcntch2, 2, 1) lay_fcnts.addWidget(ld_fcntch3, 3, 0) lay_fcnts.addWidget(lb_fcntch3, 3, 1) lay_fcnts.addWidget(ld_fcntch4, 4, 0) lay_fcnts.addWidget(lb_fcntch4, 4, 1) lay = QGridLayout(self) lay.addWidget(ld_timing, 0, 1, 1, 2) lay.addWidget(gbox_fbti, 1, 1) lay.addWidget(gbox_tictrl, 1, 2) lay.addWidget(gbox_fcnts, 2, 1, 1, 2) lay.setColumnStretch(0, 3) lay.setColumnStretch(3, 3) lay.setRowStretch(3, 3) self.setStyleSheet("SiriusFrame{max-height: 1.8em;}")
def _setupFrontBackEndRegsWidget(self): # # Front/back end registers ld_gpiohph = QLabel('Horiz. Phase', self) sb_gpiohph = PyDMSpinbox(self, self.dev_pref + ':FBELT_X_PHASE_SETPT') sb_gpiohph.showStepExponent = False ld_gpiohat = QLabel('Horiz. Atten.', self) sb_gpiohat = PyDMSpinbox(self, self.dev_pref + ':FBE_X_ATT') sb_gpiohat.showStepExponent = False ld_gpiovph = QLabel('Vert. Phase', self) sb_gpiovph = PyDMSpinbox(self, self.dev_pref + ':FBELT_Y_PHASE_SETPT') sb_gpiovph.showStepExponent = False ld_gpiovat = QLabel('Vert. Atten.', self) sb_gpiovat = PyDMSpinbox(self, self.dev_pref + ':FBE_Y_ATT') sb_gpiovat.showStepExponent = False ld_gpiolph = QLabel('Long. Phase', self) sb_gpiolph = PyDMSpinbox(self, self.dev_pref + ':FBELT_SERVO_SETPT') sb_gpiolph.showStepExponent = False ld_gpiolat = QLabel('Long. Atten.', self) sb_gpiolat = PyDMSpinbox(self, self.dev_pref + ':FBE_Z_ATT') sb_gpiolat.showStepExponent = False ld_gpiobeph = QLabel('Back-end Phase', self) sb_gpiobeph = PyDMSpinbox(self, self.dev_pref + ':FBE_BE_PHASE') sb_gpiobeph.showStepExponent = False ld_gpiobeat = QLabel('Back-end Atten.', self) sb_gpiobeat = PyDMSpinbox(self, self.dev_pref + ':FBE_BE_ATT') sb_gpiobeat.showStepExponent = False # # Phases ld_gpiophss = QLabel('<h4>Phases</h4>', self, alignment=Qt.AlignCenter) lb_gpiohph = PyDMLabel(self, self.dev_pref + ':FBE_X_PHASE') lb_gpiovph = PyDMLabel(self, self.dev_pref + ':FBE_Y_PHASE') lb_gpiolph = PyDMLabel(self, self.dev_pref + ':FBE_Z_PHASE') lay_phases = QGridLayout() lay_phases.addWidget(ld_gpiophss, 0, 0, 1, 10) lay_phases.addWidget(QLabel('L:'), 1, 1) lay_phases.addWidget(lb_gpiolph, 1, 2) lay_phases.addWidget(QLabel('H:'), 1, 4) lay_phases.addWidget(lb_gpiohph, 1, 5) lay_phases.addWidget(QLabel('V:'), 1, 7) lay_phases.addWidget(lb_gpiovph, 1, 8) lay_phases.setColumnStretch(0, 2) lay_phases.setColumnStretch(3, 2) lay_phases.setColumnStretch(6, 2) lay_phases.setColumnStretch(9, 2) gbox_fbend = QGroupBox('Front/back end registers', self) lay_fbend = QGridLayout(gbox_fbend) lay_fbend.addWidget(ld_gpiobeat, 0, 0) lay_fbend.addWidget(sb_gpiobeat, 0, 1) lay_fbend.addWidget(ld_gpiolat, 1, 0) lay_fbend.addWidget(sb_gpiolat, 1, 1) lay_fbend.addWidget(ld_gpiohat, 2, 0) lay_fbend.addWidget(sb_gpiohat, 2, 1) lay_fbend.addWidget(ld_gpiovat, 3, 0) lay_fbend.addWidget(sb_gpiovat, 3, 1) lay_fbend.addWidget(ld_gpiobeph, 4, 0) lay_fbend.addWidget(sb_gpiobeph, 4, 1) lay_fbend.addWidget(ld_gpiolph, 5, 0) lay_fbend.addWidget(sb_gpiolph, 5, 1) lay_fbend.addWidget(ld_gpiohph, 6, 0) lay_fbend.addWidget(sb_gpiohph, 6, 1) lay_fbend.addWidget(ld_gpiovph, 7, 0) lay_fbend.addWidget(sb_gpiovph, 7, 1) lay_fbend.addLayout(lay_phases, 8, 0, 1, 2) return gbox_fbend
def _setupMeasSettingsWidget(self, mode): if mode == 'Normal': prefix = self.dcct_prefix visible = True elif mode == 'Fast': prefix = self.dcct_prefix.substitute(propty_name=mode) visible = False gbox_modesettings = QGroupBox(mode + ' Measurement Mode Settings', self) l_smpcnt = QLabel('Sample Count: ', self) spinbox_SampleCnt = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-SP')) spinbox_SampleCnt.showStepExponent = False label_SampleCnt = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-RB')) hlay_smpcnt = QHBoxLayout() hlay_smpcnt.addWidget(spinbox_SampleCnt) hlay_smpcnt.addWidget(label_SampleCnt) l_measperiod = QLabel('Period [s]: ', self) spinbox_MeasPeriod = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-SP')) spinbox_MeasPeriod.showStepExponent = False label_MeasPeriod = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-RB')) hlay_measperiod = QHBoxLayout() hlay_measperiod.addWidget(spinbox_MeasPeriod) hlay_measperiod.addWidget(label_MeasPeriod) l_measupdateperiod = QLabel('Measured Period [s]: ', self) label_MeasUpdatePeriod = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasUpdatePeriod-Mon')) l_imped = QLabel('Impedance: ', self) enumcombobox_Imped = PyDMEnumComboBox( self, prefix.substitute(propty=prefix.propty_name + 'Imped-Sel')) label_Imped = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'Imped-Sts')) hlay_imped = QHBoxLayout() hlay_imped.addWidget(enumcombobox_Imped) hlay_imped.addWidget(label_Imped) l_offset = QLabel('Relative Offset Enable: ', self) statebutton_RelEnbl = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'RelEnbl-Sel')) statebutton_RelEnbl.shape = 1 statebutton_RelEnbl.setStyleSheet('min-width:6em; max-width:6em;') label_RelEnbl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'RelEnbl-Sts')) hlay_offset = QHBoxLayout() hlay_offset.addWidget(statebutton_RelEnbl) hlay_offset.addWidget(label_RelEnbl) l_rellvl = QLabel('Relative Offset Level [V]: ', self) spinbox_RelLvl = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'RelLvl-SP')) spinbox_RelLvl.showStepExponent = False label_RelLvl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'RelLvl-RB')) label_RelLvl.precisionFromPV = False label_RelLvl.precision = 9 pushbutton_RelAcq = PyDMPushButton( parent=self, label='Acquire Offset', pressValue=1, init_channel=prefix.substitute(propty=prefix.propty_name + 'RelAcq-Cmd')) pushbutton_RelAcq.setAutoDefault(False) pushbutton_RelAcq.setDefault(False) hlay_rellvl = QHBoxLayout() hlay_rellvl.addWidget(spinbox_RelLvl) hlay_rellvl.addWidget(label_RelLvl) hlay_rellvl.addWidget(pushbutton_RelAcq) flay_modesettings = QFormLayout() flay_modesettings.setLabelAlignment(Qt.AlignRight) flay_modesettings.setFormAlignment(Qt.AlignHCenter) flay_modesettings.addRow(l_smpcnt, hlay_smpcnt) flay_modesettings.addRow(l_measperiod, hlay_measperiod) flay_modesettings.addRow(l_measupdateperiod, label_MeasUpdatePeriod) flay_modesettings.addRow(l_imped, hlay_imped) flay_modesettings.addRow(l_offset, hlay_offset) flay_modesettings.addRow(l_rellvl, hlay_rellvl) if mode == 'Normal': l_linesync = QLabel('Line Synchronization: ', self) statebutton_LineSync = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'LineSync-Sel')) statebutton_LineSync.shape = 1 statebutton_LineSync.setStyleSheet('min-width:6em; max-width:6em;') label_LineSync = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'LineSync-Sts')) hlay_linesync = QHBoxLayout() hlay_linesync.addWidget(statebutton_LineSync) hlay_linesync.addWidget(label_LineSync) label_avg = QLabel('<h4>Average Filter</h4>', self) l_avgenbl = QLabel('Enable: ', self) statebutton_AvgFilterEnbl = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterEnbl-Sel')) statebutton_AvgFilterEnbl.shape = 1 label_AvgFilterEnbl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterEnbl-Sts')) hlay_avgenbl = QHBoxLayout() hlay_avgenbl.addWidget(statebutton_AvgFilterEnbl) hlay_avgenbl.addWidget(label_AvgFilterEnbl) l_avgcnt = QLabel('Samples: ', self) spinbox_AvgFilterCount = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterCnt-SP')) spinbox_AvgFilterCount.showStepExponent = False label_AvgFilterCount = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterCnt-RB')) hlay_avgcnt = QHBoxLayout() hlay_avgcnt.addWidget(spinbox_AvgFilterCount) hlay_avgcnt.addWidget(label_AvgFilterCount) l_avgtyp = QLabel('Type: ', self) enumcombobox_AvgFilterTyp = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='AvgFilterTyp-Sel')) label_AvgFilterTyp = PyDMLabel( self, self.dcct_prefix.substitute(propty='AvgFilterTyp-Sts')) hlay_avgtyp = QHBoxLayout() hlay_avgtyp.addWidget(enumcombobox_AvgFilterTyp) hlay_avgtyp.addWidget(label_AvgFilterTyp) l_avgwin = QLabel('Noise window size [%]: ', self) spinbox_AvgFilterWind = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterWind-SP')) spinbox_AvgFilterWind.showStepExponent = False label_AvgFilterWind = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterWind-RB')) hlay_avgwin = QHBoxLayout() hlay_avgwin.addWidget(spinbox_AvgFilterWind) hlay_avgwin.addWidget(label_AvgFilterWind) flay_modesettings.addRow(l_linesync, hlay_linesync) flay_modesettings.addRow(QLabel('')) flay_modesettings.addRow(label_avg) flay_modesettings.addRow(l_avgenbl, hlay_avgenbl) flay_modesettings.addRow(l_avgcnt, hlay_avgcnt) flay_modesettings.addRow(l_avgtyp, hlay_avgtyp) flay_modesettings.addRow(l_avgwin, hlay_avgwin) gbox_modesettings.setLayout(flay_modesettings) gbox_modesettings.setVisible(visible) gbox_modesettings.setStyleSheet(""" PyDMSpinbox, PyDMLabel{ min-width:6em; max-width:6em; qproperty-alignment: AlignCenter;} PyDMLedMultiChannel, PyDMStateButton, PyDMEnumComboBox{ min-width:6em; max-width:6em;}""") return gbox_modesettings
def _setupControlsWidget(self): ld_growenbl = QLabel('Grow/Damp Enable', self) cb_growenbl = PyDMEnumComboBox(self, self.dev_pref + ':GDEN') ld_down = QLabel('Rec. Downsample ', self) sb_down = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_REC_DS') sb_down.showStepExponent = False ld_rawdata = QLabel('Raw Data', self) cb_rawdata = PyDMStateButton(self, self.dev_pref + ':' + self.TYPE + '_DUMP') ld_acqtime = QLabel('Acquisition Time', self) sb_acqtime = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_ACQTIME') sb_acqtime.showStepExponent = False sb_acqtime.showUnits = True ld_holdoff = QLabel('Hold-Off Time', self) sb_holdoff = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_HOLDTIME') sb_holdoff.showStepExponent = False sb_holdoff.showUnits = True ld_posttrg = QLabel('Post Trigger', self) sb_posttrg = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_POSTTIME') sb_posttrg.showStepExponent = False sb_posttrg.showUnits = True fr_posttrg = SiriusFrame( self, self.dev_pref + ':' + self.TYPE + '_POSTREG_SUBWR') fr_posttrg.add_widget(sb_posttrg) ld_growtime = QLabel('Growth Time', self) sb_growtime = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_GDTIME') sb_growtime.showStepExponent = False sb_growtime.showUnits = True fr_growtime = SiriusFrame( self, self.dev_pref + ':' + self.TYPE + '_GDREG_SUBWR') fr_growtime.add_widget(sb_growtime) ld_acqlen = QLabel('Acquisition Length', self) lb_acqlen = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_ACQ_TURNS') lb_acqlen.showUnits = True ld_psttrglen = QLabel('Post Trigger Length', self) lb_psttrglen = PyDMLabel( self, self.dev_pref + ':' + self.TYPE + '_POST_TURNS') lb_psttrglen.showUnits = True bt_modal = QPushButton('Modal Analysis', self) window = create_window_from_widget(_BbBModalAnalysis, title='SRAM Modal Analysis', icon=get_bbb_icon(), is_main=True) connect_window(bt_modal, window, self, prefix=self._prefix, device=self._device, acq_type=self.TYPE) gbox_dtacq = QGroupBox('Data Acquisition', self) lay_dtacq = QGridLayout(gbox_dtacq) lay_dtacq.addWidget(ld_growenbl, 0, 0) lay_dtacq.addWidget(cb_growenbl, 0, 1) lay_dtacq.addWidget(ld_down, 1, 0) lay_dtacq.addWidget(sb_down, 1, 1) lay_dtacq.addWidget(ld_rawdata, 2, 0) lay_dtacq.addWidget(cb_rawdata, 2, 1) lay_dtacq.addWidget(ld_acqtime, 3, 0) lay_dtacq.addWidget(sb_acqtime, 3, 1) lay_dtacq.addWidget(ld_holdoff, 4, 0) lay_dtacq.addWidget(sb_holdoff, 4, 1) lay_dtacq.addWidget(ld_posttrg, 5, 0) lay_dtacq.addWidget(fr_posttrg, 5, 1) lay_dtacq.addWidget(ld_growtime, 6, 0) lay_dtacq.addWidget(fr_growtime, 6, 1) lay_dtacq.addWidget(ld_acqlen, 7, 0) lay_dtacq.addWidget(lb_acqlen, 7, 1) lay_dtacq.addWidget(ld_psttrglen, 8, 0) lay_dtacq.addWidget(lb_psttrglen, 8, 1) lay_dtacq.addWidget(bt_modal, 9, 0, 1, 2) ld_acqtyp = QLabel('<h4>Acq Type</h4>', self, alignment=Qt.AlignCenter) cb_acqtyp = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_POSTSEL') gbox_acqtyp = QGroupBox(self) lay_acqtyp = QVBoxLayout(gbox_acqtyp) lay_acqtyp.addWidget(ld_acqtyp) lay_acqtyp.addWidget(cb_acqtyp) ld_trgexten = QLabel('Internal/External', self) cb_trgexten = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_HWTEN') ld_trginsel = QLabel('Selection', self) cb_trginsel = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_TRIG_IN_SEL') ld_trgarm = QLabel('Arm', self) cb_trgarm = PyDMStateButton(self, self.dev_pref + ':' + self.TYPE + '_ARM') lb_armmon = SiriusLedState( self, self.dev_pref + ':' + self.TYPE + '_ARM_MON') ld_trgbrarm = QLabel('Auto re-arm', self) cb_trgbrarm = PyDMStateButton( self, self.dev_pref + ':' + self.TYPE + '_BR_ARM') ld_rst = QLabel('Trigger 1/2 Cap.:', self) lb_rst1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_CAP_TRIG1') lb_rst2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_CAP_TRIG2') gbox_trig = QGroupBox('Trigger', self) lay_trig = QGridLayout(gbox_trig) lay_trig.setAlignment(Qt.AlignTop) lay_trig.addWidget(ld_trgexten, 0, 0) lay_trig.addWidget(cb_trgexten, 0, 1, 1, 2) lay_trig.addWidget(ld_trginsel, 1, 0) lay_trig.addWidget(cb_trginsel, 1, 1, 1, 2) lay_trig.addWidget(ld_trgarm, 2, 0) lay_trig.addWidget(cb_trgarm, 2, 1) lay_trig.addWidget(lb_armmon, 2, 2) lay_trig.addWidget(ld_trgbrarm, 3, 0) lay_trig.addWidget(cb_trgbrarm, 3, 1) lay_trig.addWidget(ld_rst, 4, 0) lay_trig.addWidget(lb_rst1, 4, 1) lay_trig.addWidget(lb_rst2, 4, 2) lay_trig.setRowStretch(5, 2) pixmap = QPixmap( _os.path.join(_os.path.abspath(_os.path.dirname(__file__)), 'grow_damp.png')) img_wid = QLabel(self) img_wid.setPixmap(pixmap) img_wid.setScaledContents(True) wid = QWidget() lay = QGridLayout(wid) lay.setContentsMargins(0, 0, 0, 0) lay.addWidget(gbox_acqtyp, 0, 0) lay.addWidget(gbox_dtacq, 1, 0) lay.addWidget(gbox_trig, 2, 0) lay.addWidget(img_wid, 4, 0) lay.setRowStretch(3, 5) lay.setRowStretch(5, 5) wid.setStyleSheet("SiriusFrame{max-height: 1.8em;}") return wid
def _setupScrnsCorrsWidget(self): # screens lay_screens = QVBoxLayout() lay_screens.setContentsMargins(0, 0, 0, 0) header_screens = self._create_headerline( (('', 0), ('Screen', 6.5), ('Cam', 3.5), ('Type-Sel', 5), ('Type-Sts', 5), ('', 0))) header_screens.setObjectName('header_screens') header_screens.setStyleSheet( '#header_screens {border-bottom: 2px solid gray;}') header_screens.layout().setContentsMargins(0, 9, 0, 9) header_screens.setSizePolicy(QSzPlcy.Preferred, QSzPlcy.Maximum) lay_screens.addWidget(header_screens) for idx, scrn_prefix in enumerate(self._scrns): scrn_prefix = SiriusPVName(scrn_prefix) w = self._create_scrn_summwidget(scrn_prefix, idx) w.layout().setContentsMargins(9, 9, 9, 9) lay_screens.addWidget(w) # correctors w_corr = QWidget() w_corr.setObjectName('w_corr') w_corr.setStyleSheet('#w_corr {border-left: 2px solid gray;}') lay_corr = QGridLayout(w_corr) lay_corr.setContentsMargins(0, 0, 0, 0) lay_corr.setVerticalSpacing(25) lay_corr.setHorizontalSpacing(15) lay_corr.setAlignment(Qt.AlignTop) header_corrs = self._create_headerline( (('', 0), ('', 1.29), ('', 5), ('Kick-SP', 5), ('Kick-Mon', 5), ('', 0), ('', 1.29), ('', 5), ('Kick-SP', 5), ('Kick-Mon', 5), ('', 0))) header_corrs.setObjectName('header_corrs') header_corrs.setStyleSheet( '#header_corrs {border-bottom: 2px solid gray;}') header_corrs.layout().setContentsMargins(0, 9, 0, 9) header_corrs.setSizePolicy(QSzPlcy.Preferred, QSzPlcy.Maximum) lay_corr.addWidget(header_corrs, 0, 0, 1, 2) for corr, row, col in (('TB-04:PS-CH-1', 1, 0), ('TB-04:PS-CH-2', 2, 0), ('TB-04:PS-CV-1', 1, 1), ('TB-04:PS-CV-2', 2, 1), ('TB-04:PU-InjSept', 3, 0), ('BO-01D:PU-InjKckr', 3, 1)): corr = SiriusPVName(corr) w = self._create_corr_summwidget(corr) w.layout().setContentsMargins(9, 9, 9, 9) lay_corr.addWidget(w, row, col) # posang posang_prefix = SiriusPVName('TB-Glob:AP-PosAng').substitute( prefix=self.prefix) w_posang = QWidget() w_posang.setSizePolicy(QSzPlcy.Preferred, QSzPlcy.Maximum) w_posang.setObjectName('w_posang') w_posang.setStyleSheet('#w_posang {border-top: 2px solid gray;}') lay_posang = QGridLayout(w_posang) lay_posang.setVerticalSpacing(9) lay_posang.setHorizontalSpacing(15) header_posang = self._create_headerline( (('', 0), ('', 1.29), ('Position and Angle Correction', 30), ('', 0))) header_posang.setSizePolicy(QSzPlcy.Preferred, QSzPlcy.Maximum) lay_posang.addWidget(header_posang, 0, 0, 1, 2) self.pb_update_ref = PyDMPushButton( label='Update Reference', parent=self, init_channel=posang_prefix.substitute(propty='SetNewRefKick-Cmd'), pressValue=1) self.pb_update_ref.setStyleSheet('min-height: 2em;') lay_posang.addWidget(self.pb_update_ref, 1, 0, 1, 2) for col, title, axis in ((0, 'Horizontal', 'X'), (1, 'Vertical', 'Y')): lb_pos = QLabel('<h4>Δ' + axis.lower() + '</h4>', self, alignment=Qt.AlignRight) lb_pos.setSizePolicy(QSzPlcy.Maximum, QSzPlcy.Maximum) pos_sp = PyDMSpinbox( self, posang_prefix.substitute(propty='DeltaPos' + axis + '-SP')) pos_sp.setObjectName('pos_sp_' + axis.lower()) pos_sp.showStepExponent = False pos_rb = PyDMLabel( self, posang_prefix.substitute(propty='DeltaPos' + axis + '-RB')) pos_rb.setObjectName('pos_rb_' + axis.lower()) lb_ang = QLabel('<h4>Δ' + axis.lower() + '\'</h4>', self, alignment=Qt.AlignRight) lb_ang.setSizePolicy(QSzPlcy.Maximum, QSzPlcy.Maximum) ang_sp = PyDMSpinbox( self, posang_prefix.substitute(propty='DeltaAng' + axis + '-SP')) ang_sp.setObjectName('ang_sp_' + axis.lower()) ang_sp.showStepExponent = False ang_rb = PyDMLabel( self, posang_prefix.substitute(propty='DeltaAng' + axis + '-RB')) ang_rb.setObjectName('ang_rb_' + axis.lower()) gbox_posang = QGroupBox(title, self) axlay = QGridLayout(gbox_posang) axlay.addWidget(lb_pos, 0, 0) axlay.addWidget(pos_sp, 0, 1) axlay.addWidget(pos_rb, 0, 2) axlay.addWidget(lb_ang, 1, 0) axlay.addWidget(ang_sp, 1, 1) axlay.addWidget(ang_rb, 1, 2) lay_posang.addWidget(gbox_posang, 2, col) self.pb_posang_settings = QPushButton('Settings', self) util.connect_window(self.pb_posang_settings, CorrParamsDetailWindow, parent=self, tl='TB', prefix=self.prefix) lay_posang.addWidget(self.pb_posang_settings, 3, 0, 1, 2, alignment=Qt.AlignRight) lay_posangref = QGridLayout() lay_posangref.setHorizontalSpacing(9) lay_posangref.setVerticalSpacing(9) lay_posangref.addWidget( QLabel('<h4>Reference Kicks</h4>', self, alignment=Qt.AlignCenter), 0, 0, 1, 7) for corr in ('CH1', 'CH2', 'CV1', 'CV2'): lb_corr = PyDMLabel(self, posang_prefix.substitute(propty=corr + '-Cte')) lb_corr.setStyleSheet('font-weight:bold;') lb_refkick = PyDMLabel( self, posang_prefix.substitute(propty='RefKick' + corr + '-Mon')) lb_refkick.showUnits = True col = 1 if 'CH' in corr else 4 row = 0 if '1' in corr else 1 lay_posangref.addWidget(lb_corr, row + 1, col) lay_posangref.addWidget(lb_refkick, row + 1, col + 1) lay_posangref.setColumnStretch(0, 1) lay_posangref.setColumnStretch(1, 3) lay_posangref.setColumnStretch(2, 3) lay_posangref.setColumnStretch(3, 1) lay_posangref.setColumnStretch(4, 3) lay_posangref.setColumnStretch(5, 3) lay_posangref.setColumnStretch(6, 1) lay_posang.addLayout(lay_posangref, 4, 0, 1, 2) lay_corr.addWidget(w_posang, 4, 0, 1, 2) lay_corr.setRowStretch(0, 1) lay_corr.setRowStretch(1, 2) lay_corr.setRowStretch(2, 2) lay_corr.setRowStretch(3, 2) lay_corr.setRowStretch(4, 10) lay = QHBoxLayout() lay.setContentsMargins(0, 0, 0, 0) lay.setSpacing(0) lay.addLayout(lay_screens) lay.addWidget(w_corr) self.corr_wid.setLayout(lay)
def _setupUi(self): gp_mode = WfmGraph(self) gp_mode.setStyleSheet('min-height: 10em;') gp_mode.setPlotTitle('Modal Amplitudes') gp_mode.getAxis('bottom').setLabel('Mode Number') gp_mode.getAxis('left').setLabel('CNT') gp_mode.add_scatter_curve(ychannel=self.prop_pref + 'MD_MODES', color=QColor('red'), lineStyle=Qt.SolidLine) gp_spec = WfmGraph(self) gp_spec.setStyleSheet('min-height: 10em;') gp_spec.setPlotTitle('Single Mode Spectrum') gp_spec.getAxis('bottom').setLabel('Frequency (kHz)') gp_spec.getAxis('left').setLabel('CNT') gp_spec.add_scatter_curve(ychannel=self.prop_pref + 'MD_SPEC', xchannel=self.prop_pref + 'FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_spec.add_marker(name='Marker', xchannel=self.prop_pref + 'MD_PEAKFREQ', ychannel=self.prop_pref + 'MD_PEAK', color=QColor('red'), symbol='o') ld_enbl = QLabel('Acq. Enable', self) cb_enbl = PyDMStateButton(self, self.prop_pref + 'MD_ENABLE') ld_sel = QLabel('Acq. Mode', self) cb_sel = PyDMEnumComboBox(self, self.prop_pref + 'MD_SMODE') ld_sbnd = QLabel('Sideband', self, alignment=Qt.AlignRight) sb_sbnd = PyDMSpinbox(self, self.prop_pref + 'MD_FTUNE') sb_sbnd.showStepExponent = False sb_sbnd.showUnits = True ld_span = QLabel('Span', self, alignment=Qt.AlignRight) sb_span = PyDMSpinbox(self, self.prop_pref + 'MD_FSPAN') sb_span.showStepExponent = False sb_span.showUnits = True ld_mode = QLabel('Mode', self, alignment=Qt.AlignRight) sb_mode = PyDMSpinbox(self, self.prop_pref + 'MD_MSEL') sb_mode.showStepExponent = False ld_avg = QLabel('Sample Avg', self, alignment=Qt.AlignRight) sb_avg = PyDMSpinbox(self, self.prop_pref + 'MD_AVG') sb_avg.showStepExponent = False gb_ctrl = QGroupBox('Acquisition control', self) lay_ctrl = QGridLayout(gb_ctrl) lay_ctrl.addWidget(ld_enbl, 0, 0) lay_ctrl.addWidget(cb_enbl, 1, 0) lay_ctrl.addWidget(ld_sel, 2, 0) lay_ctrl.addWidget(cb_sel, 3, 0) lay_ctrl.addWidget(ld_sbnd, 0, 1) lay_ctrl.addWidget(sb_sbnd, 0, 2) lay_ctrl.addWidget(ld_span, 1, 1) lay_ctrl.addWidget(sb_span, 1, 2) lay_ctrl.addWidget(ld_mode, 2, 1) lay_ctrl.addWidget(sb_mode, 2, 2) lay_ctrl.addWidget(ld_avg, 3, 1) lay_ctrl.addWidget(sb_avg, 3, 2) # Markers ld_rng = QLabel('Range (kHz)', self, alignment=Qt.AlignCenter) le_low = PyDMLineEdit(self, self.prop_pref + 'MD_SP_LOW') le_high = PyDMLineEdit(self, self.prop_pref + 'MD_SP_HIGH') cb_mode = PyDMEnumComboBox(self, self.prop_pref + 'MD_SP_SEARCH') ld_mnum = QLabel('Mode #', self, alignment=Qt.AlignRight) lb_mnum = PyDMLabel(self, self.prop_pref + 'MD_MAXMODE') ld_mamp = QLabel('Mode Amp.', self, alignment=Qt.AlignRight) lb_mamp = PyDMLabel(self, self.prop_pref + 'MD_MAXVAL') ld_peak = QLabel('Value', self, alignment=Qt.AlignRight) lb_peak = PyDMLabel(self, self.prop_pref + 'MD_PEAK') ld_pfrq = QLabel('Freq', self, alignment=Qt.AlignRight) lb_pfrq = PyDMLabel(self, self.prop_pref + 'MD_PEAKFREQ') lb_pfrq.showUnits = True ld_tune = QLabel('Tune', self, alignment=Qt.AlignRight) lb_tune = PyDMLabel(self, self.prop_pref + 'MD_PEAKTUNE') gb_mark = QGroupBox('Marker', self) lay_mark = QGridLayout(gb_mark) lay_mark.addWidget(ld_rng, 0, 0) lay_mark.addWidget(le_low, 1, 0) lay_mark.addWidget(le_high, 2, 0) lay_mark.addWidget(cb_mode, 3, 0) lay_mark.addWidget(ld_mnum, 0, 1) lay_mark.addWidget(lb_mnum, 0, 2) lay_mark.addWidget(ld_mamp, 1, 1) lay_mark.addWidget(lb_mamp, 1, 2) lay_mark.addWidget(ld_peak, 2, 1) lay_mark.addWidget(lb_peak, 2, 2) lay_mark.addWidget(ld_pfrq, 3, 1) lay_mark.addWidget(lb_pfrq, 3, 2) lay_mark.addWidget(ld_tune, 4, 1) lay_mark.addWidget(lb_tune, 4, 2) ld_name = QLabel('<h2>' + self.acq_type + ' Modal Analysis</h2>', self, alignment=Qt.AlignCenter) self.setLayout(QHBoxLayout()) wid = QWidget(self) self.layout().addWidget(wid) set_bbb_color(wid, self._device) lay = QGridLayout(wid) lay.addWidget(ld_name, 0, 0, 1, 2) lay.addWidget(gp_mode, 1, 0, 1, 2) lay.addWidget(gp_spec, 2, 0, 1, 2) lay.addWidget(gb_ctrl, 3, 0) lay.addWidget(gb_mark, 3, 1) lay.setRowStretch(1, 2) lay.setRowStretch(2, 2)
def _setupUi(self): ld_dacs = QLabel('<h3>AD5644 DACs</h3>', self, alignment=Qt.AlignCenter) ld_dacch0 = QLabel('0', self, alignment=Qt.AlignCenter) ld_dacch0.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch0 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH0') sb_dacch0.showStepExponent = False sb_dacch0.showUnits = True fr_dacch0 = SiriusFrame(self, self.dev_pref + ':AD5644CH0_SUBWR') fr_dacch0.add_widget(sb_dacch0) ld_dacch1 = QLabel('1', self, alignment=Qt.AlignCenter) ld_dacch1.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch1 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH1') sb_dacch1.showStepExponent = False sb_dacch1.showUnits = True fr_dacch1 = SiriusFrame(self, self.dev_pref + ':AD5644CH1_SUBWR') fr_dacch1.add_widget(sb_dacch1) ld_dacch2 = QLabel('2', self, alignment=Qt.AlignCenter) ld_dacch2.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch2 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH2') sb_dacch2.showStepExponent = False sb_dacch2.showUnits = True fr_dacch2 = SiriusFrame(self, self.dev_pref + ':AD5644CH2_SUBWR') fr_dacch2.add_widget(sb_dacch2) ld_dacch3 = QLabel('3', self, alignment=Qt.AlignCenter) ld_dacch3.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch3 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH3') sb_dacch3.showStepExponent = False sb_dacch3.showUnits = True fr_dacch3 = SiriusFrame(self, self.dev_pref + ':AD5644CH3_SUBWR') fr_dacch3.add_widget(sb_dacch3) ld_dacref0 = QLabel('Ref\n0-3', self, alignment=Qt.AlignCenter) ld_dacref0.setStyleSheet('font-weight: bold; max-width: 3em;') cb_dacref0 = PyDMEnumComboBox(self, self.dev_pref + ':AD5644REF0_BO') ld_dacch4 = QLabel('4', self, alignment=Qt.AlignCenter) ld_dacch4.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch4 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH4') sb_dacch4.showStepExponent = False sb_dacch4.showUnits = True fr_dacch4 = SiriusFrame(self, self.dev_pref + ':AD5644CH4_SUBWR') fr_dacch4.add_widget(sb_dacch4) ld_dacch5 = QLabel('5', self, alignment=Qt.AlignCenter) ld_dacch5.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch5 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH5') sb_dacch5.showStepExponent = False sb_dacch5.showUnits = True fr_dacch5 = SiriusFrame(self, self.dev_pref + ':AD5644CH5_SUBWR') fr_dacch5.add_widget(sb_dacch5) ld_dacch6 = QLabel('6', self, alignment=Qt.AlignCenter) ld_dacch6.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch6 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH6') sb_dacch6.showStepExponent = False sb_dacch6.showUnits = True fr_dacch6 = SiriusFrame(self, self.dev_pref + ':AD5644CH6_SUBWR') fr_dacch6.add_widget(sb_dacch6) ld_dacch7 = QLabel('7', self, alignment=Qt.AlignCenter) ld_dacch7.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch7 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH7') sb_dacch7.showStepExponent = False sb_dacch7.showUnits = True fr_dacch7 = SiriusFrame(self, self.dev_pref + ':AD5644CH7_SUBWR') fr_dacch7.add_widget(sb_dacch7) ld_dacref1 = QLabel('Ref\n4-7', self, alignment=Qt.AlignCenter) ld_dacref1.setStyleSheet('font-weight: bold; max-width: 3em;') cb_dacref1 = PyDMEnumComboBox(self, self.dev_pref + ':AD5644REF1_BO') cb_dacmode = PyDMEnumComboBox(self, self.dev_pref + ':AD5644TEST_BO') lay = QGridLayout(self) lay.setAlignment(Qt.AlignCenter | Qt.AlignTop) lay.setHorizontalSpacing(15) lay.setVerticalSpacing(15) lay.addWidget(ld_dacs, 0, 1, 1, 5) lay.addWidget(ld_dacch0, 1, 1) lay.addWidget(fr_dacch0, 1, 2) lay.addWidget(ld_dacch1, 2, 1) lay.addWidget(fr_dacch1, 2, 2) lay.addWidget(ld_dacch2, 3, 1) lay.addWidget(fr_dacch2, 3, 2) lay.addWidget(ld_dacch3, 4, 1) lay.addWidget(fr_dacch3, 4, 2) lay.addWidget(ld_dacref0, 5, 1) lay.addWidget(cb_dacref0, 5, 2) lay.addWidget(ld_dacch4, 1, 4) lay.addWidget(fr_dacch4, 1, 5) lay.addWidget(ld_dacch5, 2, 4) lay.addWidget(fr_dacch5, 2, 5) lay.addWidget(ld_dacch6, 3, 4) lay.addWidget(fr_dacch6, 3, 5) lay.addWidget(ld_dacch7, 4, 4) lay.addWidget(fr_dacch7, 4, 5) lay.addWidget(ld_dacref1, 5, 4) lay.addWidget(cb_dacref1, 5, 5) lay.addWidget(cb_dacmode, 6, 1, 1, 5)
def _setupWaveformsWidget(self): gp_bunsig = WfmGraph(self) gp_bunsig.setPlotTitle('Bunch Signal') gp_bunsig.getAxis('bottom').setLabel('Time (ms)') gp_bunsig.getAxis('left').setLabel('CNT') gp_bunsig.add_scatter_curve(ychannel=self.dev_pref + ':SB_RAW', xchannel=self.dev_pref + ':SB_TSC', color=QColor('blue'), lineStyle=Qt.SolidLine, nchannel=self.dev_pref + ':SB_RAW_SAMPLES') gp_mag = WfmGraph(self) gp_mag.setPlotTitle('Magnitude') gp_mag.getAxis('bottom').setLabel('Frequency (kHz)') gp_mag.getAxis('left').setLabel('dB') gp_mag.add_scatter_curve(ychannel=self.dev_pref + ':SB_MAG', xchannel=self.dev_pref + ':SB_FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_mag.add_marker(self.dev_pref + ':SB_PEAKFREQ1', self.dev_pref + ':SB_PEAK1', name='Mag', color=QColor('magenta'), symbol='o') gp_phs = WfmGraph(self) gp_phs.setPlotTitle('Phase') gp_phs.getAxis('bottom').setLabel('Frequency (kHz)') gp_phs.getAxis('left').setLabel('deg') gp_phs.add_scatter_curve(ychannel=self.dev_pref + ':SB_PHASE', xchannel=self.dev_pref + ':SB_FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_phs.add_marker(self.dev_pref + ':SB_PEAKFREQ1', self.dev_pref + ':SB_PHASE1', name='Phs', color=QColor('magenta'), symbol='o') ld_tfenbl = QLabel('Transfer Function Enable', self) cb_tfenbl = PyDMEnumComboBox(self, self.dev_pref + ':SB_TF_ENABLE') ld_nrptsfft = QLabel('Number of points for FFT/Window', self) cb_nrptsfft = PyDMEnumComboBox(self, self.dev_pref + ':SB_NFFT') ld_fftovlap = QLabel('Overlap (Autolimited to NFFT/2)', self) cb_fftovlap = PyDMEnumComboBox(self, self.dev_pref + ':SB_NOVERLAP') ld_delaycal = QLabel('Delay Cal [ns]', self) le_delaycal = PyDMLineEdit(self, self.dev_pref + ':SB_DEL_CAL') ld_avg = QLabel('Averaging', self) sb_avg = PyDMSpinbox(self, self.dev_pref + ':SB_SP_AVG') sb_avg.showStepExponent = False gbox_fftsett = QGroupBox(self) lay_fftsett = QGridLayout(gbox_fftsett) lay_fftsett.addWidget(ld_tfenbl, 0, 0) lay_fftsett.addWidget(cb_tfenbl, 0, 1) lay_fftsett.addWidget(ld_nrptsfft, 1, 0) lay_fftsett.addWidget(cb_nrptsfft, 1, 1) lay_fftsett.addWidget(ld_fftovlap, 2, 0) lay_fftsett.addWidget(cb_fftovlap, 2, 1) lay_fftsett.addWidget(ld_delaycal, 3, 0) lay_fftsett.addWidget(le_delaycal, 3, 1) lay_fftsett.addWidget(ld_avg, 4, 0) lay_fftsett.addWidget(sb_avg, 4, 1) lay_graph = QGridLayout() lay_graph.addWidget(gp_bunsig, 0, 0) lay_graph.addWidget(gp_mag, 0, 1) lay_graph.addWidget(gbox_fftsett, 1, 0) lay_graph.addWidget(gp_phs, 1, 1) ld_acqenbl = QLabel('Acq. Enable', self) cb_acqenbl = PyDMStateButton(self, self.dev_pref + ':SB_ACQ_EN') ld_acqsing = QLabel('Acq. Mode', self) cb_acqsing = PyDMEnumComboBox(self, self.dev_pref + ':SB_ACQ_SINGLE') ld_mean = QLabel('Mean', self, alignment=Qt.AlignCenter) lb_mean = PyDMLabel(self, self.dev_pref + ':SB_MEANVAL') ld_rms = QLabel('RMS', self, alignment=Qt.AlignCenter) lb_rms = PyDMLabel(self, self.dev_pref + ':SB_RMSVAL') ld_ampp2p = QLabel('Amp P-P', self, alignment=Qt.AlignCenter) lb_ampp2p = PyDMLabel(self, self.dev_pref + ':SB_AMP_PP') ld_bunid = QLabel('Bunch ID', self, alignment=Qt.AlignCenter) lb_bunid = PyDMLabel(self, self.dev_pref + ':SB_RAW_BUNCH_ID') gbox_acqctrl = QGroupBox('Acquisition control', self) lay_acqctrl = QGridLayout(gbox_acqctrl) lay_acqctrl.addWidget(ld_acqenbl, 0, 0) lay_acqctrl.addWidget(cb_acqenbl, 0, 1) lay_acqctrl.addWidget(ld_acqsing, 1, 0) lay_acqctrl.addWidget(cb_acqsing, 1, 1) lay_acqctrl.addItem(QSpacerItem(15, 1, QSzPlcy.Fixed, QSzPlcy.Ignored), 0, 2, 2, 1) lay_acqctrl.addWidget(ld_mean, 0, 3) lay_acqctrl.addWidget(lb_mean, 0, 4) lay_acqctrl.addWidget(ld_ampp2p, 0, 5) lay_acqctrl.addWidget(lb_ampp2p, 0, 6) lay_acqctrl.addWidget(ld_rms, 1, 3) lay_acqctrl.addWidget(lb_rms, 1, 4) lay_acqctrl.addWidget(ld_bunid, 1, 5) lay_acqctrl.addWidget(lb_bunid, 1, 6) # Marker ld_mkspan = QLabel('Span (kHz)', self, alignment=Qt.AlignCenter) le_mklow = PyDMLineEdit(self, self.dev_pref + ':SB_SP_LOW1') le_mkhigh = PyDMLineEdit(self, self.dev_pref + ':SB_SP_HIGH1') ld_mkmode = QLabel('Mode', self, alignment=Qt.AlignCenter) cb_mkmode = PyDMEnumComboBox(self, self.dev_pref + ':SB_SP_SEARCH1') ld_mkfreq = QLabel('Frequency', self, alignment=Qt.AlignCenter) lb_mkfreq = PyDMLabel(self, self.dev_pref + ':SB_PEAKFREQ1') lb_mkfreq.showUnits = True ld_mktune = QLabel('Tune', self, alignment=Qt.AlignCenter) lb_mktune = PyDMLabel(self, self.dev_pref + ':SB_PEAKTUNE1') lb_mktune.showUnits = True ld_mkmag = QLabel('Magnitude', self, alignment=Qt.AlignCenter) lb_mkmag = PyDMLabel(self, self.dev_pref + ':SB_PEAK1') lb_mkmag.showUnits = True ld_mkphs = QLabel('Phase', self, alignment=Qt.AlignCenter) lb_mkphs = PyDMLabel(self, self.dev_pref + ':SB_PHASE1') lb_mkphs.showUnits = True lay = QGridLayout() lay.addWidget(ld_mkfreq, 1, 0) lay.addWidget(lb_mkfreq, 2, 0) lay.addWidget(ld_mktune, 1, 1) lay.addWidget(lb_mktune, 2, 1) lay.addWidget(ld_mkmag, 1, 2) lay.addWidget(lb_mkmag, 2, 2) lay.addWidget(ld_mkphs, 1, 3) lay.addWidget(lb_mkphs, 2, 3) lay.setRowStretch(0, 2) lay.setRowStretch(3, 2) gbox_mk = QGroupBox('Marker', self) lay_mk = QGridLayout(gbox_mk) lay_mk.addWidget(ld_mkmode, 0, 0) lay_mk.addWidget(cb_mkmode, 0, 1) lay_mk.addWidget(ld_mkspan, 1, 0, 1, 2) lay_mk.addWidget(le_mklow, 2, 0) lay_mk.addWidget(le_mkhigh, 2, 1) lay_mk.addLayout(lay, 0, 2, 3, 1) wid = QWidget() lay = QGridLayout(wid) lay.addLayout(lay_graph, 0, 0, 1, 2) lay.addWidget(gbox_acqctrl, 1, 0) lay.addWidget(gbox_mk, 1, 1) lay.setRowStretch(0, 5) lay.setRowStretch(1, 1) lay.setColumnStretch(0, 1) lay.setColumnStretch(1, 1) return wid
def _setupUi(self): ld_intlk = QLabel('<h3>Interlock Controls</h3>', self, alignment=Qt.AlignCenter) ld_sp = QLabel('Setpoint', self, alignment=Qt.AlignCenter) # ld_sp.setStyleSheet('font-weight: bold; max-width: 3em;') ld_cyc = QLabel('RF/4 Cycles', self, alignment=Qt.AlignCenter) # ld_cyc.setStyleSheet('font-weight: bold; max-width: 3em;') ld_sat = QLabel('Saturation Time', self) sb_sat = PyDMSpinbox(self, self.dev_pref + ':ILOCK_TSAT') sb_sat.showStepExponent = False sb_sat.showUnits = True lb_sat = SiriusLabel(self, self.dev_pref + ':ILOCK_TSAT_T2C') lb_sat.setAlignment(Qt.AlignCenter) ld_tim = QLabel('Timeout', self) sb_tim = PyDMSpinbox(self, self.dev_pref + ':ILOCK_TOUT') sb_tim.showStepExponent = False sb_tim.showUnits = True lb_tim = SiriusLabel(self, self.dev_pref + ':ILOCK_TOUT_T2C') lb_tim.setAlignment(Qt.AlignCenter) pvn = self.dev_pref + ':ILOCK_TRIPPED' lb_sts = SiriusLabel(self, init_channel=pvn) lb_sts.enum_strings = ['Status Ok', 'Interlocked'] lb_sts.displayFormat = lb_sts.DisplayFormat.String fr_sts = SiriusFrame(self, pvn, is_float=True) fr_sts.borderWidth = 2 fr_sts.add_widget(lb_sts) pb_rst = SiriusPushButton(self, init_channel=self.dev_pref + ':ILOCK_RESET', pressValue=1, releaseValue=0) pb_rst.setText('Reset') pb_rst.setToolTip('Reset Counts') pb_rst.setIcon(qta.icon('fa5s.sync')) wd_sts = QWidget(self) wd_sts.setLayout(QHBoxLayout()) wd_sts.layout().addStretch() wd_sts.layout().addWidget(fr_sts) wd_sts.layout().addStretch() wd_sts.layout().addWidget(pb_rst) wd_sts.layout().addStretch() ld_sens = QLabel('<h3>Sensitivity Controls</h3>', self, alignment=Qt.AlignCenter) ld_tun = QLabel('Fractional Tune', self) sb_tun = PyDMSpinbox(self, self.dev_pref + ':ILOCK_TUNE') sb_tun.showStepExponent = False sb_tun.showUnits = True ld_tap = QLabel('Filter Taps', self) sb_tap = PyDMSpinbox(self, self.dev_pref + ':ILOCK_TAPS') sb_tap.showStepExponent = False sb_tap.showUnits = True ld_cal = QLabel('Calibration', self) sb_cal = PyDMSpinbox(self, self.dev_pref + ':ILOCK_FE_CAL') sb_cal.showStepExponent = False sb_cal.showUnits = True ld_ncur = QLabel('Nominal Current', self) sb_ncur = PyDMSpinbox(self, self.dev_pref + ':ILOCK_CURRENT') sb_ncur.showStepExponent = False sb_ncur.showUnits = True ld_thr = QLabel('Threshold', self) sb_thr = PyDMSpinbox(self, self.dev_pref + ':ILOCK_THRESH') sb_thr.showStepExponent = False sb_thr.showUnits = True pb_upt = SiriusPushButton(self, init_channel=self.dev_pref + ':ILOCK_UPDATE', pressValue=1, releaseValue=0) pb_upt.setText('Update Filter') pb_upt.setToolTip('Update Filter Config') pb_upt.setIcon(qta.icon('mdi.sync')) pb_upt.setStyleSheet("icon-size:20px;") pb_ld = SiriusPushButton(self, init_channel=self.dev_pref + ':BO_CPCOEFF', pressValue=1, releaseValue=0) pb_ld.setText('Apply Filter') pb_ld.setToolTip('Apply Filter Config to Feedback') pb_ld.setIcon(qta.icon('mdi.upload')) pb_ld.setStyleSheet("icon-size:20px;") lay = QGridLayout(self) lay.setAlignment(Qt.AlignCenter | Qt.AlignTop) lay.addWidget(ld_intlk, 0, 0, 1, 5) lay.addWidget(ld_sp, 1, 1) lay.addWidget(ld_cyc, 1, 2) lay.addWidget(ld_sat, 2, 0) lay.addWidget(sb_sat, 2, 1) lay.addWidget(lb_sat, 2, 2) lay.addWidget(ld_tim, 3, 0) lay.addWidget(sb_tim, 3, 1) lay.addWidget(lb_tim, 3, 2) lay.addWidget(wd_sts, 4, 0, 1, 3) lays = QGridLayout() lays.addWidget(ld_sens, 0, 0, 1, 4) lays.addWidget(ld_tun, 1, 0) lays.addWidget(sb_tun, 1, 1) lays.addWidget(ld_tap, 2, 0) lays.addWidget(sb_tap, 2, 1) lays.addWidget(ld_cal, 3, 0) lays.addWidget(sb_cal, 3, 1) lays.addWidget(ld_ncur, 4, 0) lays.addWidget(sb_ncur, 4, 1) lays.addWidget(ld_thr, 1, 2) lays.addWidget(sb_thr, 1, 3) lays.addWidget(pb_upt, 3, 2, 1, 2) lays.addWidget(pb_ld, 4, 2, 1, 2) lay.addLayout(lays, 5, 0, 1, 3)