27 Commits

Author SHA1 Message Date
github-actions[bot]
8b09a76b32 chore(main): release 0.11.0 (#107)
🤖 I have created a release *beep* *boop*
---


##
[0.11.0](https://github.com/shizand/statapp/compare/v0.10.2...v0.11.0)
(2024-02-03)


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

* добавлен пункт "Использование"
([#108](https://github.com/shizand/statapp/issues/108))
([aafa5a0](aafa5a0ebb)),
closes [#70](https://github.com/shizand/statapp/issues/70)
* добавлена возможность удалить факторы
([#103](https://github.com/shizand/statapp/issues/103))
([30447a8](30447a801a)),
closes [#102](https://github.com/shizand/statapp/issues/102)


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

* добавлена легенда графика
([#104](https://github.com/shizand/statapp/issues/104))
([240a517](240a517dd6)),
closes [#101](https://github.com/shizand/statapp/issues/101)

---
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-02-03 18:05:02 +03:00
aafa5a0ebb feat: добавлен пункт "Использование" (#108)
Closes #70
2024-02-03 17:57:49 +03:00
30447a801a feat: добавлена возможность удалить факторы (#103)
Closes #102
2024-02-03 16:20:33 +03:00
240a517dd6 fix: добавлена легенда графика (#104)
Closes #101
2024-02-03 16:20:23 +03:00
27c1455120 docs: Добавлен README.html 2024-02-03 15:33:01 +03:00
63f80819d2 docs: Обновлён README.md 2024-02-03 15:06:35 +03:00
d0053df261 docs: обновлён README.md (#106)
Co-authored-by: MisterMLiL <eugenelazurenko@gmail.com>
2024-02-03 14:49:25 +03:00
fcddf84839 docs: добавлена документация (#105)
Co-authored-by: MisterMLiL <eugenelazurenko@gmail.com>
2024-02-03 14:39:34 +03:00
github-actions[bot]
6b18bb1f82 chore(main): release 0.10.2 (#100)
🤖 I have created a release *beep* *boop*
---


##
[0.10.2](https://github.com/shizand/statapp/compare/v0.10.1...v0.10.2)
(2024-02-01)


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

* исправлена опечатка в характеристиках модели
([871d9ad](871d9ad746))

---
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-02-01 17:52:03 +03:00
871d9ad746 fix: исправлена опечатка в характеристиках модели 2024-02-01 17:30:10 +03:00
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
github-actions[bot]
51fc413fca chore(main): release 0.8.0 (#91)
🤖 I have created a release *beep* *boop*
---


## [0.8.0](https://github.com/shizand/statapp/compare/v0.7.0...v0.8.0)
(2023-12-31)


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

* добавлены преобразования
([#90](https://github.com/shizand/statapp/issues/90))
([f70be43](f70be431cf))

---
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>
2023-12-31 10:17:56 +03:00
f70be431cf feat: добавлены преобразования (#90)
Closes #41

---------

Co-authored-by: MisterMLiL <eugenelazurenko@gmail.com>
2023-12-31 10:12:01 +03:00
github-actions[bot]
4f1f610822 chore(main): release 0.7.0 (#88)
🤖 I have created a release *beep* *boop*
---


## [0.7.0](https://github.com/shizand/statapp/compare/v0.6.0...v0.7.0)
(2023-12-01)


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

* добавлена возможность ввода чисел до 5 знаков
([#87](https://github.com/shizand/statapp/issues/87))
([dc7c487](dc7c4875d7)),
closes [#82](https://github.com/shizand/statapp/issues/82)
* Добавлены новые характеристики
([#89](https://github.com/shizand/statapp/issues/89))
([b12db5a](b12db5a300)),
closes [#84](https://github.com/shizand/statapp/issues/84)

---
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>
2023-12-01 14:11:49 +03:00
b12db5a300 feat: Добавлены новые характеристики (#89)
Closes #84
2023-12-01 14:03:20 +03:00
dc7c4875d7 feat: добавлена возможность ввода чисел до 5 знаков (#87)
Closes #82
2023-11-25 14:21:05 +03:00
2f5988a2eb chore: исправляет форматирование 2023-10-25 17:11:09 +03:00
9348138094 chore: исправляет описание в "Установка" 2023-10-25 17:09:30 +03:00
c35b9ca308 chore: исправляет опечатки 2023-10-25 15:58:06 +03:00
e6ba0fc610 ci: Revert "добавил сборку linux x86"
This reverts commit 4be89269b9.
2023-10-20 14:46:57 +03:00
cddacb21b2 Merge remote-tracking branch 'origin/main' 2023-10-20 14:20:27 +03:00
4be89269b9 ci: добавил сборку linux x86 2023-10-20 14:20:12 +03:00
78 changed files with 2224 additions and 498 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="Poetry (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="Poetry (statapp)" jdkType="Python SDK" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View File

@@ -11,7 +11,7 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-yaml - id: check-yaml
- id: check-added-large-files #- id: check-added-large-files
- repo: https://github.com/johann-petrak/licenseheaders.git - repo: https://github.com/johann-petrak/licenseheaders.git
rev: v0.8.8 rev: v0.8.8
hooks: hooks:

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,61 @@
# Changelog # Changelog
## [0.11.0](https://github.com/shizand/statapp/compare/v0.10.2...v0.11.0) (2024-02-03)
### Новые функции
* добавлен пункт "Использование" ([#108](https://github.com/shizand/statapp/issues/108)) ([aafa5a0](https://github.com/shizand/statapp/commit/aafa5a0ebbb772b6aa55699d8a50587a8fe6c8e0)), closes [#70](https://github.com/shizand/statapp/issues/70)
* добавлена возможность удалить факторы ([#103](https://github.com/shizand/statapp/issues/103)) ([30447a8](https://github.com/shizand/statapp/commit/30447a801afdac80da948a6f0961ce7b08591f4f)), closes [#102](https://github.com/shizand/statapp/issues/102)
### Исправления
* добавлена легенда графика ([#104](https://github.com/shizand/statapp/issues/104)) ([240a517](https://github.com/shizand/statapp/commit/240a517dd6691d45253b5863b54b4b035aaea8f1)), closes [#101](https://github.com/shizand/statapp/issues/101)
## [0.10.2](https://github.com/shizand/statapp/compare/v0.10.1...v0.10.2) (2024-02-01)
### Исправления
* исправлена опечатка в характеристиках модели ([871d9ad](https://github.com/shizand/statapp/commit/871d9ad746c51351bee9097d9f56903c8e1d1873))
## [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)
### Новые функции
* добавлены преобразования ([#90](https://github.com/shizand/statapp/issues/90)) ([f70be43](https://github.com/shizand/statapp/commit/f70be431cfb4ecda5c3e706f4ca95171bbe779b3))
## [0.7.0](https://github.com/shizand/statapp/compare/v0.6.0...v0.7.0) (2023-12-01)
### Новые функции
* добавлена возможность ввода чисел до 5 знаков ([#87](https://github.com/shizand/statapp/issues/87)) ([dc7c487](https://github.com/shizand/statapp/commit/dc7c4875d7e15ad8c9ae5fa16b4b589d156632dd)), closes [#82](https://github.com/shizand/statapp/issues/82)
* Добавлены новые характеристики ([#89](https://github.com/shizand/statapp/issues/89)) ([b12db5a](https://github.com/shizand/statapp/commit/b12db5a3003802830784e26a14097ee9d68a0e64)), closes [#84](https://github.com/shizand/statapp/issues/84)
## [0.6.0](https://github.com/shizand/statapp/compare/v0.5.0...v0.6.0) (2023-10-20) ## [0.6.0](https://github.com/shizand/statapp/compare/v0.5.0...v0.6.0) (2023-10-20)

View File

@@ -5,13 +5,13 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c4e370d74a8a4575b79afa8b9b74d130)](https://app.codacy.com/gh/shizand/statapp/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/c4e370d74a8a4575b79afa8b9b74d130)](https://app.codacy.com/gh/shizand/statapp/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
![License info](https://img.shields.io/github/license/shizand/statapp) ![License info](https://img.shields.io/github/license/shizand/statapp)
Автоматизированное программное средство по статистическому анализу и регрессионному моделированию. Является идейным продолжателем программы STAT.exe (Produced by Reutov V.N., Donetsk University, 1990) Автоматизированное программное средство по статистическому анализу и регрессионному моделированию. Является идейным продолжателем программы STAT.exe (Produced by Reutov V.N., Donetsk University, 1990).
Разработано двумя студентами ФГБОУ ВО «ДонНТУ» для своего университета. Разработано двумя студентами ФГБОУ ВО «ДонНТУ» для своего университета.
## Поддерживаемые ОС и архитектуры ## Поддерживаемые ОС и архитектуры
В теории, должно работать на любой архитектуре и ОС где запускается Python 3.8 и есть Qt 5. В теории, должно работать на любой архитектуре и ОС, где запускается Python 3.8 и есть Qt 5.
Работоспособность проверена на x64: Работоспособность проверена на x64:
@@ -20,7 +20,11 @@
## Установка ## Установка
Существует два варианта statapp и statapp-onefile. Различия в том, что onefile версия поставляется одним единственным бинарным файлом. На Windows системах с включенным антивирусом это может вызывать [некоторые проблемы](https://qna.habr.com/q/988553). Программа распространяется с помощью [PyInstaller](https://pyinstaller.org/en/stable/).
Существует две версиии: **statapp** и **statapp-onefile**.
Различия в том, что onefile версия поставляется одним единственным бинарным файлом. На Windows системах с включенным антивирусом это может вызывать [некоторые проблемы](https://qna.habr.com/q/988553).
### Готовые двоичные файлы ### Готовые двоичные файлы
@@ -35,9 +39,17 @@ poetry install
pyinstaller statapp.spec # или pyinstaller statapp.spec -- --one-file pyinstaller statapp.spec # или pyinstaller statapp.spec -- --one-file
``` ```
Документация собирается с помощью [grip](https://github.com/joeyespo/grip)
```bash
echo "STYLE_URLS = [\"https://cdn.jsdelivr.net/gh/shizand/statapp@main/docs/grip.css\"]" > ~/.grip/settings.py
cd docs
grip .
```
## Использование ## Использование
<!-- TODO --> Использование описано в [Руководстве пользователя](docs/README.md).
## Чем я могу помочь проекту? ## Чем я могу помочь проекту?

156
environment.yml Normal file
View File

@@ -0,0 +1,156 @@
name: statapp
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- alsa-lib=1.2.10=hd590300_0
- attr=2.5.1=h166bdaf_1
- bzip2=1.0.8=hd590300_5
- ca-certificates=2024.2.2=hbcca054_0
- cairo=1.16.0=h6cf1ce9_1008
- dbus=1.13.6=h48d8840_2
- expat=2.5.0=hcb278e6_1
- font-ttf-dejavu-sans-mono=2.37=hab24e00_0
- font-ttf-inconsolata=3.000=h77eed37_0
- font-ttf-source-code-pro=2.038=h77eed37_0
- font-ttf-ubuntu=0.83=h77eed37_1
- fontconfig=2.14.2=h14ed4e7_0
- fonts-conda-ecosystem=1=0
- fonts-conda-forge=1=0
- freetype=2.12.1=h267a509_2
- gettext=0.21.1=h27087fc_0
- glib=2.68.4=h9c3ff4c_0
- glib-tools=2.68.4=h9c3ff4c_0
- graphite2=1.3.13=h58526e2_1001
- gst-plugins-base=1.18.4=h29181c9_0
- gstreamer=1.18.5=h76c114f_0
- harfbuzz=3.0.0=h83ec7ef_1
- icu=68.2=h9c3ff4c_0
- jpeg=9e=h166bdaf_2
- keyutils=1.6.1=h166bdaf_0
- krb5=1.19.3=h3790be6_0
- lame=3.100=h166bdaf_1003
- ld_impl_linux-64=2.38=h1181459_1
- libcap=2.69=h0f662aa_0
- libclang=11.1.0=default_ha53f305_1
- libclang13=14.0.6=default_h9986a30_1
- libcups=2.3.3=h3e49a29_2
- libedit=3.1.20191231=he28a2e2_2
- libevent=2.1.10=h9b69904_4
- libexpat=2.5.0=hcb278e6_1
- libffi=3.3=h58526e2_2
- libflac=1.4.3=h59595ed_0
- libgcc-ng=13.2.0=h807b86a_5
- libgcrypt=1.10.3=hd590300_0
- libglib=2.68.4=h3e27bee_0
- libgomp=13.2.0=h807b86a_5
- libgpg-error=1.47=h71f35ed_0
- libiconv=1.17=hd590300_2
- libjpeg-turbo=2.1.4=h166bdaf_0
- libllvm11=11.1.0=he0ac6c6_5
- libllvm14=14.0.6=hcd5def8_4
- libogg=1.3.4=h7f98852_1
- libopus=1.3.1=h7f98852_1
- libpng=1.6.42=h2797004_0
- libpq=13.8=hd77ab85_0
- libsndfile=1.2.2=hc60ed4a_1
- libsqlite=3.44.2=h2797004_0
- libstdcxx-ng=13.2.0=h7e041cc_5
- libsystemd0=255=h3516f8a_0
- libuuid=2.38.1=h0b41bf4_0
- libvorbis=1.3.7=h9c3ff4c_0
- libxcb=1.15=h0b41bf4_0
- libxkbcommon=1.0.3=he3ba5ed_0
- libxml2=2.9.12=h72842e0_0
- libxslt=1.1.33=h15afd5d_2
- libzlib=1.2.13=hd590300_5
- lz4-c=1.9.4=hcb278e6_0
- mpg123=1.32.4=h59595ed_0
- mysql-common=8.0.32=h14678bc_0
- mysql-libs=8.0.32=h54cf53e_0
- ncurses=6.4=h6a678d5_0
- nspr=4.35=h27087fc_0
- nss=3.97=h1d7d5a4_0
- openssl=1.1.1w=hd590300_0
- pcre=8.45=h9c3ff4c_0
- pcre2=10.42=hcad00b1_0
- pip=23.3.1=py38h06a4308_0
- pixman=0.43.2=h59595ed_0
- pthread-stubs=0.4=h36c2ea0_1001
- pyside2=5.13.2=py38h2009f50_7
- python=3.8.10=h49503c6_1_cpython
- python_abi=3.8=2_cp38
- qt=5.12.9=hda022c4_4
- readline=8.2=h5eee18b_0
- setuptools=68.2.2=py38h06a4308_0
- sqlite=3.41.2=h5eee18b_0
- tk=8.6.12=h1ccaba5_0
- wheel=0.41.2=py38h06a4308_0
- xcb-util=0.4.0=hd590300_1
- xcb-util-image=0.4.0=h8ee46fc_1
- xcb-util-keysyms=0.4.0=h8ee46fc_1
- xcb-util-renderutil=0.3.9=hd590300_1
- xcb-util-wm=0.4.1=h8ee46fc_1
- xkeyboard-config=2.40=hd590300_0
- xorg-kbproto=1.0.7=h7f98852_1002
- xorg-libice=1.1.1=hd590300_0
- xorg-libsm=1.2.4=h7391055_0
- xorg-libx11=1.8.7=h8ee46fc_0
- xorg-libxau=1.0.11=hd590300_0
- xorg-libxdmcp=1.1.3=h7f98852_0
- xorg-libxext=1.3.4=h0b41bf4_2
- xorg-libxrender=0.9.11=hd590300_0
- xorg-renderproto=0.11.1=h7f98852_1002
- xorg-xextproto=7.3.0=h0b41bf4_1003
- xorg-xf86vidmodeproto=2.3.1=h7f98852_1002
- xorg-xproto=7.0.31=h7f98852_1007
- xz=5.4.5=h5eee18b_0
- zlib=1.2.13=hd590300_5
- zstd=1.5.5=hfc55251_0
- pip:
- altgraph==0.17.4
- astroid==2.15.8
- cfgv==3.4.0
- contourpy==1.1.1
- cycler==0.12.1
- dill==0.3.7
- distlib==0.3.7
- filelock==3.12.4
- fonttools==4.43.1
- identify==2.5.30
- importlib-metadata==6.8.0
- importlib-resources==6.1.0
- isort==5.12.0
- kiwisolver==1.4.5
- lazy-object-proxy==1.9.0
- matplotlib==3.7.3
- mccabe==0.7.0
- mpmath==1.3.0
- nodeenv==1.8.0
- numpy==1.24.4
- packaging==23.2
- pandas==2.0.3
- pillow==9.5.0
- platformdirs==3.11.0
- pre-commit==3.5.0
- pyinstaller==6.1.0
- pyinstaller-hooks-contrib==2023.10
- pylint==2.17.7
- pyparsing==3.1.1
- python-dateutil==2.8.2
- pytz==2023.3.post1
- pyyaml==6.0.1
- setuptools-scm==8.0.4
- six==1.16.0
- statapp==0.10.2
- sympy==1.12
- tomli==2.0.1
- tomlkit==0.12.1
- typing-extensions==4.8.0
- tzdata==2023.3
- virtualenv==20.24.5
- wrapt==1.15.0
- zipp==3.17.0
prefix: /home/maxim/miniconda3/envs/statapp

View File

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

View File

@@ -17,7 +17,11 @@ parser = argparse.ArgumentParser()
parser.add_argument("--one-file", action="store_true") parser.add_argument("--one-file", action="store_true")
options = parser.parse_args() options = parser.parse_args()
datas = [('statapp/ui/images/*', 'ui/images')] datas = [
('statapp/ui/images/*', 'ui/images'),
('statapp/docs/files/*', 'docs/files'),
('statapp/docs/README.html', 'docs')
]
datas += copy_metadata('statapp') datas += copy_metadata('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,18 +26,18 @@ from statapp.main_window import MainWindow
def main(): def main():
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_ShareOpenGLContexts)
app = QApplication(sys.argv) app = QApplication(sys.argv)
translator = QtCore.QTranslator(app) translator = QtCore.QTranslator(app)
locale = QtCore.QLocale.system().name() locale = QtCore.QLocale.system().name()
path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath) path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)
translator.load(f'qt_{locale}', path) translator.load(f'qt_{locale}', path)
translator.load(f'qtbase_{locale}', path) translator.load(f'qtbase_{locale}', path)
app.installTranslator(translator) app.installTranslator(translator)
window = MainWindow() window = MainWindow()
window.show() window.show()
return app.exec_() return app.exec_()
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main()) sys.exit(main())

View File

@@ -9,8 +9,7 @@
# See the GPL-3.0 license for details. # See the GPL-3.0 license for details.
import itertools import itertools
import numpy as np from numpy import linalg, zeros, ones, hstack, asarray
from numpy import linalg, zeros, ones, hstack, asarray, diagonal
from sympy import symbols, Mul, Add, S from sympy import symbols, Mul, Add, S
@@ -90,15 +89,7 @@ def multipolyfit(xs, y, deg, full=False, modelOut=False, powersOut=False):
return beta, powers return beta, powers
if full: if full:
residues = result[1] return result, powers, a
dof = len(a) - len(beta)
mse = residues / dof
cov = mse * diagonal(linalg.inv(a.T @ a))
se = np.sqrt(cov)
tStatistics = beta / se
return result, powers, tStatistics, mse
return beta return beta

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
@@ -66,54 +67,108 @@ class RegressionResult:
Attributes: Attributes:
paramsAndImportance (np.ndarray): Параметры модели. Первая колонка - paramsAndImportance (np.ndarray): Параметры модели. Первая колонка -
residualVariance (np.float64): Остаточная дисперсия residualVariance (np.float64): Остаточная дисперсия
scaledResidualVariance (np.float64): Остаточная дисперсия (масштабированная)
monomials (list): Список одночленов в строковом виде без коэффициентов. Свободный член - c monomials (list): Список одночленов в строковом виде без коэффициентов. Свободный член - c
""" """
paramsAndImportance: np.ndarray paramsAndImportance: np.ndarray
residualVariance: np.float64 residualVariance: np.float64
scaledResidualVariance: np.float64
rSquared: np.float64
fStatistic: np.float64
monomials: list monomials: list
def linearPolynom(inputData) -> RegressionResult: def commonPolynom(inputData, deg) -> RegressionResult:
x = inputData[:, 1:] x = inputData[:, 1:]
y = inputData[:, 0] y = inputData[:, 0]
data = pd.DataFrame(x) result, powers, data = multipolyfit(x, y, deg, full=True)
data.insert(0, 'const', 1) (out, mse, scaledResidualVariance,
# --- rSquared, fStatistic) = calculateStats(data, result[0], result[1], y)
result = np.linalg.lstsq(data, y, rcond=None)
# Коэффициенты регрессии return RegressionResult(
params = result[0] out.to_numpy(),
# Остатки np.float64(mse),
residues = result[1] np.float64(scaledResidualVariance),
dof = len(data) - len(params) np.float64(rSquared),
np.float64(fStatistic),
['c' if str(x) == '1' else str(x) for x in getTerms(powers)]
)
def linearPolynom(inputData) -> RegressionResult:
return commonPolynom(inputData, 1)
def squaredPolynom(inputData) -> RegressionResult:
return commonPolynom(inputData, 2)
def calculateStats(data, params, residues, y):
# pylint: disable-msg=too-many-locals
k = len(params) # Количество оцениваемых параметров (коэффициентов)
n = len(data) # Количество наблюдений
# Степень свободы (degrees of freedom) для остатков
dof = n - k # Количество наблюдений минус количество оцениваемых параметров
# Остаточная дисперсия (Mean Squared Error, MSE)
mse = residues / dof mse = residues / dof
# Среднее значение остатков
meanResiduals = np.sum(residues) / dof
# Масштабированная остаточная дисперсия
scaledResidualVariance = residues / meanResiduals ** 2
# Ковариационная матрица коэффициентов
cov = mse * np.diagonal(np.linalg.inv(data.T @ data)) cov = mse * np.diagonal(np.linalg.inv(data.T @ data))
# Стандартные ошибки коэффициентов
se = np.sqrt(cov) se = np.sqrt(cov)
# T-статистики для каждого коэффициента регрессии
tStatistics = params / se tStatistics = params / se
# возможно стоит сделать через np.reshape + np.concatenate # R-squared (коэффициент множественной детерминации)
sst = np.sum((y - np.mean(y)) ** 2) # Сумма квадратов отклонений
rSquared = 1 - (mse[0] / sst)
# F-statistic (статистика Фишера)
fStatistic = (rSquared / (k - 1)) / ((1 - rSquared) / (n - k))
out = pd.DataFrame() out = pd.DataFrame()
out[0] = params out[0] = params
out[1] = tStatistics out[1] = tStatistics
return RegressionResult( return out, mse[0], scaledResidualVariance, rSquared, fStatistic
out.to_numpy(),
np.float64(mse[0]),
['c'] + [f'x{i}' for i in range(1, len(params))]
)
def squaredPolynom(inputData): def prediction(inputData, result: RegressionResult):
x = inputData[:, 1:] inputs = inputData[:, 1:]
y = inputData[:, 0] outputs = inputData[:, 0]
result, powers, tStatistics, mse = multipolyfit(x, y, 2, full=True)
betas = result[0]
out = pd.DataFrame() params = result.paramsAndImportance[:, 0]
out[0] = betas
out[1] = tStatistics
return RegressionResult( expr = sp.sympify(' '.join(
out.to_numpy(), [
np.float64(mse[0]), f'{param}' if m == 'c' else f' + ({param}) * {m}'
['c' if str(x) == '1' else str(x) for x in getTerms(powers)] 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

63
statapp/combo_delegate.py Normal file
View File

@@ -0,0 +1,63 @@
#
# 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 import QtCore
from PySide2.QtWidgets import QComboBox, QItemDelegate
class ComboDelegate(QItemDelegate):
commitData = QtCore.Signal(object)
"""
A delegate that places a fully functioning QComboBox in every
cell of the column to which it's applied
"""
def __init__(self, parent, objects, objectNames):
"""
Constructoe
:param parent: QTableView parent object
:param objects: List of objects to set. i.e. [True, False]
:param objectNames: List of Object names to display. i.e. ['True', 'False']
"""
QItemDelegate.__init__(self, parent)
# objects to sent to the model associated to the combobox. i.e. [True, False]
self.objects = objects
# object description to display in the combobox. i.e. ['True', 'False']
self.objectNames = objectNames
@QtCore.Slot()
def currentIndexChanged(self):
self.commitData.emit(self.sender())
def createEditor(self, parent, option, index):
combo = QComboBox(parent)
combo.addItems(self.objectNames)
combo.currentIndexChanged.connect(self.currentIndexChanged)
return combo
def setEditorData(self, editor, index):
editor.blockSignals(True)
val = index.model().data(index, role=QtCore.Qt.DisplayRole)
idx = self.objects.index(val)
editor.setCurrentIndex(idx)
editor.blockSignals(False)
def setModelData(self, editor, model, index):
model.setData(index, self.objects[editor.currentIndex()], QtCore.Qt.EditRole)

20
statapp/constants.py Normal file
View File

@@ -0,0 +1,20 @@
#
# 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/>.
#
NUMBERS_PRECISION = 5

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).
@@ -23,6 +23,7 @@ from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QDialog, QHeaderView from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import correlationAnalysis from statapp.calculations import correlationAnalysis
from statapp.constants import NUMBERS_PRECISION
from statapp.mathtex_header_view import MathTexHeaderView from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.correlation_analysis_model import CorrelationAnalysisModel from statapp.models.correlation_analysis_model import CorrelationAnalysisModel
from statapp.ui.ui_correlation_analysis_window import Ui_CorrelationAnalysisWindow from statapp.ui.ui_correlation_analysis_window import Ui_CorrelationAnalysisWindow
@@ -36,7 +37,7 @@ class CorrelationAnalysisWindow(QDialog):
self.ui.setupUi(self) self.ui.setupUi(self)
res = correlationAnalysis(data) res = correlationAnalysis(data)
self.model = CorrelationAnalysisModel(res.round(2)) self.model = CorrelationAnalysisModel(res.round(NUMBERS_PRECISION))
self.ui.tableView.setModel(self.model) self.ui.tableView.setModel(self.model)
self.ui.tableView.setVerticalHeader( self.ui.tableView.setVerticalHeader(
MathTexHeaderView(self.ui.tableView) MathTexHeaderView(self.ui.tableView)

542
statapp/docs/README.html Normal file

File diff suppressed because one or more lines are too long

210
statapp/docs/README.md Normal file
View File

@@ -0,0 +1,210 @@
<!--
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/>.
-->
# Руководство пользователя для программы "Statapp"
## Условные обозначения
`Взаимодействие` - так отображается интерфестные части приложения с которыми пользователь может и должен взаимодействовать. к тами относятся кнопки, пункты меню, окна приложения, страницы в моделировании и тд.
*Пример* - так отображаются комментарии или описания. Обычно используются в качестве подписей к картинкам.
***Параметр*** - так отображаются параметры, которые пользователь может получить в результате вычислений в приложении.
## Введение
"Statapp" — это программное решение для статистического анализа и регрессионного моделирования, позволяющее специалистам в области данных проводить глубокий анализ и создавать точные прогностические модели.
## Теоретические сведения
*-- В разработке --*
## Начало работы
### Генерация показателей
<hr>
### Генерация отклика
Перед тем как начать анализ, необходимо сгенерировать отклики, которые будут использоваться как зависимые переменные в моделях:
1. Перейдите в меню `Генерация показателей`.
2. Выберите `Генерация отклика`.
После этого откроется окно `Генерация отклика`:
<image src="files/Генерация показателей - Генерация отклика.PNG">
*Пример пункта меню* `Генерация отклика`
3. Укажите необходимые параметры для генерации данных и нажмите кнопку `Сгенерировать`.
<image src="files/Окно - Генерация отклика.PNG" width=400>
*Пример окна* `Генерация отклика`
После этого окно должно закрыться и на `Белом листе` в `Главном окне` появится колонка со случайно сгенерированными данными отклика по заданным показателям.
<hr>
### Генерация фактора
После генерации откликов следует сгенерировать факторы, которые будут служить независимыми переменными. Для генерации факторов необходимо выполнить следующие шаги:
1. Перейдите в меню `Генерация показателей`.
2. Выберите `Генерация фактора`.
После этого откроется окно `Генерация фактора`:
<image src="files/Генерация показателей - Генерация фактора.PNG">
*Пример пункта меню* `Генерация фактора`
3. Выберите нужный тип связи к отклику (прямая или обратная).
4. Укажите оставшиеся параметры для генерации данных и нажмите кнопку `Сгенерировать`.
<image src="files/Окно - Генерация фактора.PNG" width=400>
*Пример окна* `Генерация отклика`
Можно добавлять несколько факторов.
<hr>
### Анализ данных
После генерации отклика и факторов можно приступать к анализу данных.
<hr>
### Дисперсионный анализ
1. Перейдите в меню `Анализ данных`.
2. Выберите `Дисперсионный анализ`.
<image src="files/Анализ данных - Дисперсионный анализ.PNG">
*Пример пункта меню* `Дисперсионный анализ`
После этого откроется окно `Дисперсионный анализ`:
<image src="files/Окно - Дисперсионный анализ.PNG">
*Пример окна* `Дисперсионный анализ`
<hr>
### Корреляционный анализ
1. Перейдите в меню `Анализ данных`.
2. Выберите `Корреляционный анализ`.
<image src="files/Анализ данных - Корреляционный анализ.PNG">
*Пример пункта меню* `Корреляционный анализ`
После этого откроется окно `Корреляционный анализ`:
<image src="files/Окно - Корреляционный анализ.PNG">
*Пример окна* `Корреляционный анализ`
<hr>
### Моделирование
После генерации отклика и факторов можно перейти к построению регрессионных моделей.
Здесь вы можете увидеть параметры модели, её характеристики, прогноз и отклонения, а также график прогноза и отклонения.
1. Перейдите на вкладку `Моделирование`.
2. Выберите тип модели для построения: `Линейный полином`, `Квадратичный полином` или `Преобразования`.
<image src="files/Моделирование - Линейный полином.PNG">
*Пример список пунктов меню* `Моделирование`
На странице `Модель` любого окна из `Моделирование` можно увидеть данные ***Коэффициент регрессии*** и ***Коэффициент значимости*** в виде таблицы для отклика и каждого из факторов. В нижней части окна располагаются вычисленные значения для параметров: ***Остаточная дисперсия***, ***Остаточная дисперсия (масштабированная)***, ***F1 - отношение Фишера***, ***Коэффициент множественной детерминации***,
<image src="files/Окно - Полином (Линейный полином).PNG">
*Пример страницы* `Модель` *окна* `Линейный полином`
На странице `Прогноз` любого окна из `Моделирование` можно увидеть значения ***Прогноза*** и ***Отклонения*** для каждого ранее сгенерированного значения ***Отклика***.
<image src="files/Окно - Полином - Прогноз.PNG">
*Пример страницы* `Прогноз` *окна* `Линейный полином`
На странице `График` любого окна из `Моделирование` можно увидеть график ***Прогноза*** (график) и ***Отклонения*** (точки).
<image src="files/Окно - Полином - График.PNG">
*Пример страницы* `График` *окна* `Линейный полином`
При необходимости, в окне `Моделирование` - `Преобразования` для каждого фактора вы можете выбрать одно из доступных преобразований.
<image src="files/Окно - Полином (Преобразования).PNG">
*Пример окна* `Преобразования`
Для выбора преобразования для определенного фактора необходимо выполнить следующие шаги:
1. Перейдите на страницу `Модель` в окне `Преобразования`.
2. Дважды нажмите на нужную ячейку в колонке ***Преобразования***.
3. Выберите необходимое преобразование из выпадающего списка.
<image src="files/Преобразования - Выбор преобразования.PNG">
*Пример списка выбора* ***Преобразования*** *фактора в окне* `Преобразования`
*Комментарий: если значения не персчитались попробуйте снять выделение с ячейки, путем нажатия на другую ячейку*
<hr>
### Сохранение и открытие файла
Сгенерированные значения ***Отклика*** и ***Фактора*** из таблицы в `Главном окне` можно сохранить или зугрузить из файла ***.txt*** и ***.csv***.
### Сохранение файла
1. Перейдите в меню `Файл`.
2. Выберите `Сохранить`.
<image src="files/Файл - Сохранить.PNG">
*Пример пункта меню* `Сохранить файл`
3. Выберите путь сохранения и тип файла и нажмите кнопку `Сохранить`.
Теперь файл будет сохранен по указаному вами пути, его можно переместить куда необходимо и при необходимости загрузить обратно в приложение.
### Открытие файла
1. Перейдите в меню `Файл`.
2. Выберите `Открыть`.
<image src="files/Файл - Открыть.PNG">
*Пример пункта меню* `Открыть файл`
3. Выберите путь до открываемого файла и нажмите кнопку `Открыть`.
Приложение загрузит нужный вам файл, и при необходимости спросит нужно ли сохранять ваши текущие данные.

BIN
statapp/docs/README.pdf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

36
statapp/docs/grip.css Normal file
View File

@@ -0,0 +1,36 @@
/*
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/>.
*/
#preview-page {
margin-top: 0px;
margin-bottom: 0px;
}
#readme {
border: none;
}
#readme > .Box-header {
border: none;
display: none !important;
}
#readme > .Box-body {
border: 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).

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,44 +0,0 @@
#
# 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/>.
#
from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import linearPolynom
from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.regression_result_model import RegressionResultModel
from statapp.ui.ui_linear_polynom_window import Ui_LinearPolynomWindow
from statapp.utils import addIcon
class LinearPolynomWindow(QDialog):
def __init__(self, data):
super().__init__()
self.ui = Ui_LinearPolynomWindow()
self.ui.setupUi(self)
addIcon(self)
result = linearPolynom(data)
self.model = RegressionResultModel(result)
self.ui.tableView.setModel(self.model)
self.ui.tableView.setVerticalHeader(MathTexHeaderView(self.ui.tableView))
header = self.ui.tableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.ui.residualVarianceValueLabel.setText(str(result.residualVariance))

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).
@@ -19,22 +19,25 @@
# #
import numpy as np import numpy as np
from PySide2 import QtCore from PySide2 import QtCore
from PySide2.QtCore import Slot from PySide2.QtCore import Slot, Qt, QPoint
from PySide2.QtWidgets import QMainWindow, QMessageBox from PySide2.QtWidgets import QMainWindow, QMessageBox, QAction, QMenu
from statapp.calculations import generateXValues, generateYValues from statapp.calculations import generateXValues, generateYValues
from statapp.constants import NUMBERS_PRECISION
from statapp.generate_factor_window import GenerateFactorWindow from statapp.generate_factor_window import GenerateFactorWindow
from statapp.linear_polynom_window import LinearPolynomWindow from statapp.polynoms.linear_polynom_window import LinearPolynomWindow
from statapp.mathtex_header_view import MathTexHeaderView from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.input_values_model import InputValuesModel from statapp.models.input_values_model import InputValuesModel
from statapp.generate_window import GenerateWindow from statapp.generate_window import GenerateWindow
from statapp.about_window import AboutWindow from statapp.about_window import AboutWindow
from statapp.models.fileslc_model import FileSLCModel from statapp.models.fileslc_model import FileSLCModel
from statapp.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 from statapp.usage_window import UsageWindow
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
class MainWindow(QMainWindow): class MainWindow(QMainWindow):
@@ -55,13 +58,16 @@ class MainWindow(QMainWindow):
self.ui.correlationAnalisisAction, self.ui.correlationAnalisisAction,
self.ui.linearPolynomAction, self.ui.linearPolynomAction,
self.ui.squaredPolynomAction, self.ui.squaredPolynomAction,
self.ui.transformPolynomAction,
] ]
self.aboutWindow = None self.aboutWindow = None
self.usageWindow = None
self.isDataChanged = False self.isDataChanged = False
self.model = InputValuesModel() self.model = InputValuesModel()
self.fileModel = FileSLCModel() self.fileModel = FileSLCModel()
self.ui.tableView.setItemDelegate(FloatDelegate())
self.ui.tableView.setModel(self.model) self.ui.tableView.setModel(self.model)
self.ui.tableView.setHorizontalHeader( self.ui.tableView.setHorizontalHeader(
MathTexHeaderView(self.ui.tableView, orientation=QtCore.Qt.Horizontal) MathTexHeaderView(self.ui.tableView, orientation=QtCore.Qt.Horizontal)
@@ -75,6 +81,27 @@ class MainWindow(QMainWindow):
# x1 = generateXValues(20, 2, 0, y) # x1 = generateXValues(20, 2, 0, y)
# x2 = generateXValues(10, 1, 0, y) # x2 = generateXValues(10, 1, 0, y)
# self.model.updateAllData(np.concatenate([y, x1, x2], axis=1)) # self.model.updateAllData(np.concatenate([y, x1, x2], axis=1))
self.ui.tableView.horizontalHeader().setContextMenuPolicy(Qt.CustomContextMenu)
self.ui.tableView.horizontalHeader().customContextMenuRequested.connect(self.removeColumn)
def removeColumn(self, event: QPoint):
menu = QMenu(self)
col = self.ui.tableView.columnAt(event.x())
if col == 0:
return
def fun():
self.model.removeCol(col)
self.isDataChanged = True
selectAction = QAction("Удалить", self)
selectAction.triggered.connect(fun)
menu.addAction(selectAction)
menu.exec_(self.ui.tableView.mapToGlobal(event))
def updateActionsEnabled(self): def updateActionsEnabled(self):
@@ -99,96 +126,136 @@ class MainWindow(QMainWindow):
@Slot() @Slot()
def on_openfileaction_triggered(self): def on_openfileaction_triggered(self):
currentData = self.model.getData() try:
data = np.array([]) currentData = self.model.getData()
if currentData.size > 1: data = np.array([])
file = '' if currentData.size > 1:
if self.fileModel.fileName: file = ''
file = '\nФайл сохранения: ' + self.fileModel.fileName if self.fileModel.fileName:
file = '\nФайл сохранения: ' + self.fileModel.fileName
msgBox = buildMessageBox \ msgBox = buildMessageBox \
('Сохранение данных', ('Сохранение данных',
"Сохранить данные?" + file, "Сохранить данные?" + file,
QMessageBox.Question, QMessageBox.Question,
QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel, QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel,
QMessageBox.Cancel) QMessageBox.Cancel)
reply = msgBox.exec_() reply = msgBox.exec_()
if reply == QMessageBox.StandardButton.Yes: if reply == QMessageBox.StandardButton.Yes:
self.fileModel.saveFile(self.model.getData()) self.fileModel.saveFile(self.model.getData())
data = self.fileModel.loadFile() data = self.fileModel.loadFile()
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
elif reply == QMessageBox.StandardButton.Cancel: elif reply == QMessageBox.StandardButton.Cancel:
return return
else:
data = self.fileModel.loadFile()
if data is not None and data.shape[0] > 0:
self.model.updateAllData(data)
self.isDataChanged = False
else: else:
data = self.fileModel.loadFile() data = self.fileModel.loadFile()
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
else: except Exception as error:
data = self.fileModel.loadFile() onError(error)
if data is not None and data.shape[0] > 0:
self.model.updateAllData(data)
self.isDataChanged = False
@Slot() @Slot()
def on_savefileaction_triggered(self): def on_savefileaction_triggered(self):
self.isDataChanged = not self.fileModel.saveFile(self.model.getData()) try:
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):
self.fileModel.closeFile() try:
self.isDataChanged = False self.fileModel.closeFile()
self.isDataChanged = False
except Exception as error:
onError(error)
@Slot() @Slot()
def on_generateYaction_triggered(self): def on_generateYaction_triggered(self):
gw = GenerateWindow() try:
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(2)) 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):
gfw = GenerateFactorWindow() try:
gfw = GenerateFactorWindow()
if gfw.exec(): if gfw.exec():
data = self.model.getData() data = self.model.getData()
y = self.model.getY() y = self.model.getY()
xValues = generateXValues(gfw.mat, gfw.deviation, gfw.typeConnection, y) xValues = generateXValues(gfw.mat, gfw.deviation, gfw.typeConnection, y)
data = np.concatenate((data, xValues.round(2)), 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):
self.aboutWindow = AboutWindow() self.aboutWindow = AboutWindow()
self.aboutWindow.show() self.aboutWindow.show()
@Slot()
def on_usageaction_triggered(self):
self.usageWindow = UsageWindow()
self.usageWindow.show()
@Slot() @Slot()
def on_varianceAnalysisAction_triggered(self): def on_varianceAnalysisAction_triggered(self):
dw = VarianceAnalysisWindow(self.model.getData()) try:
dw.exec() dw = VarianceAnalysisWindow(self.model.getData())
dw.exec()
except Exception as error:
onError(error)
@Slot() @Slot()
def on_correlationAnalisisAction_triggered(self): def on_correlationAnalisisAction_triggered(self):
dw = CorrelationAnalysisWindow(self.model.getData()) try:
dw.exec() dw = CorrelationAnalysisWindow(self.model.getData())
dw.exec()
except Exception as error:
onError(error)
@Slot() @Slot()
def on_linearPolynomAction_triggered(self): def on_linearPolynomAction_triggered(self):
dw = LinearPolynomWindow(self.model.getData()) try:
dw.exec() dw = LinearPolynomWindow(self.model.getData())
dw.exec()
except Exception as error:
onError(error)
@Slot() @Slot()
def on_squaredPolynomAction_triggered(self): def on_squaredPolynomAction_triggered(self):
dw = SquaredPolynomWindow(self.model.getData()) try:
dw.exec() dw = SquaredPolynomWindow(self.model.getData())
dw.exec()
except Exception as error:
onError(error)
@Slot()
def on_transformPolynomAction_triggered(self):
try:
dw = TransformPolynomWindow(self.model.getData())
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).
@@ -20,6 +20,7 @@
import numpy as np import numpy as np
from PySide2.QtWidgets import QFileDialog, QMessageBox from PySide2.QtWidgets import QFileDialog, QMessageBox
from statapp.constants import NUMBERS_PRECISION
from statapp.utils import buildMessageBox from statapp.utils import buildMessageBox
@@ -57,7 +58,7 @@ class FileSLCModel:
None, "Сохранить файл", "", "Text Files (*.txt);;CSV Files (*.csv)" None, "Сохранить файл", "", "Text Files (*.txt);;CSV Files (*.csv)"
) )
if self.fileName: if self.fileName:
np.savetxt(self.fileName, data, delimiter=",", fmt='%10.5f') np.savetxt(self.fileName, data, delimiter=",", fmt=f"%.{NUMBERS_PRECISION}f")
return True return True
return False return False

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,3 +33,6 @@ class InputValuesModel(EditableTableModel):
def getY(self): def getY(self):
return self._data[:, 0] return self._data[:, 0]
def removeCol(self, index: int):
self.updateAllData(np.delete(self._data, index, axis=1))

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

@@ -0,0 +1,74 @@
#
# 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/>.
#
import numpy as np
from PySide2.QtCore import Qt
from statapp.models.editable_table_model import EditableTableModel
from statapp.models.regression_result_model import RegressionResultModel
def defaultX(x):
return x
TRANSFORMS = {
'-': defaultX,
'sin(x)': np.sin,
'cos(x)': np.cos,
'log(x)': np.log,
'exp(x)': np.exp,
}
class TransformPolynomModel(RegressionResultModel, EditableTableModel):
def __init__(self, result):
self._monomials = None
super().__init__(result)
n = result.paramsAndImportance.shape[0]
self._transforms = ['-'] * n
def columnCount(self, index):
return 3
def updateAllData(self, data):
d = data.paramsAndImportance
self._monomials = data.monomials
super().updateAllData(d)
def flags(self, index):
if index.column() == 0 and index.row() != 0:
return EditableTableModel.flags(self, index)
return RegressionResultModel.flags(self, index)
def data(self, index, role):
if role == Qt.DisplayRole and index.column() == 0:
return self._transforms[index.row()]
return super().data(index, role)
def setData(self, index, value, role):
if role == Qt.EditRole and index.column() == 0:
self._transforms[index.row()] = value
topLeftIndex = self.createIndex(index.row(), 0)
bottomRightIndex = self.createIndex(index.row(), 0)
self.dataChanged.emit(topLeftIndex, bottomRightIndex)
return True
return super().setData(index, value, role)
def getHorizontalHeader(self):
return ['Преобразования'] + super().getHorizontalHeader()

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,27 @@
#
# 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 statapp.calculations import linearPolynom
from statapp.polynoms.polynom_window import PolynomWindow
class LinearPolynomWindow(PolynomWindow):
def __init__(self, data):
result = linearPolynom(data)
super().__init__(data, result, "Линейный полином")

View File

@@ -0,0 +1,89 @@
#
# 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/>.
#
import numpy as np
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.models.prediction_table_model import PreditionTableModel
from statapp.models.regression_result_model import RegressionResultModel
from statapp.ui.ui_polynom_window import Ui_PolynomWindow
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):
def __init__(self, data, result, windowTitle):
super().__init__()
self.ui = Ui_PolynomWindow()
self.ui.setupUi(self)
addIcon(self)
self.setWindowTitle(windowTitle)
self.model = RegressionResultModel(result)
self.ui.tableView.setItemDelegate(FloatDelegate())
self.ui.tableView.setModel(self.model)
self.ui.tableView.setVerticalHeader(MathTexHeaderView(self.ui.tableView))
header = self.ui.tableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.ui.residualVarianceValueLabel.setText(str(result.residualVariance))
self.ui.scaledResidualVarianceValueLabel.setText(str(result.scaledResidualVariance))
self.ui.fStatisticValueLabel.setText(str(result.fStatistic))
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

@@ -0,0 +1,27 @@
#
# 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 statapp.calculations import squaredPolynom
from statapp.polynoms.polynom_window import PolynomWindow
class SquaredPolynomWindow(PolynomWindow):
def __init__(self, data):
result = squaredPolynom(data)
super().__init__(data, result, "Квадратичный полином")

View File

@@ -0,0 +1,120 @@
#
# 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/>.
#
import numpy as np
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import linearPolynom, prediction
from statapp.combo_delegate import ComboDelegate
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.polynoms.polynom_window import MplCanvas
from statapp.ui.ui_polynom_window import Ui_PolynomWindow
from statapp.utils import addIcon, onError
class TransformPolynomWindow(QDialog):
def __init__(self, data):
super().__init__()
self.ui = Ui_PolynomWindow()
self.ui.setupUi(self)
addIcon(self)
self.setWindowTitle("Преобразования")
self.data = 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))
# Добавление столбца к исходному массиву
result.paramsAndImportance = np.column_stack((zeroCol, result.paramsAndImportance))
# self.ui.tableView.setItemDelegate(FloatDelegate())
self.ui.tableView.setItemDelegate(
ComboDelegate(
self.ui.tableView,
list(TRANSFORMS.keys()),
list(TRANSFORMS.keys()),
)
)
self.model = TransformPolynomModel(result)
self.ui.tableView.setModel(self.model)
self.ui.tableView.setVerticalHeader(MathTexHeaderView(self.ui.tableView))
header = self.ui.tableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.ui.residualVarianceValueLabel.setText(str(result.residualVariance))
self.ui.scaledResidualVarianceValueLabel.setText(str(result.scaledResidualVariance))
self.ui.fStatisticValueLabel.setText(str(result.fStatistic))
self.ui.rSquaredValueLabel.setText(str(result.scaledResidualVariance))
self.model.dataChanged.connect(self.on_data_changed)
def on_data_changed(self):
data = np.copy(self.data)
print(len(data[0:]))
for i in range(len(data[0:])):
for j in range(1, len(data[i])):
tr = self.model.data(self.model.createIndex(j, 0), Qt.DisplayRole)
data[i][j] = TRANSFORMS[tr](data[i][j])
try:
self.rebuildData(data)
except Exception as error:
onError(error)
def rebuildData(self, 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))
result.paramsAndImportance = np.column_stack((zeroCol, result.paramsAndImportance))
self.model.updateAllData(result)
self.ui.residualVarianceValueLabel.setText(str(result.residualVariance))
self.ui.scaledResidualVarianceValueLabel.setText(str(result.scaledResidualVariance))
self.ui.fStatisticValueLabel.setText(str(result.fStatistic))
self.ui.rSquaredValueLabel.setText(str(result.scaledResidualVariance))

View File

@@ -1,44 +0,0 @@
#
# 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/>.
#
from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import squaredPolynom
from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.regression_result_model import RegressionResultModel
from statapp.ui.ui_squared_polynom_window import Ui_SquaredPolynomWindow
from statapp.utils import addIcon
class SquaredPolynomWindow(QDialog):
def __init__(self, data):
super().__init__()
self.ui = Ui_SquaredPolynomWindow()
self.ui.setupUi(self)
addIcon(self)
result = squaredPolynom(data)
self.model = RegressionResultModel(result)
self.ui.tableView.setModel(self.model)
self.ui.tableView.setVerticalHeader(MathTexHeaderView(self.ui.tableView))
header = self.ui.tableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.ui.residualVarianceValueLabel.setText(str(result.residualVariance))

View File

@@ -71,6 +71,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="decimals">
<number>5</number>
</property>
<property name="maximum"> <property name="maximum">
<double>1000000.000000000000000</double> <double>1000000.000000000000000</double>
</property> </property>
@@ -83,6 +86,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="decimals">
<number>5</number>
</property>
<property name="maximum"> <property name="maximum">
<double>1000000.000000000000000</double> <double>1000000.000000000000000</double>
</property> </property>

View File

@@ -44,6 +44,9 @@
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QDoubleSpinBox" name="matSpinBox"> <widget class="QDoubleSpinBox" name="matSpinBox">
<property name="decimals">
<number>5</number>
</property>
<property name="maximum"> <property name="maximum">
<double>1000000.000000000000000</double> <double>1000000.000000000000000</double>
</property> </property>
@@ -68,6 +71,9 @@
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QDoubleSpinBox" name="deviationSpinBox"> <widget class="QDoubleSpinBox" name="deviationSpinBox">
<property name="decimals">
<number>5</number>
</property>
<property name="maximum"> <property name="maximum">
<double>1000000.000000000000000</double> <double>1000000.000000000000000</double>
</property> </property>

View File

@@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LinearPolynomWindow</class>
<widget class="QDialog" name="LinearPolynomWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>630</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Линейный полином</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<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>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<property name="topMargin">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="residualVarianceLabel">
<property name="text">
<string>Остаточная дисперсия:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="residualVarianceValueLabel">
<property name="text">
<string>undefined</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -40,7 +40,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>27</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="filemenu"> <widget class="QMenu" name="filemenu">
@@ -71,11 +71,13 @@
</property> </property>
<addaction name="linearPolynomAction"/> <addaction name="linearPolynomAction"/>
<addaction name="squaredPolynomAction"/> <addaction name="squaredPolynomAction"/>
<addaction name="transformPolynomAction"/>
</widget> </widget>
<widget class="QMenu" name="helpmenu"> <widget class="QMenu" name="helpmenu">
<property name="title"> <property name="title">
<string>Справка</string> <string>Справка</string>
</property> </property>
<addaction name="usageaction"/>
<addaction name="aboutmenuaction"/> <addaction name="aboutmenuaction"/>
</widget> </widget>
<addaction name="filemenu"/> <addaction name="filemenu"/>
@@ -135,6 +137,16 @@
<string>Квадратичный полином</string> <string>Квадратичный полином</string>
</property> </property>
</action> </action>
<action name="transformPolynomAction">
<property name="text">
<string>Преобразования</string>
</property>
</action>
<action name="usageaction">
<property name="text">
<string>Использование</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@@ -0,0 +1,146 @@
<?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="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">
<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>
<item row="2" column="3">
<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>
</layout>
</item>
</layout>
</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" rowstretch="1,0">
<item row="0" column="0">
<layout class="QGridLayout" name="plotContainer"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Точки - отклик. Линия - прогноз</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SquaredPolynomWindow</class>
<widget class="QDialog" name="SquaredPolynomWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>630</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Квадратичный полином</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTableView" name="tableView"/>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<property name="topMargin">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="residualVarianceLabel">
<property name="text">
<string>Остаточная дисперсия:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="residualVarianceValueLabel">
<property name="text">
<string>undefined</string>
</property>
</widget>
</item>
</layout>
</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).
@@ -71,6 +71,7 @@ class Ui_GenerateFactorWindow(object):
self.matSpinBox = QDoubleSpinBox(GenerateFactorWindow) self.matSpinBox = QDoubleSpinBox(GenerateFactorWindow)
self.matSpinBox.setObjectName(u"matSpinBox") self.matSpinBox.setObjectName(u"matSpinBox")
self.matSpinBox.setFont(font) self.matSpinBox.setFont(font)
self.matSpinBox.setDecimals(5)
self.matSpinBox.setMaximum(1000000.000000000000000) self.matSpinBox.setMaximum(1000000.000000000000000)
self.gridLayout.addWidget(self.matSpinBox, 1, 1, 1, 1) self.gridLayout.addWidget(self.matSpinBox, 1, 1, 1, 1)
@@ -78,6 +79,7 @@ class Ui_GenerateFactorWindow(object):
self.deviationSpinBox = QDoubleSpinBox(GenerateFactorWindow) self.deviationSpinBox = QDoubleSpinBox(GenerateFactorWindow)
self.deviationSpinBox.setObjectName(u"deviationSpinBox") self.deviationSpinBox.setObjectName(u"deviationSpinBox")
self.deviationSpinBox.setFont(font) self.deviationSpinBox.setFont(font)
self.deviationSpinBox.setDecimals(5)
self.deviationSpinBox.setMaximum(1000000.000000000000000) self.deviationSpinBox.setMaximum(1000000.000000000000000)
self.gridLayout.addWidget(self.deviationSpinBox, 2, 1, 1, 1) self.gridLayout.addWidget(self.deviationSpinBox, 2, 1, 1, 1)

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).
@@ -62,6 +62,7 @@ class Ui_GenerateWindow(object):
self.matSpinBox = QDoubleSpinBox(GenerateWindow) self.matSpinBox = QDoubleSpinBox(GenerateWindow)
self.matSpinBox.setObjectName(u"matSpinBox") self.matSpinBox.setObjectName(u"matSpinBox")
self.matSpinBox.setDecimals(5)
self.matSpinBox.setMaximum(1000000.000000000000000) self.matSpinBox.setMaximum(1000000.000000000000000)
self.gridLayout.addWidget(self.matSpinBox, 1, 1, 1, 1) self.gridLayout.addWidget(self.matSpinBox, 1, 1, 1, 1)
@@ -80,6 +81,7 @@ class Ui_GenerateWindow(object):
self.deviationSpinBox = QDoubleSpinBox(GenerateWindow) self.deviationSpinBox = QDoubleSpinBox(GenerateWindow)
self.deviationSpinBox.setObjectName(u"deviationSpinBox") self.deviationSpinBox.setObjectName(u"deviationSpinBox")
self.deviationSpinBox.setDecimals(5)
self.deviationSpinBox.setMaximum(1000000.000000000000000) self.deviationSpinBox.setMaximum(1000000.000000000000000)
self.gridLayout.addWidget(self.deviationSpinBox, 2, 1, 1, 1) self.gridLayout.addWidget(self.deviationSpinBox, 2, 1, 1, 1)

View File

@@ -1,82 +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 'linear_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_LinearPolynomWindow(object):
def setupUi(self, LinearPolynomWindow):
if not LinearPolynomWindow.objectName():
LinearPolynomWindow.setObjectName(u"LinearPolynomWindow")
LinearPolynomWindow.resize(630, 400)
self.gridLayout_2 = QGridLayout(LinearPolynomWindow)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout")
self.tableView = QTableView(LinearPolynomWindow)
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, 0, 0, 1, 1)
self.gridLayout_3 = QGridLayout()
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.gridLayout_3.setContentsMargins(-1, 10, -1, -1)
self.residualVarianceLabel = QLabel(LinearPolynomWindow)
self.residualVarianceLabel.setObjectName(u"residualVarianceLabel")
self.gridLayout_3.addWidget(self.residualVarianceLabel, 0, 0, 1, 1)
self.residualVarianceValueLabel = QLabel(LinearPolynomWindow)
self.residualVarianceValueLabel.setObjectName(u"residualVarianceValueLabel")
self.gridLayout_3.addWidget(self.residualVarianceValueLabel, 0, 1, 1, 1)
self.gridLayout.addLayout(self.gridLayout_3, 1, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
self.retranslateUi(LinearPolynomWindow)
QMetaObject.connectSlotsByName(LinearPolynomWindow)
# setupUi
def retranslateUi(self, LinearPolynomWindow):
LinearPolynomWindow.setWindowTitle(QCoreApplication.translate("LinearPolynomWindow", u"\u041b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c", None))
self.residualVarianceLabel.setText(QCoreApplication.translate("LinearPolynomWindow", u"\u041e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f:", None))
self.residualVarianceValueLabel.setText(QCoreApplication.translate("LinearPolynomWindow", 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).
@@ -58,6 +58,10 @@ class Ui_MainWindow(object):
self.linearPolynomAction.setObjectName(u"linearPolynomAction") self.linearPolynomAction.setObjectName(u"linearPolynomAction")
self.squaredPolynomAction = QAction(MainWindow) self.squaredPolynomAction = QAction(MainWindow)
self.squaredPolynomAction.setObjectName(u"squaredPolynomAction") self.squaredPolynomAction.setObjectName(u"squaredPolynomAction")
self.transformPolynomAction = QAction(MainWindow)
self.transformPolynomAction.setObjectName(u"transformPolynomAction")
self.usageaction = QAction(MainWindow)
self.usageaction.setObjectName(u"usageaction")
self.centralwidget = QWidget(MainWindow) self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u"centralwidget") self.centralwidget.setObjectName(u"centralwidget")
self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout = QGridLayout(self.centralwidget)
@@ -77,7 +81,7 @@ class Ui_MainWindow(object):
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(MainWindow) self.menubar = QMenuBar(MainWindow)
self.menubar.setObjectName(u"menubar") self.menubar.setObjectName(u"menubar")
self.menubar.setGeometry(QRect(0, 0, 800, 27)) self.menubar.setGeometry(QRect(0, 0, 800, 22))
self.filemenu = QMenu(self.menubar) self.filemenu = QMenu(self.menubar)
self.filemenu.setObjectName(u"filemenu") self.filemenu.setObjectName(u"filemenu")
self.generatemenu = QMenu(self.menubar) self.generatemenu = QMenu(self.menubar)
@@ -107,6 +111,8 @@ class Ui_MainWindow(object):
self.analyzemenu.addAction(self.correlationAnalisisAction) self.analyzemenu.addAction(self.correlationAnalisisAction)
self.modelmenu.addAction(self.linearPolynomAction) self.modelmenu.addAction(self.linearPolynomAction)
self.modelmenu.addAction(self.squaredPolynomAction) self.modelmenu.addAction(self.squaredPolynomAction)
self.modelmenu.addAction(self.transformPolynomAction)
self.helpmenu.addAction(self.usageaction)
self.helpmenu.addAction(self.aboutmenuaction) self.helpmenu.addAction(self.aboutmenuaction)
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
@@ -126,6 +132,8 @@ class Ui_MainWindow(object):
self.correlationAnalisisAction.setText(QCoreApplication.translate("MainWindow", u"\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437", None)) self.correlationAnalisisAction.setText(QCoreApplication.translate("MainWindow", u"\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437", None))
self.linearPolynomAction.setText(QCoreApplication.translate("MainWindow", u"\u041b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c", None)) self.linearPolynomAction.setText(QCoreApplication.translate("MainWindow", u"\u041b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c", None))
self.squaredPolynomAction.setText(QCoreApplication.translate("MainWindow", u"\u041a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c", None)) self.squaredPolynomAction.setText(QCoreApplication.translate("MainWindow", u"\u041a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c", None))
self.transformPolynomAction.setText(QCoreApplication.translate("MainWindow", u"\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f", None))
self.usageaction.setText(QCoreApplication.translate("MainWindow", u"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435", None))
self.label.setText(QCoreApplication.translate("MainWindow", u"\u0421\u0422\u0410\u0422\u0418\u0421\u0422\u0418\u0427\u0415\u0421\u041a\u0418\u0415 \u0414\u0410\u041d\u041d\u042b\u0415", None)) self.label.setText(QCoreApplication.translate("MainWindow", u"\u0421\u0422\u0410\u0422\u0418\u0421\u0422\u0418\u0427\u0415\u0421\u041a\u0418\u0415 \u0414\u0410\u041d\u041d\u042b\u0415", None))
self.filemenu.setTitle(QCoreApplication.translate("MainWindow", u"\u0424\u0430\u0439\u043b", None)) self.filemenu.setTitle(QCoreApplication.translate("MainWindow", u"\u0424\u0430\u0439\u043b", None))
self.generatemenu.setTitle(QCoreApplication.translate("MainWindow", u"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439", None)) self.generatemenu.setTitle(QCoreApplication.translate("MainWindow", u"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439", None))

162
statapp/ui/ui_polynom_window.py generated Normal file
View File

@@ -0,0 +1,162 @@
# -*- coding: utf-8 -*-
#
# 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/>.
#
################################################################################
## Form generated from reading UI file '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.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.setObjectName(u"gridLayout")
self.tableView = QTableView(self.model)
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.polynomResult = QGridLayout()
self.polynomResult.setObjectName(u"polynomResult")
self.polynomResult.setContentsMargins(-1, 10, -1, -1)
self.residualVarianceValueLabel = QLabel(self.model)
self.residualVarianceValueLabel.setObjectName(u"residualVarianceValueLabel")
self.polynomResult.addWidget(self.residualVarianceValueLabel, 0, 1, 1, 1)
self.scaledResidualVarianceValueLabel = QLabel(self.model)
self.scaledResidualVarianceValueLabel.setObjectName(u"scaledResidualVarianceValueLabel")
self.polynomResult.addWidget(self.scaledResidualVarianceValueLabel, 1, 1, 1, 1)
self.fStatisticLabel = QLabel(self.model)
self.fStatisticLabel.setObjectName(u"fStatisticLabel")
self.polynomResult.addWidget(self.fStatisticLabel, 2, 0, 1, 1)
self.residualVarianceLabel = QLabel(self.model)
self.residualVarianceLabel.setObjectName(u"residualVarianceLabel")
self.polynomResult.addWidget(self.residualVarianceLabel, 0, 0, 1, 1)
self.scaledResidualVarianceLabel = QLabel(self.model)
self.scaledResidualVarianceLabel.setObjectName(u"scaledResidualVarianceLabel")
self.polynomResult.addWidget(self.scaledResidualVarianceLabel, 1, 0, 1, 1)
self.rSquaredLabel = QLabel(self.model)
self.rSquaredLabel.setObjectName(u"rSquaredLabel")
self.polynomResult.addWidget(self.rSquaredLabel, 3, 0, 1, 1)
self.fStatisticValueLabel = QLabel(self.model)
self.fStatisticValueLabel.setObjectName(u"fStatisticValueLabel")
self.polynomResult.addWidget(self.fStatisticValueLabel, 2, 1, 1, 1)
self.rSquaredValueLabel = QLabel(self.model)
self.rSquaredValueLabel.setObjectName(u"rSquaredValueLabel")
self.polynomResult.addWidget(self.rSquaredValueLabel, 3, 1, 1, 1)
self.gridLayout.addLayout(self.polynomResult, 2, 3, 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.label = QLabel(self.tab)
self.label.setObjectName(u"label")
self.gridLayout_5.addWidget(self.label, 1, 0, 1, 1)
self.gridLayout_5.setRowStretch(0, 1)
self.tabWidget.addTab(self.tab, "")
self.gridLayout_2.addWidget(self.tabWidget, 0, 6, 1, 1)
self.retranslateUi(PolynomWindow)
self.tabWidget.setCurrentIndex(0)
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\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0446\u0438\u0438", None))
self.fStatisticValueLabel.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.label.setText(QCoreApplication.translate("PolynomWindow", u"\u0422\u043e\u0447\u043a\u0438 - \u043e\u0442\u043a\u043b\u0438\u043a. \u041b\u0438\u043d\u0438\u044f - \u043f\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

View File

@@ -1,79 +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 'squared_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_SquaredPolynomWindow(object):
def setupUi(self, SquaredPolynomWindow):
if not SquaredPolynomWindow.objectName():
SquaredPolynomWindow.setObjectName(u"SquaredPolynomWindow")
SquaredPolynomWindow.resize(630, 400)
self.gridLayout_2 = QGridLayout(SquaredPolynomWindow)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout")
self.tableView = QTableView(SquaredPolynomWindow)
self.tableView.setObjectName(u"tableView")
self.gridLayout.addWidget(self.tableView, 0, 0, 1, 1)
self.gridLayout_3 = QGridLayout()
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.gridLayout_3.setContentsMargins(-1, 10, -1, -1)
self.residualVarianceLabel = QLabel(SquaredPolynomWindow)
self.residualVarianceLabel.setObjectName(u"residualVarianceLabel")
self.gridLayout_3.addWidget(self.residualVarianceLabel, 0, 0, 1, 1)
self.residualVarianceValueLabel = QLabel(SquaredPolynomWindow)
self.residualVarianceValueLabel.setObjectName(u"residualVarianceValueLabel")
self.gridLayout_3.addWidget(self.residualVarianceValueLabel, 0, 1, 1, 1)
self.gridLayout.addLayout(self.gridLayout_3, 1, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
self.retranslateUi(SquaredPolynomWindow)
QMetaObject.connectSlotsByName(SquaredPolynomWindow)
# setupUi
def retranslateUi(self, SquaredPolynomWindow):
SquaredPolynomWindow.setWindowTitle(QCoreApplication.translate("SquaredPolynomWindow", u"\u041a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c", None))
self.residualVarianceLabel.setText(QCoreApplication.translate("SquaredPolynomWindow", u"\u041e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f:", None))
self.residualVarianceValueLabel.setText(QCoreApplication.translate("SquaredPolynomWindow", u"undefined", None))
# retranslateUi

56
statapp/ui/ui_usage_window.py generated Normal file
View File

@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
#
# 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/>.
#
################################################################################
## Form generated from reading UI file 'usage_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_UsageWindow(object):
def setupUi(self, UsageWindow):
if not UsageWindow.objectName():
UsageWindow.setObjectName(u"UsageWindow")
UsageWindow.resize(400, 300)
self.gridLayout = QGridLayout(UsageWindow)
self.gridLayout.setObjectName(u"gridLayout")
self.browserContainer = QVBoxLayout()
self.browserContainer.setObjectName(u"browserContainer")
self.gridLayout.addLayout(self.browserContainer, 0, 0, 1, 1)
self.retranslateUi(UsageWindow)
QMetaObject.connectSlotsByName(UsageWindow)
# setupUi
def retranslateUi(self, UsageWindow):
UsageWindow.setWindowTitle(QCoreApplication.translate("UsageWindow", u"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435", 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

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UsageWindow</class>
<widget class="QDialog" name="UsageWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Использование</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="browserContainer"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

40
statapp/usage_window.py Normal file
View File

@@ -0,0 +1,40 @@
#
# 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 QUrl
from PySide2.QtWebEngineWidgets import QWebEngineView
from PySide2.QtWidgets import QMainWindow, QVBoxLayout, QWidget
from statapp.utils import addIcon, resourcePath
class UsageWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Использование")
addIcon(self)
layout = QVBoxLayout()
self.browser = QWebEngineView()
layout.addWidget(self.browser)
self.browser.load(QUrl.fromLocalFile(resourcePath("docs/README.html")))
widget = QWidget()
widget.setLayout(layout)
self.setCentralWidget(widget)

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).
@@ -22,7 +22,9 @@ import sys
from PySide2.QtCore import QSize from PySide2.QtCore import QSize
from PySide2.QtGui import QIcon from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QMessageBox from PySide2.QtWidgets import QMessageBox, QDoubleSpinBox, QStyledItemDelegate
from statapp.constants import NUMBERS_PRECISION
def resourcePath(relative): def resourcePath(relative):
@@ -57,4 +59,31 @@ 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):
def __init__(self, parent=None):
QStyledItemDelegate.__init__(self, parent=parent)
def createEditor(self, parent, option, index):
editor = QDoubleSpinBox(parent)
editor.setDecimals(NUMBERS_PRECISION)
editor.setMaximum(10**8)
editor.setMinimum(-10**8)
return editor
def displayText(self, value, locale):
# Грязный хак, скорее всего нужно было использовать locale
return f'{value:.{NUMBERS_PRECISION}f}'

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).
@@ -20,10 +20,11 @@
from PySide2.QtWidgets import QDialog, QHeaderView from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import varianceAnalysis from statapp.calculations import varianceAnalysis
from statapp.constants import NUMBERS_PRECISION
from statapp.mathtex_header_view import MathTexHeaderView from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.variance_analysis_model import VarianceAnalysisModel from statapp.models.variance_analysis_model import VarianceAnalysisModel
from statapp.ui.ui_variance_analysis_window import Ui_VarianceAnalysisWindow from statapp.ui.ui_variance_analysis_window import Ui_VarianceAnalysisWindow
from statapp.utils import addIcon from statapp.utils import addIcon, FloatDelegate
class VarianceAnalysisWindow(QDialog): class VarianceAnalysisWindow(QDialog):
@@ -33,7 +34,8 @@ class VarianceAnalysisWindow(QDialog):
self.ui.setupUi(self) self.ui.setupUi(self)
res = varianceAnalysis(data) res = varianceAnalysis(data)
self.model = VarianceAnalysisModel(res.round(2)) self.model = VarianceAnalysisModel(res.round(NUMBERS_PRECISION))
self.ui.tableView.setItemDelegate(FloatDelegate())
self.ui.tableView.setModel(self.model) self.ui.tableView.setModel(self.model)
self.ui.tableView.setVerticalHeader( self.ui.tableView.setVerticalHeader(
MathTexHeaderView(self.ui.tableView) MathTexHeaderView(self.ui.tableView)