From 256bc2084608e5118989e01a2a89c17ebf60c82d Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Thu, 18 Jan 2024 17:39:12 +0100 Subject: [PATCH] add hint to sort before averaging --- src/gui_qt/_py/smoothdialog.py | 97 +++++++++-------- src/resources/_ui/smoothdialog.ui | 172 ++++++++++++++++-------------- 2 files changed, 142 insertions(+), 127 deletions(-) diff --git a/src/gui_qt/_py/smoothdialog.py b/src/gui_qt/_py/smoothdialog.py index 634fde5..7d2d758 100644 --- a/src/gui_qt/_py/smoothdialog.py +++ b/src/gui_qt/_py/smoothdialog.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'resources/_ui/smoothdialog.ui' +# Form implementation generated from reading ui file 'src/resources/_ui/smoothdialog.ui' # -# Created by: PyQt5 UI code generator 5.12.3 +# Created by: PyQt5 UI code generator 5.15.10 # -# WARNING! All changes made in this file will be lost! +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtGui, QtWidgets @@ -17,9 +18,37 @@ class Ui_SmoothDialog(object): self.gridLayout = QtWidgets.QGridLayout(SmoothDialog) self.gridLayout.setSpacing(3) self.gridLayout.setObjectName("gridLayout") + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem, 7, 0, 1, 1) self.frac_label = QtWidgets.QLabel(SmoothDialog) self.frac_label.setObjectName("frac_label") - self.gridLayout.addWidget(self.frac_label, 1, 0, 1, 1) + self.gridLayout.addWidget(self.frac_label, 2, 0, 1, 1) + self.line = QtWidgets.QFrame(SmoothDialog) + self.line.setFrameShape(QtWidgets.QFrame.HLine) + self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setObjectName("line") + self.gridLayout.addWidget(self.line, 5, 0, 1, 2) + self.widget = QtWidgets.QWidget(SmoothDialog) + self.widget.setObjectName("widget") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget) + self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_2.setSpacing(3) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.label = QtWidgets.QLabel(self.widget) + self.label.setObjectName("label") + self.horizontalLayout_2.addWidget(self.label) + self.polynom_spinBox = QtWidgets.QSpinBox(self.widget) + self.polynom_spinBox.setMinimum(1) + self.polynom_spinBox.setMaximum(3) + self.polynom_spinBox.setObjectName("polynom_spinBox") + self.horizontalLayout_2.addWidget(self.polynom_spinBox) + self.gridLayout.addWidget(self.widget, 3, 0, 1, 2) + self.y_checkBox = QtWidgets.QCheckBox(SmoothDialog) + self.y_checkBox.setObjectName("y_checkBox") + self.gridLayout.addWidget(self.y_checkBox, 6, 1, 1, 1) + self.x_checkBox = QtWidgets.QCheckBox(SmoothDialog) + self.x_checkBox.setObjectName("x_checkBox") + self.gridLayout.addWidget(self.x_checkBox, 6, 0, 1, 1) self.widget_2 = QtWidgets.QWidget(SmoothDialog) self.widget_2.setObjectName("widget_2") self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.widget_2) @@ -35,37 +64,17 @@ class Ui_SmoothDialog(object): self.iter_spinBox.setProperty("value", 1) self.iter_spinBox.setObjectName("iter_spinBox") self.horizontalLayout_3.addWidget(self.iter_spinBox) - self.gridLayout.addWidget(self.widget_2, 3, 0, 1, 2) - self.line = QtWidgets.QFrame(SmoothDialog) - self.line.setFrameShape(QtWidgets.QFrame.HLine) - self.line.setFrameShadow(QtWidgets.QFrame.Sunken) - self.line.setObjectName("line") - self.gridLayout.addWidget(self.line, 4, 0, 1, 2) - self.buttonBox = QtWidgets.QDialogButtonBox(SmoothDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 7, 0, 1, 2) - self.widget = QtWidgets.QWidget(SmoothDialog) - self.widget.setObjectName("widget") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget) - self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_2.setSpacing(3) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.label = QtWidgets.QLabel(self.widget) - self.label.setObjectName("label") - self.horizontalLayout_2.addWidget(self.label) - self.polynom_spinBox = QtWidgets.QSpinBox(self.widget) - self.polynom_spinBox.setMinimum(1) - self.polynom_spinBox.setMaximum(3) - self.polynom_spinBox.setObjectName("polynom_spinBox") - self.horizontalLayout_2.addWidget(self.polynom_spinBox) - self.gridLayout.addWidget(self.widget, 2, 0, 1, 2) + self.gridLayout.addWidget(self.widget_2, 4, 0, 1, 2) self.frac_spinBox = QtWidgets.QSpinBox(SmoothDialog) self.frac_spinBox.setMinimum(1) self.frac_spinBox.setMaximum(999) self.frac_spinBox.setObjectName("frac_spinBox") - self.gridLayout.addWidget(self.frac_spinBox, 1, 1, 1, 1) + self.gridLayout.addWidget(self.frac_spinBox, 2, 1, 1, 1) + self.buttonBox = QtWidgets.QDialogButtonBox(SmoothDialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 8, 0, 1, 2) self.comboBox = QtWidgets.QComboBox(SmoothDialog) self.comboBox.setObjectName("comboBox") self.comboBox.addItem("") @@ -77,22 +86,17 @@ class Ui_SmoothDialog(object): self.comboBox.addItem("") self.comboBox.addItem("") self.comboBox.addItem("") - self.gridLayout.addWidget(self.comboBox, 0, 0, 1, 2) - spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem, 6, 0, 1, 1) - self.y_checkBox = QtWidgets.QCheckBox(SmoothDialog) - self.y_checkBox.setObjectName("y_checkBox") - self.gridLayout.addWidget(self.y_checkBox, 5, 1, 1, 1) - self.x_checkBox = QtWidgets.QCheckBox(SmoothDialog) - self.x_checkBox.setObjectName("x_checkBox") - self.gridLayout.addWidget(self.x_checkBox, 5, 0, 1, 1) + self.gridLayout.addWidget(self.comboBox, 1, 0, 1, 2) + self.label_2 = QtWidgets.QLabel(SmoothDialog) + self.label_2.setObjectName("label_2") + self.gridLayout.addWidget(self.label_2, 0, 0, 1, 2) self.frac_label.setBuddy(self.frac_spinBox) - self.label_3.setBuddy(self.iter_spinBox) self.label.setBuddy(self.polynom_spinBox) + self.label_3.setBuddy(self.iter_spinBox) self.retranslateUi(SmoothDialog) - self.buttonBox.accepted.connect(SmoothDialog.accept) - self.buttonBox.rejected.connect(SmoothDialog.reject) + self.buttonBox.accepted.connect(SmoothDialog.accept) # type: ignore + self.buttonBox.rejected.connect(SmoothDialog.reject) # type: ignore QtCore.QMetaObject.connectSlotsByName(SmoothDialog) SmoothDialog.setTabOrder(self.comboBox, self.frac_spinBox) SmoothDialog.setTabOrder(self.frac_spinBox, self.polynom_spinBox) @@ -104,9 +108,11 @@ class Ui_SmoothDialog(object): _translate = QtCore.QCoreApplication.translate SmoothDialog.setWindowTitle(_translate("SmoothDialog", "1D smoothing filter")) self.frac_label.setText(_translate("SmoothDialog", "Window length")) - self.label_3.setText(_translate("SmoothDialog", "Iterations")) self.label.setText(_translate("SmoothDialog", "Polynomial degree")) self.polynom_spinBox.setToolTip(_translate("SmoothDialog", "Deg")) + self.y_checkBox.setText(_translate("SmoothDialog", "y log-spaced?")) + self.x_checkBox.setText(_translate("SmoothDialog", "x log-spaced?")) + self.label_3.setText(_translate("SmoothDialog", "Iterations")) self.frac_spinBox.setToolTip(_translate("SmoothDialog", "

