From 3824a098a9eb828020425d65a43a068eb850d9ea Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Wed, 27 Sep 2023 13:16:29 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D1=8F=D0=B5=D1=82=20=D0=B4=D0=BE=20PySide2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- statapp/generate_factor_window.py | 5 ++--- statapp/main_window.py | 21 ++++++--------------- statapp/models/combobox_model.py | 2 +- statapp/ui/ui_generate_factor_window.py | 17 +++++------------ statapp/ui/ui_generate_window.py | 3 +-- 5 files changed, 15 insertions(+), 33 deletions(-) diff --git a/statapp/generate_factor_window.py b/statapp/generate_factor_window.py index 4f1ba1e..08dd441 100644 --- a/statapp/generate_factor_window.py +++ b/statapp/generate_factor_window.py @@ -1,6 +1,5 @@ -from PySide6.QtCore import Slot -from PySide6.QtGui import QIntValidator -from PySide6.QtWidgets import QDialog +from PySide2.QtCore import Slot +from PySide2.QtWidgets import QDialog from statapp.ui.ui_generate_factor_window import Ui_GenerateFactorWindow from statapp.models.combobox_model import ComboBoxModel diff --git a/statapp/main_window.py b/statapp/main_window.py index 15be8b4..079c397 100644 --- a/statapp/main_window.py +++ b/statapp/main_window.py @@ -8,6 +8,7 @@ from statapp.generate_window import GenerateWindow from statapp.about_window import AboutWindow from statapp.ui.ui_main_window import Ui_MainWindow + class MainWindow(QMainWindow): def __init__(self): super().__init__() @@ -22,36 +23,27 @@ class MainWindow(QMainWindow): gw = GenerateWindow() if gw.exec(): y = np.random.normal(gw.mat, gw.deviation, size=(gw.count, 1)) - - # self.model._data = y self.model.updateAllData(y) @Slot() def on_generateXaction_triggered(self): gfw = GenerateFactorWindow() + + # dd = np.array([]) + if gfw.exec(): y = self.model.getY() yMat = np.mean(y) x_arr = np.array([]) - # y - 5 x1 - прямая 4 -> 6 - # 7 - # - # - - dd = np.array([]) - for cur_y in y: k = np.abs(cur_y / yMat) + if k > 1: + k = 2 - 1 / k if gfw.typeConnection == INDIRECT_LINK: k = 1 / k - # def f(x): - # x = np.abs(x) - # return 2.01375 - (1 / np.exp(x - 0.7)) - - # k = f(k) x = np.random.normal(gfw.mat * (k ** 3), gfw.deviation * k, size=1) x_arr = np.append(x_arr, x) # if (x > gfw.mat and cur_y > yMat) or (x < gfw.mat and cur_y < yMat): @@ -61,7 +53,6 @@ class MainWindow(QMainWindow): data = self.model.getData() - # self.model._data = y x_arr = x_arr.reshape(len(x_arr), 1) # dd = dd.reshape(len(dd), 1) data = np.concatenate((data, x_arr), axis=1) diff --git a/statapp/models/combobox_model.py b/statapp/models/combobox_model.py index 5c6f7a6..cc33814 100644 --- a/statapp/models/combobox_model.py +++ b/statapp/models/combobox_model.py @@ -1,4 +1,4 @@ -from PySide6.QtCore import QAbstractListModel, Qt +from PySide2.QtCore import QAbstractListModel, Qt class ComboBoxModel(QAbstractListModel): diff --git a/statapp/ui/ui_generate_factor_window.py b/statapp/ui/ui_generate_factor_window.py index c172f5c..e851549 100644 --- a/statapp/ui/ui_generate_factor_window.py +++ b/statapp/ui/ui_generate_factor_window.py @@ -3,21 +3,15 @@ ################################################################################ ## Form generated from reading UI file 'generate_factor_window.ui' ## -## Created by: Qt User Interface Compiler version 6.5.2 +## Created by: Qt User Interface Compiler version 5.15.2 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ -from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, - QMetaObject, QObject, QPoint, QRect, - QSize, QTime, QUrl, Qt) -from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, - QFont, QFontDatabase, QGradient, QIcon, - QImage, QKeySequence, QLinearGradient, QPainter, - QPalette, QPixmap, QRadialGradient, QTransform) -from PySide6.QtWidgets import (QApplication, QComboBox, QDialog, QDoubleSpinBox, - QGridLayout, QLabel, QPushButton, QSizePolicy, - QWidget) +from PySide2.QtCore import * +from PySide2.QtGui import * +from PySide2.QtWidgets import * + class Ui_GenerateFactorWindow(object): def setupUi(self, GenerateFactorWindow): @@ -93,4 +87,3 @@ class Ui_GenerateFactorWindow(object): self.typeComboBox.setCurrentText("") self.typeComboBox.setPlaceholderText("") # retranslateUi - diff --git a/statapp/ui/ui_generate_window.py b/statapp/ui/ui_generate_window.py index 2190548..f28d09f 100644 --- a/statapp/ui/ui_generate_window.py +++ b/statapp/ui/ui_generate_window.py @@ -17,7 +17,7 @@ class Ui_GenerateWindow(object): def setupUi(self, GenerateWindow): if not GenerateWindow.objectName(): GenerateWindow.setObjectName(u"GenerateWindow") - GenerateWindow.resize(503, 381) + GenerateWindow.resize(503, 182) font = QFont() font.setPointSize(12) GenerateWindow.setFont(font) @@ -83,4 +83,3 @@ class Ui_GenerateWindow(object): self.label_3.setText(QCoreApplication.translate("GenerateWindow", u"\u0421\u0440\u0435\u0434\u043d\u0435\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435", None)) self.label.setText(QCoreApplication.translate("GenerateWindow", u"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439", None)) # retranslateUi -