Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter configs in FOFB window #695

Merged
merged 5 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyqt-apps/siriushla/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.1.0
66 changes: 59 additions & 7 deletions pyqt-apps/siriushla/as_ps_control/detail_widget/PSDetailWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,14 @@ def _fofbctrlLayout(self):
self.fofbaccminsat_rb.precisionFromPV = False
self.fofbaccminsat_rb.precision = 8

fofbaccfiltgain_lb = QLabel(
'Filter Gain', self,
alignment=Qt.AlignRight | Qt.AlignVCenter)
self.fofbaccfiltgain_sp = PyDMLineEdit(
self, self._prefixed_psname + ':FOFBAccFilterGain-SP')
self.fofbaccfiltgain_rb = SiriusLabel(
self, self._prefixed_psname + ':FOFBAccFilterGain-RB')

widctrl = QWidget()
lay = QGridLayout(widctrl)
lay.addWidget(fofbacc_lb, 0, 0, Qt.AlignRight)
Expand All @@ -1953,6 +1961,9 @@ def _fofbctrlLayout(self):
lay.addWidget(fofbaccminsat_lb, 5, 0, Qt.AlignRight)
lay.addWidget(self.fofbaccminsat_sp, 5, 1)
lay.addWidget(self.fofbaccminsat_rb, 5, 2)
lay.addWidget(fofbaccfiltgain_lb, 6, 0, Qt.AlignRight)
lay.addWidget(self.fofbaccfiltgain_sp, 6, 1)
lay.addWidget(self.fofbaccfiltgain_rb, 6, 2)

# coefficients
gph_fofbcoeffs = dict()
Expand Down Expand Up @@ -1985,17 +1996,58 @@ def _fofbctrlLayout(self):
gph_fofbcoeffs[plane].curveAtIndex(0).setVisible)
self.show_coeff_rb.stateChanged.connect(
gph_fofbcoeffs[plane].curveAtIndex(1).setVisible)
hbox_show = QHBoxLayout()
hbox_show.setAlignment(Qt.AlignCenter)
hbox_show.addWidget(self.show_coeff_sp)
hbox_show.addWidget(self.show_coeff_rb)
hbox_coeffshow = QHBoxLayout()
hbox_coeffshow.setAlignment(Qt.AlignCenter)
hbox_coeffshow.addWidget(self.show_coeff_sp)
hbox_coeffshow.addWidget(self.show_coeff_rb)

widmon = QWidget()
lay = QVBoxLayout(widmon)
widcoeff = QWidget()
lay = QVBoxLayout(widcoeff)
lay.setAlignment(Qt.AlignTop)
for plane in ['X', 'Y']:
lay.addWidget(gph_fofbcoeffs[plane])
lay.addLayout(hbox_show)
lay.addLayout(hbox_coeffshow)

# filters
gph_filt = SiriusWaveformPlot()
gph_filt.setSizePolicy(QSzPlcy.Maximum, QSzPlcy.Maximum)
gph_filt.showLegend = True
gph_filt.autoRangeX = True
gph_filt.autoRangeY = True
gph_filt.showXGrid = True
gph_filt.showYGrid = True
gph_filt.title = 'Filter Coefficients'
gph_filt.setBackgroundColor(QColor(255, 255, 255))
gph_filt.addChannel(
y_channel=self._prefixed_psname+':FOFBAccFilter-SP',
name='SP', color='darkBlue', lineWidth=2, symbol='o')
gph_filt.addChannel(
y_channel=self._prefixed_psname+':FOFBAccFilter-RB',
name='RB', color='blue', lineWidth=2, symbol='o')

self.show_filt_sp = QCheckBox('SP')
self.show_filt_sp.setChecked(True)
self.show_filt_rb = QCheckBox('RB')
self.show_filt_rb.setChecked(True)
self.show_filt_sp.stateChanged.connect(
gph_filt.curveAtIndex(0).setVisible)
self.show_filt_rb.stateChanged.connect(
gph_filt.curveAtIndex(1).setVisible)
hbox_filtshow = QHBoxLayout()
hbox_filtshow.setAlignment(Qt.AlignCenter)
hbox_filtshow.addWidget(self.show_filt_sp)
hbox_filtshow.addWidget(self.show_filt_rb)

widfilt = QWidget()
lay = QVBoxLayout(widfilt)
lay.setAlignment(Qt.AlignTop)
lay.addWidget(gph_filt)
lay.addLayout(hbox_filtshow)

widmon = QTabWidget()
widmon.setObjectName(self._psname.sec+'Tab')
widmon.addTab(widcoeff, 'InvRespMat')
widmon.addTab(widfilt, 'Filter')

layout = QHBoxLayout()
layout.addWidget(widctrl)
Expand Down
31 changes: 31 additions & 0 deletions pyqt-apps/siriushla/si_ap_fofb/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,37 @@ def _setupDetailsWidget(self):
glay2.addWidget(lbl, 3, 0)
glay2.addLayout(hbox, 3, 1, 1, 2)

ld_acc_filter = QLabel(
'Filter: ', self, alignment=Qt.AlignRight | Qt.AlignVCenter)
pref = self.devpref
visrule = (
'[{"name": "VisRule", "property": "Visible", ' +
'"expression": "ch[0] == 2", "channels": ' +
'[{"channel": "' +
pref.substitute(propty='FOFBAccFilter-Sel') +
'", "trigger": true}]}]')
sel_acc_filter = SiriusEnumComboBox(
self, pref.substitute(propty = 'FOFBAccFilter-Sel'))
sts_acc_filter = SiriusLabel(
self, pref.substitute(propty='FOFBAccFilter-Sts'))
sts_acc_filter.rules = visrule.replace('==', '!=')

ld_filter_gain = QLabel(
'Filter Gain: ', self, alignment=Qt.AlignRight | Qt.AlignVCenter)
sb_filter_gain = SiriusSpinbox(
self, self.devpref.substitute(propty='FOFBAccFilterGain-SP'))
lb_filter_gain = SiriusLabel(
self, self.devpref.substitute(propty='FOFBAccFilterGain-RB'))

hbox = QHBoxLayout()
hbox.addWidget(sel_acc_filter)
hbox.addWidget(sts_acc_filter)
glay2.addWidget(ld_acc_filter, 4, 0)
glay2.addLayout(hbox, 4, 1, 1, 2)
glay2.addWidget(ld_filter_gain, 5, 0)
glay2.addWidget(sb_filter_gain, 5, 1)
glay2.addWidget(lb_filter_gain, 5, 2)

glay.addLayout(glay2)

elif 'Control' in group:
Expand Down
Loading