Number of data points used as smoothing window.

")) self.comboBox.setItemText(0, _translate("SmoothDialog", "Moving mean")) self.comboBox.setItemText(1, _translate("SmoothDialog", "Savitzky-Golay")) @@ -117,5 +123,4 @@ class Ui_SmoothDialog(object): self.comboBox.setItemText(6, _translate("SmoothDialog", "Moving maximum")) self.comboBox.setItemText(7, _translate("SmoothDialog", "Moving minimum")) self.comboBox.setItemText(8, _translate("SmoothDialog", "Moving sum")) - self.y_checkBox.setText(_translate("SmoothDialog", "y log-spaced?")) - self.x_checkBox.setText(_translate("SmoothDialog", "x log-spaced?")) + self.label_2.setText(_translate("SmoothDialog", "

Note: Sets must be sorted for correct results

")) diff --git a/src/resources/_ui/smoothdialog.ui b/src/resources/_ui/smoothdialog.ui index e26b521..19e63ec 100644 --- a/src/resources/_ui/smoothdialog.ui +++ b/src/resources/_ui/smoothdialog.ui @@ -17,7 +17,20 @@ 3 - + + + + Qt::Vertical + + + + 20 + 40 + + + + + Window length @@ -27,68 +40,14 @@ - - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Iterations - - - iter_spinBox - - - - - - - 3 - - - 1 - - - 1 - - - - - - - + Qt::Horizontal - - - - Qt::Horizontal - - - QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - + @@ -132,7 +91,65 @@ - + + + + y log-spaced? + + + + + + + x log-spaced? + + + + + + + + 3 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Iterations + + + iter_spinBox + + + + + + + 3 + + + 1 + + + 1 + + + + + + + <html><head/><body><p>Number of data points used as smoothing window.</p></body></html> @@ -145,7 +162,17 @@ - + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + @@ -194,30 +221,13 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + - y log-spaced? + <html><head/><body><p><span style=" font-weight:600;">Note:</span> Sets must be sorted for correct results</p></body></html> - - - - - - x log-spaced? + + 3