6 Commits

Author SHA1 Message Date
github-actions[bot]
71e68a645d chore(main): release 0.10.1 (#99)
🤖 I have created a release *beep* *boop*
---


##
[0.10.1](https://github.com/shizand/statapp/compare/v0.10.0...v0.10.1)
(2024-01-29)


### Исправления

* Добавлена обработка ошибок
([#98](https://github.com/shizand/statapp/issues/98))
([c36e1aa](c36e1aa733))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-29 11:19:48 +03:00
MisterMLiL
c36e1aa733 fix: Добавлена обработка ошибок (#98)
Closes #83
Closes #96
Closes #97 

Добавлена обобщенная обработка на большинство методов.
Один из вариантов временно (а может и постоянно)  решить проблемы.
2024-01-29 11:11:53 +03:00
github-actions[bot]
1c88acf772 chore(main): release 0.10.0 (#95)
🤖 I have created a release *beep* *boop*
---


## [0.10.0](https://github.com/shizand/statapp/compare/v0.9.0...v0.10.0)
(2024-01-08)


### Новые функции

* добавлен график ([#94](https://github.com/shizand/statapp/issues/94))
([bb1b2f1](bb1b2f1ec5)),
closes [#86](https://github.com/shizand/statapp/issues/86)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-08 18:57:33 +03:00
bb1b2f1ec5 feat: добавлен график (#94)
Closes #86
2024-01-08 16:09:12 +03:00
github-actions[bot]
7cbb93e37c chore(main): release 0.9.0 (#93)
🤖 I have created a release *beep* *boop*
---


## [0.9.0](https://github.com/shizand/statapp/compare/v0.8.0...v0.9.0)
(2024-01-02)


### Новые функции

* добавлен "Прогноз"
([#92](https://github.com/shizand/statapp/issues/92))
([8ea3cff](8ea3cffa7e)),
closes [#85](https://github.com/shizand/statapp/issues/85)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-02 17:29:45 +03:00
8ea3cffa7e feat: добавлен "Прогноз" (#92)
Closes #85
2024-01-02 17:22:59 +03:00
43 changed files with 474 additions and 407 deletions

2
.idea/misc.xml generated
View File

@@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Poetry (statapp)" /> <option name="sdkName" value="Poetry (statapp)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="statapp" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Poetry (statapp) (2)" project-jdk-type="Python SDK" />
</project> </project>

View File

@@ -1,15 +1,15 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="statapp" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> <configuration default="false" name="statapp" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="stat" /> <module name="stat" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="SDK_NAME" value="Poetry (statapp)" />
<option name="WORKING_DIRECTORY" value="" /> <option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="statapp" /> <option name="SCRIPT_NAME" value="statapp" />

2
.idea/stat.iml generated
View File

@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="statapp" jdkType="Python SDK" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View File

@@ -24,4 +24,5 @@ disable=
missing-docstring, missing-docstring,
too-many-public-methods, too-many-public-methods,
too-few-public-methods, too-few-public-methods,
too-many-arguments too-many-arguments,
broad-except

View File

@@ -1,5 +1,26 @@
# Changelog # Changelog
## [0.10.1](https://github.com/shizand/statapp/compare/v0.10.0...v0.10.1) (2024-01-29)
### Исправления
* Добавлена обработка ошибок ([#98](https://github.com/shizand/statapp/issues/98)) ([c36e1aa](https://github.com/shizand/statapp/commit/c36e1aa733269720366c4d7dea48d2bdc966a59a))
## [0.10.0](https://github.com/shizand/statapp/compare/v0.9.0...v0.10.0) (2024-01-08)
### Новые функции
* добавлен график ([#94](https://github.com/shizand/statapp/issues/94)) ([bb1b2f1](https://github.com/shizand/statapp/commit/bb1b2f1ec5b988bcb8ddd7500b95fe9e35c826f5)), closes [#86](https://github.com/shizand/statapp/issues/86)
## [0.9.0](https://github.com/shizand/statapp/compare/v0.8.0...v0.9.0) (2024-01-02)
### Новые функции
* добавлен "Прогноз" ([#92](https://github.com/shizand/statapp/issues/92)) ([8ea3cff](https://github.com/shizand/statapp/commit/8ea3cffa7e0d920141c8eda71952ff02d2c02905)), closes [#85](https://github.com/shizand/statapp/issues/85)
## [0.8.0](https://github.com/shizand/statapp/compare/v0.7.0...v0.8.0) (2023-12-31) ## [0.8.0](https://github.com/shizand/statapp/compare/v0.7.0...v0.8.0) (2023-12-31)

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "statapp" name = "statapp"
version = "0.8.0" version = "0.10.1"
description = "" description = ""
authors = [ authors = [
"Maxim Slipenko <statapp@maks1ms.addy.io>" "Maxim Slipenko <statapp@maks1ms.addy.io>"

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -39,5 +39,6 @@ def main():
window.show() window.show()
return app.exec_() return app.exec_()
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main()) sys.exit(main())

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -21,6 +21,7 @@ from dataclasses import dataclass
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import sympy as sp
from statapp._vendor.multipolyfit import multipolyfit, getTerms from statapp._vendor.multipolyfit import multipolyfit, getTerms
DIRECT_LINK = 0 DIRECT_LINK = 0
@@ -135,3 +136,39 @@ def calculateStats(data, params, residues, y):
out[1] = tStatistics out[1] = tStatistics
return out, mse[0], scaledResidualVariance, rSquared, fStatistic return out, mse[0], scaledResidualVariance, rSquared, fStatistic
def prediction(inputData, result: RegressionResult):
inputs = inputData[:, 1:]
outputs = inputData[:, 0]
params = result.paramsAndImportance[:, 0]
expr = sp.sympify(' '.join(
[
f'{param}' if m == 'c' else f' + ({param}) * {m}'
for param, m in zip(params, result.monomials)
]
))
results = []
for y, xValues in zip(outputs, inputs):
subsDict = dict(zip(expr.free_symbols, xValues))
predictedResult = expr.subs(subsDict)
difference = predictedResult - y
results.append([y, predictedResult, difference, 0.0])
results = np.array(results, dtype=np.float32)
# Расчет среднего значения и стандартного отклонения разностей
meanDifference = np.mean(results[:, 2])
stdDifference = np.std(results[:, 2])
# Установка флага 1.0, если разность выходит за пределы 3 стандартных отклонений
for row in results:
if abs(row[2] - meanDifference) > 3 * stdDifference:
row[3] = 1.0
return results

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -33,7 +33,7 @@ from statapp.about_window import AboutWindow
from statapp.models.fileslc_model import FileSLCModel from statapp.models.fileslc_model import FileSLCModel
from statapp.polynoms.squared_polynom_window import SquaredPolynomWindow from statapp.polynoms.squared_polynom_window import SquaredPolynomWindow
from statapp.ui.ui_main_window import Ui_MainWindow from statapp.ui.ui_main_window import Ui_MainWindow
from statapp.utils import buildMessageBox, addIcon, FloatDelegate from statapp.utils import buildMessageBox, addIcon, FloatDelegate, onError
from statapp.variance_analysis import VarianceAnalysisWindow from statapp.variance_analysis import VarianceAnalysisWindow
from statapp.correlation_analysis import CorrelationAnalysisWindow from statapp.correlation_analysis import CorrelationAnalysisWindow
from statapp.polynoms.transform_polynom_window import TransformPolynomWindow from statapp.polynoms.transform_polynom_window import TransformPolynomWindow
@@ -103,6 +103,7 @@ class MainWindow(QMainWindow):
@Slot() @Slot()
def on_openfileaction_triggered(self): def on_openfileaction_triggered(self):
try:
currentData = self.model.getData() currentData = self.model.getData()
data = np.array([]) data = np.array([])
if currentData.size > 1: if currentData.size > 1:
@@ -137,28 +138,40 @@ class MainWindow(QMainWindow):
if data is not None and data.shape[0] > 0: if data is not None and data.shape[0] > 0:
self.model.updateAllData(data) self.model.updateAllData(data)
self.isDataChanged = False self.isDataChanged = False
except Exception as error:
onError(error)
@Slot() @Slot()
def on_savefileaction_triggered(self): def on_savefileaction_triggered(self):
try:
self.isDataChanged = not self.fileModel.saveFile(self.model.getData()) self.isDataChanged = not self.fileModel.saveFile(self.model.getData())
except Exception as error:
onError(error)
@Slot() @Slot()
def on_closefileaction_triggered(self): def on_closefileaction_triggered(self):
try:
self.fileModel.closeFile() self.fileModel.closeFile()
self.isDataChanged = False self.isDataChanged = False
except Exception as error:
onError(error)
@Slot() @Slot()
def on_generateYaction_triggered(self): def on_generateYaction_triggered(self):
try:
gw = GenerateWindow() gw = GenerateWindow()
if gw.exec(): if gw.exec():
y = generateYValues(gw.mat, gw.deviation, gw.count) y = generateYValues(gw.mat, gw.deviation, gw.count)
self.model.updateAllData(y.round(NUMBERS_PRECISION)) self.model.updateAllData(y.round(NUMBERS_PRECISION))
self.isDataChanged = True self.isDataChanged = True
except Exception as error:
onError(error)
@Slot() @Slot()
def on_generateXaction_triggered(self): def on_generateXaction_triggered(self):
try:
gfw = GenerateFactorWindow() gfw = GenerateFactorWindow()
if gfw.exec(): if gfw.exec():
@@ -168,6 +181,8 @@ class MainWindow(QMainWindow):
data = np.concatenate((data, xValues.round(NUMBERS_PRECISION)), axis=1) data = np.concatenate((data, xValues.round(NUMBERS_PRECISION)), axis=1)
self.model.updateAllData(data) self.model.updateAllData(data)
self.isDataChanged = True self.isDataChanged = True
except Exception as error:
onError(error)
@Slot() @Slot()
def on_aboutmenuaction_triggered(self): def on_aboutmenuaction_triggered(self):
@@ -176,28 +191,43 @@ class MainWindow(QMainWindow):
@Slot() @Slot()
def on_varianceAnalysisAction_triggered(self): def on_varianceAnalysisAction_triggered(self):
try:
dw = VarianceAnalysisWindow(self.model.getData()) dw = VarianceAnalysisWindow(self.model.getData())
dw.exec() dw.exec()
except Exception as error:
onError(error)
@Slot() @Slot()
def on_correlationAnalisisAction_triggered(self): def on_correlationAnalisisAction_triggered(self):
try:
dw = CorrelationAnalysisWindow(self.model.getData()) dw = CorrelationAnalysisWindow(self.model.getData())
dw.exec() dw.exec()
except Exception as error:
onError(error)
@Slot() @Slot()
def on_linearPolynomAction_triggered(self): def on_linearPolynomAction_triggered(self):
try:
dw = LinearPolynomWindow(self.model.getData()) dw = LinearPolynomWindow(self.model.getData())
dw.exec() dw.exec()
except Exception as error:
onError(error)
@Slot() @Slot()
def on_squaredPolynomAction_triggered(self): def on_squaredPolynomAction_triggered(self):
try:
dw = SquaredPolynomWindow(self.model.getData()) dw = SquaredPolynomWindow(self.model.getData())
dw.exec() dw.exec()
except Exception as error:
onError(error)
@Slot() @Slot()
def on_transformPolynomAction_triggered(self): def on_transformPolynomAction_triggered(self):
try:
dw = TransformPolynomWindow(self.model.getData()) dw = TransformPolynomWindow(self.model.getData())
dw.exec() dw.exec()
except Exception as error:
onError(error)
def closeEvent(self, event): def closeEvent(self, event):
if self.isDataChanged: if self.isDataChanged:

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -0,0 +1,33 @@
#
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
#
# This file is part of Statapp
# (see https://github.com/shizand/statapp).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from PySide2.QtCore import Qt
from statapp.models.ro_table_model import ROTableModel
class PreditionTableModel(ROTableModel):
def getHorizontalHeader(self):
return ['Отклик', 'Прогноз', 'Отклонение', '1-3 сигмовые зоны']
def data(self, index, role):
if role == Qt.DisplayRole and index.column() == 3:
value = super().data(index, role)
return 'x' if value == 1 else ''
return super().data(index, role)

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -24,4 +24,4 @@ from statapp.polynoms.polynom_window import PolynomWindow
class LinearPolynomWindow(PolynomWindow): class LinearPolynomWindow(PolynomWindow):
def __init__(self, data): def __init__(self, data):
result = linearPolynom(data) result = linearPolynom(data)
super().__init__(result, "Линейный полином") super().__init__(data, result, "Линейный полином")

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -17,15 +17,31 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import numpy as np
from PySide2.QtWidgets import QDialog, QHeaderView from PySide2.QtWidgets import QDialog, QHeaderView
import matplotlib
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from matplotlib.figure import Figure
from statapp.calculations import prediction
from statapp.mathtex_header_view import MathTexHeaderView from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.prediction_table_model import PreditionTableModel
from statapp.models.regression_result_model import RegressionResultModel from statapp.models.regression_result_model import RegressionResultModel
from statapp.ui.ui_polynom_window import Ui_PolynomWindow from statapp.ui.ui_polynom_window import Ui_PolynomWindow
from statapp.utils import addIcon, FloatDelegate from statapp.utils import addIcon, FloatDelegate
matplotlib.use('Qt5Agg')
class MplCanvas(FigureCanvasQTAgg):
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
self.axes = fig.add_subplot()
super().__init__(fig)
class PolynomWindow(QDialog): class PolynomWindow(QDialog):
def __init__(self, result, windowTitle): def __init__(self, data, result, windowTitle):
super().__init__() super().__init__()
self.ui = Ui_PolynomWindow() self.ui = Ui_PolynomWindow()
self.ui.setupUi(self) self.ui.setupUi(self)
@@ -43,3 +59,31 @@ class PolynomWindow(QDialog):
self.ui.scaledResidualVarianceValueLabel.setText(str(result.scaledResidualVariance)) self.ui.scaledResidualVarianceValueLabel.setText(str(result.scaledResidualVariance))
self.ui.fStatisticValueLabel.setText(str(result.fStatistic)) self.ui.fStatisticValueLabel.setText(str(result.fStatistic))
self.ui.rSquaredValueLabel.setText(str(result.scaledResidualVariance)) self.ui.rSquaredValueLabel.setText(str(result.scaledResidualVariance))
predictionResult = prediction(data, result)
self.predictionModel = PreditionTableModel(predictionResult)
self.ui.predictionTableView.setModel(self.predictionModel)
header = self.ui.predictionTableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
sc = MplCanvas(self, width=5, height=4, dpi=100)
xAxes = np.array(range(len(data[:, 0])))
realY = predictionResult[:, 0]
calculatedY = predictionResult[:, 1]
print(xAxes)
print(realY)
print(calculatedY)
sc.axes.scatter(xAxes, realY)
# xnew = np.linspace(xAxes.min(), xAxes.max(), 300)
# gfg = scipy.interpolate.make_interp_spline(xAxes, y, k=3)
# y_new = gfg(xnew)
sc.axes.plot(xAxes, calculatedY)
self.ui.plotContainer.addWidget(sc)

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -24,4 +24,4 @@ from statapp.polynoms.polynom_window import PolynomWindow
class SquaredPolynomWindow(PolynomWindow): class SquaredPolynomWindow(PolynomWindow):
def __init__(self, data): def __init__(self, data):
result = squaredPolynom(data) result = squaredPolynom(data)
super().__init__(result, "Квадратичный полином") super().__init__(data, result, "Квадратичный полином")

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -21,12 +21,14 @@ import numpy as np
from PySide2.QtCore import Qt from PySide2.QtCore import Qt
from PySide2.QtWidgets import QDialog, QHeaderView from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import linearPolynom from statapp.calculations import linearPolynom, prediction
from statapp.combo_delegate import ComboDelegate from statapp.combo_delegate import ComboDelegate
from statapp.mathtex_header_view import MathTexHeaderView from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.prediction_table_model import PreditionTableModel
from statapp.models.transform_polynom_model import TransformPolynomModel, TRANSFORMS from statapp.models.transform_polynom_model import TransformPolynomModel, TRANSFORMS
from statapp.ui.ui_transform_polynom_window import Ui_PolynomWindow from statapp.polynoms.polynom_window import MplCanvas
from statapp.utils import addIcon from statapp.ui.ui_polynom_window import Ui_PolynomWindow
from statapp.utils import addIcon, onError
class TransformPolynomWindow(QDialog): class TransformPolynomWindow(QDialog):
@@ -39,6 +41,23 @@ class TransformPolynomWindow(QDialog):
self.data = data self.data = data
result = linearPolynom(data) result = linearPolynom(data)
try:
predictionResult = prediction(data, result)
except Exception as error:
onError(error)
self.predictionModel = PreditionTableModel(predictionResult)
self.ui.predictionTableView.setModel(self.predictionModel)
header = self.ui.predictionTableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.sc = MplCanvas(self, width=5, height=4, dpi=100)
xAxes = np.array(range(len(data[:, 0])))
realY = predictionResult[:, 0]
calculatedY = predictionResult[:, 1]
self.sc.axes.scatter(xAxes, realY)
self.sc.axes.plot(xAxes, calculatedY)
self.ui.plotContainer.addWidget(self.sc)
# Создание столбца из нулей # Создание столбца из нулей
zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1)) zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1))
@@ -74,10 +93,24 @@ class TransformPolynomWindow(QDialog):
tr = self.model.data(self.model.createIndex(j, 0), Qt.DisplayRole) tr = self.model.data(self.model.createIndex(j, 0), Qt.DisplayRole)
data[i][j] = TRANSFORMS[tr](data[i][j]) data[i][j] = TRANSFORMS[tr](data[i][j])
try:
self.rebuildData(data) self.rebuildData(data)
except Exception as error:
onError(error)
def rebuildData(self, data): def rebuildData(self, data):
result = linearPolynom(data) result = linearPolynom(data)
predictionResult = prediction(data, result)
self.predictionModel.updateAllData(predictionResult)
self.ui.plotContainer.removeWidget(self.sc)
self.sc = MplCanvas(self, width=5, height=4, dpi=100)
xAxes = np.array(range(len(data[:, 0])))
realY = predictionResult[:, 0]
calculatedY = predictionResult[:, 1]
self.sc.axes.scatter(xAxes, realY)
self.sc.axes.plot(xAxes, calculatedY)
self.ui.plotContainer.addWidget(self.sc)
zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1)) zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1))
result.paramsAndImportance = np.column_stack((zeroCol, result.paramsAndImportance)) result.paramsAndImportance = np.column_stack((zeroCol, result.paramsAndImportance))
self.model.updateAllData(result) self.model.updateAllData(result)

View File

@@ -6,17 +6,27 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>630</width> <width>537</width>
<height>400</height> <height>444</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Полином</string> <string>Полином</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="6">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="model">
<attribute name="title">
<string>Модель</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="1" column="3">
<widget class="QTableView" name="tableView"> <widget class="QTableView" name="tableView">
<attribute name="horizontalHeaderMinimumSectionSize"> <attribute name="horizontalHeaderMinimumSectionSize">
<number>40</number> <number>40</number>
@@ -29,7 +39,7 @@
</attribute> </attribute>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="3">
<layout class="QGridLayout" name="polynomResult"> <layout class="QGridLayout" name="polynomResult">
<property name="topMargin"> <property name="topMargin">
<number>10</number> <number>10</number>
@@ -96,6 +106,34 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="prediction">
<attribute name="title">
<string>Прогноз</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QTableView" name="predictionTableView">
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>График</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QGridLayout" name="plotContainer"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PolynomWindow</class>
<widget class="QDialog" name="PolynomWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>537</width>
<height>444</height>
</rect>
</property>
<property name="windowTitle">
<string>Полином</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="6">
<layout class="QGridLayout" name="polynomResult">
<property name="topMargin">
<number>10</number>
</property>
<item row="0" column="1">
<widget class="QLabel" name="residualVarianceValueLabel">
<property name="text">
<string>undefined</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="scaledResidualVarianceValueLabel">
<property name="text">
<string>undefined</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="fStatisticLabel">
<property name="text">
<string>F1 - отношение Фишера</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="residualVarianceLabel">
<property name="text">
<string>Остаточная дисперсия:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="scaledResidualVarianceLabel">
<property name="text">
<string>Остаточная дисперсия (масштабированная):</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="rSquaredLabel">
<property name="text">
<string>Коэффициент множественной дереминизации</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="fStatisticValueLabel">
<property name="text">
<string>undefined</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="rSquaredValueLabel">
<property name="text">
<string>undefined</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="6">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="3">
<widget class="QTableView" name="tableView">
<attribute name="horizontalHeaderMinimumSectionSize">
<number>40</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>40</number>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>40</number>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -37,71 +37,105 @@ class Ui_PolynomWindow(object):
def setupUi(self, PolynomWindow): def setupUi(self, PolynomWindow):
if not PolynomWindow.objectName(): if not PolynomWindow.objectName():
PolynomWindow.setObjectName(u"PolynomWindow") PolynomWindow.setObjectName(u"PolynomWindow")
PolynomWindow.resize(630, 400) PolynomWindow.resize(537, 444)
self.gridLayout_2 = QGridLayout(PolynomWindow) self.gridLayout_2 = QGridLayout(PolynomWindow)
self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setObjectName(u"gridLayout_2")
self.tabWidget = QTabWidget(PolynomWindow)
self.tabWidget.setObjectName(u"tabWidget")
self.model = QWidget()
self.model.setObjectName(u"model")
self.gridLayout_3 = QGridLayout(self.model)
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.gridLayout = QGridLayout() self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setObjectName(u"gridLayout")
self.tableView = QTableView(PolynomWindow) self.tableView = QTableView(self.model)
self.tableView.setObjectName(u"tableView") self.tableView.setObjectName(u"tableView")
self.tableView.horizontalHeader().setMinimumSectionSize(40) self.tableView.horizontalHeader().setMinimumSectionSize(40)
self.tableView.verticalHeader().setMinimumSectionSize(40) self.tableView.verticalHeader().setMinimumSectionSize(40)
self.tableView.verticalHeader().setDefaultSectionSize(40) self.tableView.verticalHeader().setDefaultSectionSize(40)
self.gridLayout.addWidget(self.tableView, 0, 0, 1, 1) self.gridLayout.addWidget(self.tableView, 1, 3, 1, 1)
self.polynomResult = QGridLayout() self.polynomResult = QGridLayout()
self.polynomResult.setObjectName(u"polynomResult") self.polynomResult.setObjectName(u"polynomResult")
self.polynomResult.setContentsMargins(-1, 10, -1, -1) self.polynomResult.setContentsMargins(-1, 10, -1, -1)
self.residualVarianceValueLabel = QLabel(PolynomWindow) self.residualVarianceValueLabel = QLabel(self.model)
self.residualVarianceValueLabel.setObjectName(u"residualVarianceValueLabel") self.residualVarianceValueLabel.setObjectName(u"residualVarianceValueLabel")
self.polynomResult.addWidget(self.residualVarianceValueLabel, 0, 1, 1, 1) self.polynomResult.addWidget(self.residualVarianceValueLabel, 0, 1, 1, 1)
self.scaledResidualVarianceValueLabel = QLabel(PolynomWindow) self.scaledResidualVarianceValueLabel = QLabel(self.model)
self.scaledResidualVarianceValueLabel.setObjectName(u"scaledResidualVarianceValueLabel") self.scaledResidualVarianceValueLabel.setObjectName(u"scaledResidualVarianceValueLabel")
self.polynomResult.addWidget(self.scaledResidualVarianceValueLabel, 1, 1, 1, 1) self.polynomResult.addWidget(self.scaledResidualVarianceValueLabel, 1, 1, 1, 1)
self.fStatisticLabel = QLabel(PolynomWindow) self.fStatisticLabel = QLabel(self.model)
self.fStatisticLabel.setObjectName(u"fStatisticLabel") self.fStatisticLabel.setObjectName(u"fStatisticLabel")
self.polynomResult.addWidget(self.fStatisticLabel, 2, 0, 1, 1) self.polynomResult.addWidget(self.fStatisticLabel, 2, 0, 1, 1)
self.residualVarianceLabel = QLabel(PolynomWindow) self.residualVarianceLabel = QLabel(self.model)
self.residualVarianceLabel.setObjectName(u"residualVarianceLabel") self.residualVarianceLabel.setObjectName(u"residualVarianceLabel")
self.polynomResult.addWidget(self.residualVarianceLabel, 0, 0, 1, 1) self.polynomResult.addWidget(self.residualVarianceLabel, 0, 0, 1, 1)
self.scaledResidualVarianceLabel = QLabel(PolynomWindow) self.scaledResidualVarianceLabel = QLabel(self.model)
self.scaledResidualVarianceLabel.setObjectName(u"scaledResidualVarianceLabel") self.scaledResidualVarianceLabel.setObjectName(u"scaledResidualVarianceLabel")
self.polynomResult.addWidget(self.scaledResidualVarianceLabel, 1, 0, 1, 1) self.polynomResult.addWidget(self.scaledResidualVarianceLabel, 1, 0, 1, 1)
self.rSquaredLabel = QLabel(PolynomWindow) self.rSquaredLabel = QLabel(self.model)
self.rSquaredLabel.setObjectName(u"rSquaredLabel") self.rSquaredLabel.setObjectName(u"rSquaredLabel")
self.polynomResult.addWidget(self.rSquaredLabel, 3, 0, 1, 1) self.polynomResult.addWidget(self.rSquaredLabel, 3, 0, 1, 1)
self.fStatisticValueLabel = QLabel(PolynomWindow) self.fStatisticValueLabel = QLabel(self.model)
self.fStatisticValueLabel.setObjectName(u"fStatisticValueLabel") self.fStatisticValueLabel.setObjectName(u"fStatisticValueLabel")
self.polynomResult.addWidget(self.fStatisticValueLabel, 2, 1, 1, 1) self.polynomResult.addWidget(self.fStatisticValueLabel, 2, 1, 1, 1)
self.rSquaredValueLabel = QLabel(PolynomWindow) self.rSquaredValueLabel = QLabel(self.model)
self.rSquaredValueLabel.setObjectName(u"rSquaredValueLabel") self.rSquaredValueLabel.setObjectName(u"rSquaredValueLabel")
self.polynomResult.addWidget(self.rSquaredValueLabel, 3, 1, 1, 1) self.polynomResult.addWidget(self.rSquaredValueLabel, 3, 1, 1, 1)
self.gridLayout.addLayout(self.polynomResult, 1, 0, 1, 1) self.gridLayout.addLayout(self.polynomResult, 2, 3, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1)
self.tabWidget.addTab(self.model, "")
self.prediction = QWidget()
self.prediction.setObjectName(u"prediction")
self.gridLayout_4 = QGridLayout(self.prediction)
self.gridLayout_4.setObjectName(u"gridLayout_4")
self.predictionTableView = QTableView(self.prediction)
self.predictionTableView.setObjectName(u"predictionTableView")
self.predictionTableView.verticalHeader().setVisible(False)
self.gridLayout_4.addWidget(self.predictionTableView, 0, 0, 1, 1)
self.tabWidget.addTab(self.prediction, "")
self.tab = QWidget()
self.tab.setObjectName(u"tab")
self.gridLayout_5 = QGridLayout(self.tab)
self.gridLayout_5.setObjectName(u"gridLayout_5")
self.plotContainer = QGridLayout()
self.plotContainer.setObjectName(u"plotContainer")
self.gridLayout_5.addLayout(self.plotContainer, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab, "")
self.gridLayout_2.addWidget(self.tabWidget, 0, 6, 1, 1)
self.retranslateUi(PolynomWindow) self.retranslateUi(PolynomWindow)
self.tabWidget.setCurrentIndex(0)
QMetaObject.connectSlotsByName(PolynomWindow) QMetaObject.connectSlotsByName(PolynomWindow)
# setupUi # setupUi
@@ -115,4 +149,7 @@ class Ui_PolynomWindow(object):
self.rSquaredLabel.setText(QCoreApplication.translate("PolynomWindow", u"\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0434\u0435\u0440\u0435\u043c\u0438\u043d\u0438\u0437\u0430\u0446\u0438\u0438", None)) self.rSquaredLabel.setText(QCoreApplication.translate("PolynomWindow", u"\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0434\u0435\u0440\u0435\u043c\u0438\u043d\u0438\u0437\u0430\u0446\u0438\u0438", None))
self.fStatisticValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None)) self.fStatisticValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
self.rSquaredValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None)) self.rSquaredValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.model), QCoreApplication.translate("PolynomWindow", u"\u041c\u043e\u0434\u0435\u043b\u044c", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.prediction), QCoreApplication.translate("PolynomWindow", u"\u041f\u0440\u043e\u0433\u043d\u043e\u0437", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("PolynomWindow", u"\u0413\u0440\u0430\u0444\u0438\u043a", None))
# retranslateUi # retranslateUi

View File

@@ -1,118 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
#
# This file is part of Statapp
# (see https://github.com/shizand/statapp).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
## Form generated from reading UI file 'transform_polynom_window.ui'
##
## 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 PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
class Ui_PolynomWindow(object):
def setupUi(self, PolynomWindow):
if not PolynomWindow.objectName():
PolynomWindow.setObjectName(u"PolynomWindow")
PolynomWindow.resize(537, 444)
self.gridLayout_2 = QGridLayout(PolynomWindow)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.polynomResult = QGridLayout()
self.polynomResult.setObjectName(u"polynomResult")
self.polynomResult.setContentsMargins(-1, 10, -1, -1)
self.residualVarianceValueLabel = QLabel(PolynomWindow)
self.residualVarianceValueLabel.setObjectName(u"residualVarianceValueLabel")
self.polynomResult.addWidget(self.residualVarianceValueLabel, 0, 1, 1, 1)
self.scaledResidualVarianceValueLabel = QLabel(PolynomWindow)
self.scaledResidualVarianceValueLabel.setObjectName(u"scaledResidualVarianceValueLabel")
self.polynomResult.addWidget(self.scaledResidualVarianceValueLabel, 1, 1, 1, 1)
self.fStatisticLabel = QLabel(PolynomWindow)
self.fStatisticLabel.setObjectName(u"fStatisticLabel")
self.polynomResult.addWidget(self.fStatisticLabel, 2, 0, 1, 1)
self.residualVarianceLabel = QLabel(PolynomWindow)
self.residualVarianceLabel.setObjectName(u"residualVarianceLabel")
self.polynomResult.addWidget(self.residualVarianceLabel, 0, 0, 1, 1)
self.scaledResidualVarianceLabel = QLabel(PolynomWindow)
self.scaledResidualVarianceLabel.setObjectName(u"scaledResidualVarianceLabel")
self.polynomResult.addWidget(self.scaledResidualVarianceLabel, 1, 0, 1, 1)
self.rSquaredLabel = QLabel(PolynomWindow)
self.rSquaredLabel.setObjectName(u"rSquaredLabel")
self.polynomResult.addWidget(self.rSquaredLabel, 3, 0, 1, 1)
self.fStatisticValueLabel = QLabel(PolynomWindow)
self.fStatisticValueLabel.setObjectName(u"fStatisticValueLabel")
self.polynomResult.addWidget(self.fStatisticValueLabel, 2, 1, 1, 1)
self.rSquaredValueLabel = QLabel(PolynomWindow)
self.rSquaredValueLabel.setObjectName(u"rSquaredValueLabel")
self.polynomResult.addWidget(self.rSquaredValueLabel, 3, 1, 1, 1)
self.gridLayout_2.addLayout(self.polynomResult, 1, 6, 1, 1)
self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout")
self.tableView = QTableView(PolynomWindow)
self.tableView.setObjectName(u"tableView")
self.tableView.horizontalHeader().setMinimumSectionSize(40)
self.tableView.verticalHeader().setMinimumSectionSize(40)
self.tableView.verticalHeader().setDefaultSectionSize(40)
self.gridLayout.addWidget(self.tableView, 1, 3, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 0, 6, 1, 1)
self.retranslateUi(PolynomWindow)
QMetaObject.connectSlotsByName(PolynomWindow)
# setupUi
def retranslateUi(self, PolynomWindow):
PolynomWindow.setWindowTitle(QCoreApplication.translate("PolynomWindow", u"\u041f\u043e\u043b\u0438\u043d\u043e\u043c", None))
self.residualVarianceValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
self.scaledResidualVarianceValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
self.fStatisticLabel.setText(QCoreApplication.translate("PolynomWindow", u"F1 - \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0424\u0438\u0448\u0435\u0440\u0430", None))
self.residualVarianceLabel.setText(QCoreApplication.translate("PolynomWindow", u"\u041e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f:", None))
self.scaledResidualVarianceLabel.setText(QCoreApplication.translate("PolynomWindow", u"\u041e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f (\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f):", None))
self.rSquaredLabel.setText(QCoreApplication.translate("PolynomWindow", u"\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0434\u0435\u0440\u0435\u043c\u0438\u043d\u0438\u0437\u0430\u0446\u0438\u0438", None))
self.fStatisticValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
self.rSquaredValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
# retranslateUi

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).
@@ -59,8 +59,19 @@ def buildMessageBox(title, text, icon, buttons, defaultButton):
msgBox.setStandardButtons(buttons) msgBox.setStandardButtons(buttons)
msgBox.setDefaultButton(defaultButton) msgBox.setDefaultButton(defaultButton)
addIcon(msgBox)
return msgBox return msgBox
def onError(errorName: Exception):
msgBox = buildMessageBox \
('Ошибка',
"Упс.. Произошла ошибка:\n" + str(errorName),
QMessageBox.Critical,
QMessageBox.Ok,
QMessageBox.Ok)
msgBox.exec_()
class FloatDelegate(QStyledItemDelegate): class FloatDelegate(QStyledItemDelegate):
def __init__(self, parent=None): def __init__(self, parent=None):

View File

@@ -1,5 +1,5 @@
# #
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko. # Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
# #
# This file is part of Statapp # This file is part of Statapp
# (see https://github.com/shizand/statapp). # (see https://github.com/shizand/statapp).