2 Commits

Author SHA1 Message Date
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
37 changed files with 122 additions and 38 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## [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) ## [0.9.0](https://github.com/shizand/statapp/compare/v0.8.0...v0.9.0) (2024-01-02)

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "statapp" name = "statapp"
version = "0.9.0" version = "0.10.0"
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).

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

@@ -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

@@ -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

@@ -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).
@@ -17,7 +17,11 @@
# 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.calculations import prediction
from statapp.mathtex_header_view import MathTexHeaderView from statapp.mathtex_header_view import MathTexHeaderView
@@ -27,6 +31,15 @@ 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, data, result, windowTitle): def __init__(self, data, result, windowTitle):
super().__init__() super().__init__()
@@ -47,7 +60,30 @@ class PolynomWindow(QDialog):
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))
self.predictionModel = PreditionTableModel(prediction(data, result)) predictionResult = prediction(data, result)
self.predictionModel = PreditionTableModel(predictionResult)
self.ui.predictionTableView.setModel(self.predictionModel) self.ui.predictionTableView.setModel(self.predictionModel)
header = self.ui.predictionTableView.horizontalHeader() header = self.ui.predictionTableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch) 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).

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).
@@ -26,6 +26,7 @@ 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.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.polynoms.polynom_window import MplCanvas
from statapp.ui.ui_polynom_window import Ui_PolynomWindow from statapp.ui.ui_polynom_window import Ui_PolynomWindow
from statapp.utils import addIcon from statapp.utils import addIcon
@@ -41,11 +42,20 @@ class TransformPolynomWindow(QDialog):
self.data = data self.data = data
result = linearPolynom(data) result = linearPolynom(data)
self.predictionModel = PreditionTableModel(prediction(data, result)) predictionResult = prediction(data, result)
self.predictionModel = PreditionTableModel(predictionResult)
self.ui.predictionTableView.setModel(self.predictionModel) self.ui.predictionTableView.setModel(self.predictionModel)
header = self.ui.predictionTableView.horizontalHeader() header = self.ui.predictionTableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch) 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))
# Добавление столбца к исходному массиву # Добавление столбца к исходному массиву
@@ -84,7 +94,17 @@ class TransformPolynomWindow(QDialog):
def rebuildData(self, data): def rebuildData(self, data):
result = linearPolynom(data) result = linearPolynom(data)
self.predictionModel.updateAllData(prediction(data, result)) 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

@@ -120,6 +120,16 @@
</item> </item>
</layout> </layout>
</widget> </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> </widget>
</item> </item>
</layout> </layout>

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).
@@ -117,6 +117,16 @@ class Ui_PolynomWindow(object):
self.gridLayout_4.addWidget(self.predictionTableView, 0, 0, 1, 1) self.gridLayout_4.addWidget(self.predictionTableView, 0, 0, 1, 1)
self.tabWidget.addTab(self.prediction, "") 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.gridLayout_2.addWidget(self.tabWidget, 0, 6, 1, 1)
@@ -141,4 +151,5 @@ class Ui_PolynomWindow(object):
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.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.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,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).

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).