From 34a85fe8d1c948ae6f84b62d61c73fc00622d8a6 Mon Sep 17 00:00:00 2001 From: chrin Date: Tue, 11 Jun 2024 16:04:30 +0200 Subject: [PATCH] just starting --- .gitignore | 17 +++ help/.gitignore | 5 + help/README.md | 6 + help/index.html | 54 +++++++ help/make_and_install.sh | 2 + help/makefile | 9 ++ help/makefile~ | 9 ++ help/page1.html | 7 + help/page2.html | 7 + help/page3.html | 7 + help/page4.html | 7 + help/page5.html | 7 + help/tina.qrc | 10 ++ help/tina_resources.py | 282 +++++++++++++++++++++++++++++++++++++ pyrcc5/.gitignore | 5 + pyrcc5/tina_resources.py | 282 +++++++++++++++++++++++++++++++++++++ src/.gitignore | 5 + src/analysis.py | 297 +++++++++++++++++++++++++++++++++++++++ src/gui.py | 54 +++++++ test.json | 52 +++++++ tina.json | 45 ++++++ tina.py | 209 +++++++++++++++++++++++++++ tina.sh | 107 ++++++++++++++ wakeup.py | 57 ++++++++ 24 files changed, 1542 insertions(+) create mode 100644 .gitignore create mode 100644 help/.gitignore create mode 100644 help/README.md create mode 100755 help/index.html create mode 100755 help/make_and_install.sh create mode 100644 help/makefile create mode 100644 help/makefile~ create mode 100755 help/page1.html create mode 100755 help/page2.html create mode 100755 help/page3.html create mode 100755 help/page4.html create mode 100755 help/page5.html create mode 100644 help/tina.qrc create mode 100644 help/tina_resources.py create mode 100644 pyrcc5/.gitignore create mode 100644 pyrcc5/tina_resources.py create mode 100644 src/.gitignore create mode 100644 src/analysis.py create mode 100644 src/gui.py create mode 100755 test.json create mode 100755 tina.json create mode 100644 tina.py create mode 100755 tina.sh create mode 100644 wakeup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a971d2a --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +*.*~ +*.*-* +*.*+* +pyrcc5/*.*-* +pyrcc5/__pycache__ +pyrcc5/__pycache__/* +src/*.*~ +src/*.*-* +src/*.*+* +src/__pycache__ +src/__pycache__/* +help/*.*~ +help/*.*-* +help/*.*+* + + + diff --git a/help/.gitignore b/help/.gitignore new file mode 100644 index 0000000..9d85f00 --- /dev/null +++ b/help/.gitignore @@ -0,0 +1,5 @@ +*.*~ +*.*-* +*.*+* +__pycache__ +__pycache__/*.* \ No newline at end of file diff --git a/help/README.md b/help/README.md new file mode 100644 index 0000000..a7f649a --- /dev/null +++ b/help/README.md @@ -0,0 +1,6 @@ +# to compile hush.qrc: +make +# to install compiled hush_respources.py +make install + +The latter installs hush_respources.py to the ../pyqrcc5 directory \ No newline at end of file diff --git a/help/index.html b/help/index.html new file mode 100755 index 0000000..fca3f9a --- /dev/null +++ b/help/index.html @@ -0,0 +1,54 @@ +Time of Flight Measuement for Injector and Ring Cyclotron Turn Number Ascertainment, TINA + + +
June 2024, Jan Chrin, Pierre-André Duperrex, Waldamar Koprek
+

Time of Flight Measurement for Injector and Ring Cyclotron Turn Number Ascertainment, TINA

+

About

+ + +

The TINA application determines the number of turns in a cyclotron +from a Time of Flight (TOF) measurement technique and a cross-correlation +of fast sampled data from capacitive sensors located at the entrance and exit +of the cycolotron. This is based on a python implementation of a LabVIEW application developed by +Pierre-André Duperrex:
+P.-A. Duperrex and A. Facchetti, +Number of Turn Measurements on the HIPA Cyclotrons at PSI.
+doi:10.18429/JACoW-IPAC2018-WEPAL067 + + +

+ + +

The Repository

+ +

The application comprises two components: +

+

GUI, Control Tab

+ Main panel for use by operators. +

Operator Panel

+ +

Expert Panel

+ Selecting the Dry Run option disables setting values to epics process variables. + +

TINA Image

+ + +
+   + Tina Turner
+

+

+ + diff --git a/help/make_and_install.sh b/help/make_and_install.sh new file mode 100755 index 0000000..e7c2b22 --- /dev/null +++ b/help/make_and_install.sh @@ -0,0 +1,2 @@ +make compile +make install diff --git a/help/makefile b/help/makefile new file mode 100644 index 0000000..e22ce4b --- /dev/null +++ b/help/makefile @@ -0,0 +1,9 @@ +compile: + pyrcc5 tina.qrc > tina_resources.py + +install: + if [ ! -f tina_resources.py ]; then echo "pyrcc5 compilation of resources.qrc failed"; fi + if [ -f tina_resources.py -a -f ../pyrcc5/tina_resources.py-- ]; then cp ../pyrcc5/tina_resources.py-- ../pyrcc5/tina_resources.py---; fi + if [ -f tina_resources.py -a -f ../pyrcc5/tina_resources.py- ]; then cp ../pyrcc5/tina_resources.py- ../pyrcc5/tina_resources.py--; fi + if [ -f tina_resources.py -a -f ../pyrcc5/tina_resources.py ]; then cp ../pyrcc5/tina_resources.py ../pyrcc5/tina_resources.py-; fi + if [ -f tina_resources.py ]; then cp tina_resources.py ../pyrcc5/tina_resources.py; fi diff --git a/help/makefile~ b/help/makefile~ new file mode 100644 index 0000000..3ff7d5e --- /dev/null +++ b/help/makefile~ @@ -0,0 +1,9 @@ +compile: + pyrcc5 hush.qrc > hush_resources.py + +install: + if [ ! -f hush_resources.py ]; then echo "pyrcc5 compilation of resources.qrc failed"; fi + if [ -f hush_resources.py -a -f ../pyrcc5/hush_resources.py-- ]; then cp ../pyrcc5/hush_resources.py-- ../pyrcc5/hush_resources.py---; fi + if [ -f hush_resources.py -a -f ../pyrcc5/hush_resources.py- ]; then cp ../pyrcc5/hush_resources.py- ../pyrcc5/hush_resources.py--; fi + if [ -f hush_resources.py -a -f ../pyrcc5/hush_resources.py ]; then cp ../pyrcc5/hush_resources.py ../pyrcc5/hush_resources.py-; fi + if [ -f hush_resources.py ]; then cp hush_resources.py ../pyrcc5/hush_resources.py; fi diff --git a/help/page1.html b/help/page1.html new file mode 100755 index 0000000..6fa49c5 --- /dev/null +++ b/help/page1.html @@ -0,0 +1,7 @@ +Web Help + + +

Page 1 of web help

+

Next

+

etc... etc...

+ diff --git a/help/page2.html b/help/page2.html new file mode 100755 index 0000000..10f6352 --- /dev/null +++ b/help/page2.html @@ -0,0 +1,7 @@ +Web Help + + +

Page 2 of web help

+

Next

+

etc... etc...

+ diff --git a/help/page3.html b/help/page3.html new file mode 100755 index 0000000..f12e898 --- /dev/null +++ b/help/page3.html @@ -0,0 +1,7 @@ +Web Help + + +

Page 3 of web help

+

Next

+

etc... etc...

+ diff --git a/help/page4.html b/help/page4.html new file mode 100755 index 0000000..64c0eb6 --- /dev/null +++ b/help/page4.html @@ -0,0 +1,7 @@ +Web Help + + +

Page 4 of web help

+

Next

+

etc... etc...

+ diff --git a/help/page5.html b/help/page5.html new file mode 100755 index 0000000..639d750 --- /dev/null +++ b/help/page5.html @@ -0,0 +1,7 @@ +Web Help + + +

Page 5 of web help

+ +

etc... etc...

+ diff --git a/help/tina.qrc b/help/tina.qrc new file mode 100644 index 0000000..eefb6cb --- /dev/null +++ b/help/tina.qrc @@ -0,0 +1,10 @@ + + +page5.html +page4.html +page3.html +page2.html +page1.html +index.html + + diff --git a/help/tina_resources.py b/help/tina_resources.py new file mode 100644 index 0000000..f3345aa --- /dev/null +++ b/help/tina_resources.py @@ -0,0 +1,282 @@ +# -*- coding: utf-8 -*- + +# Resource object code +# +# Created by: The Resource Compiler for PyQt5 (Qt v5.15.3) +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore + +qt_resource_data = b"\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x33\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x34\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x31\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x32\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x08\x77\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x54\x69\x6d\x65\x20\x6f\x66\x20\x46\x6c\x69\x67\x68\x74\ +\x20\x4d\x65\x61\x73\x75\x65\x6d\x65\x6e\x74\x20\x66\x6f\x72\x20\ +\x49\x6e\x6a\x65\x63\x74\x6f\x72\x20\x61\x6e\x64\x20\x52\x69\x6e\ +\x67\x20\x43\x79\x63\x6c\x6f\x74\x72\x6f\x6e\x20\x54\x75\x72\x6e\ +\x20\x4e\x75\x6d\x62\x65\x72\x20\x41\x73\x63\x65\x72\x74\x61\x69\ +\x6e\x6d\x65\x6e\x74\x2c\x20\x54\x49\x4e\x41\x3c\x2f\x74\x69\x74\ +\x6c\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\ +\x3e\x0a\x0a\x3c\x68\x35\x20\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\ +\x6f\x6c\x6f\x72\x3a\x67\x72\x61\x79\x3b\x22\x3e\x4a\x75\x6e\x65\ +\x20\x32\x30\x32\x34\x2c\x20\x4a\x61\x6e\x20\x43\x68\x72\x69\x6e\ +\x2c\x20\x50\x69\x65\x72\x72\x65\x2d\x41\x6e\x64\x72\x26\x65\x61\ +\x63\x75\x74\x65\x3b\x20\x44\x75\x70\x65\x72\x72\x65\x78\x2c\x20\ +\x57\x61\x6c\x64\x61\x6d\x61\x72\x20\x4b\x6f\x70\x72\x65\x6b\x3c\ +\x2f\x68\x35\x3e\x0a\x3c\x68\x34\x3e\x20\x3c\x73\x70\x61\x6e\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\ +\x64\x3b\x22\x3e\x54\x3c\x2f\x73\x70\x61\x6e\x3e\x69\x6d\x65\x20\ +\x6f\x66\x20\x46\x6c\x69\x67\x68\x74\x20\x4d\x65\x61\x73\x75\x72\ +\x65\x6d\x65\x6e\x74\x20\x66\x6f\x72\x20\x3c\x73\x70\x61\x6e\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\ +\x64\x3b\x22\x3e\x49\x3c\x2f\x73\x70\x61\x6e\x3e\x6e\x6a\x65\x63\ +\x74\x6f\x72\x20\x61\x6e\x64\x20\x52\x69\x6e\x67\x20\x43\x79\x63\ +\x6c\x6f\x74\x72\x6f\x6e\x20\x54\x75\x72\x6e\x20\x3c\x73\x70\x61\ +\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\ +\x72\x65\x64\x3b\x22\x3e\x4e\x3c\x2f\x73\x70\x61\x6e\x3e\x75\x6d\ +\x62\x65\x72\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\ +\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x41\x3c\ +\x2f\x73\x70\x61\x6e\x3e\x73\x63\x65\x72\x74\x61\x69\x6e\x6d\x65\ +\x6e\x74\x2c\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\ +\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x54\x49\ +\x4e\x41\x3c\x2f\x73\x70\x61\x6e\x3e\x3c\x2f\x68\x34\x3e\x0a\x3c\ +\x68\x32\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ +\x62\x6c\x75\x65\x3b\x22\x3e\x41\x62\x6f\x75\x74\x3c\x2f\x68\x32\ +\x3e\x0a\x0a\x0a\x3c\x70\x3e\x54\x68\x65\x20\x54\x49\x4e\x41\x20\ +\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x64\x65\x74\x65\ +\x72\x6d\x69\x6e\x65\x73\x20\x74\x68\x65\x20\x6e\x75\x6d\x62\x65\ +\x72\x20\x6f\x66\x20\x74\x75\x72\x6e\x73\x20\x69\x6e\x20\x61\x20\ +\x63\x79\x63\x6c\x6f\x74\x72\x6f\x6e\x0a\x66\x72\x6f\x6d\x20\x61\ +\x20\x54\x69\x6d\x65\x20\x6f\x66\x20\x46\x6c\x69\x67\x68\x74\x20\ +\x28\x54\x4f\x46\x29\x20\x6d\x65\x61\x73\x75\x72\x65\x6d\x65\x6e\ +\x74\x20\x74\x65\x63\x68\x6e\x69\x71\x75\x65\x20\x61\x6e\x64\x20\ +\x61\x20\x63\x72\x6f\x73\x73\x2d\x63\x6f\x72\x72\x65\x6c\x61\x74\ +\x69\x6f\x6e\x0a\x6f\x66\x20\x66\x61\x73\x74\x20\x73\x61\x6d\x70\ +\x6c\x65\x64\x20\x64\x61\x74\x61\x20\x66\x72\x6f\x6d\x20\x63\x61\ +\x70\x61\x63\x69\x74\x69\x76\x65\x20\x73\x65\x6e\x73\x6f\x72\x73\ +\x20\x6c\x6f\x63\x61\x74\x65\x64\x20\x61\x74\x20\x74\x68\x65\x20\ +\x65\x6e\x74\x72\x61\x6e\x63\x65\x20\x61\x6e\x64\x20\x65\x78\x69\ +\x74\x0a\x6f\x66\x20\x74\x68\x65\x20\x63\x79\x63\x6f\x6c\x6f\x74\ +\x72\x6f\x6e\x2e\x20\x54\x68\x69\x73\x20\x69\x73\x20\x62\x61\x73\ +\x65\x64\x20\x6f\x6e\x20\x61\x20\x70\x79\x74\x68\x6f\x6e\x20\x69\ +\x6d\x70\x6c\x65\x6d\x65\x6e\x74\x61\x74\x69\x6f\x6e\x20\x6f\x66\ +\x20\x61\x20\x4c\x61\x62\x56\x49\x45\x57\x20\x61\x70\x70\x6c\x69\ +\x63\x61\x74\x69\x6f\x6e\x20\x64\x65\x76\x65\x6c\x6f\x70\x65\x64\ +\x20\x62\x79\x0a\x50\x69\x65\x72\x72\x65\x2d\x41\x6e\x64\x72\x26\ +\x65\x61\x63\x75\x74\x65\x3b\x20\x44\x75\x70\x65\x72\x72\x65\x78\ +\x3a\x20\x20\x3c\x62\x72\x3e\x0a\x50\x2e\x2d\x41\x2e\x20\x44\x75\ +\x70\x65\x72\x72\x65\x78\x20\x61\x6e\x64\x20\x41\x2e\x20\x46\x61\ +\x63\x63\x68\x65\x74\x74\x69\x2c\x20\x0a\x4e\x75\x6d\x62\x65\x72\ +\x20\x6f\x66\x20\x54\x75\x72\x6e\x20\x4d\x65\x61\x73\x75\x72\x65\ +\x6d\x65\x6e\x74\x73\x20\x6f\x6e\x20\x74\x68\x65\x20\x48\x49\x50\ +\x41\x20\x43\x79\x63\x6c\x6f\x74\x72\x6f\x6e\x73\x20\x61\x74\x20\ +\x50\x53\x49\x2e\x3c\x62\x72\x3e\x0a\x64\x6f\x69\x3a\x31\x30\x2e\ +\x31\x38\x34\x32\x39\x2f\x4a\x41\x43\x6f\x57\x2d\x49\x50\x41\x43\ +\x32\x30\x31\x38\x2d\x57\x45\x50\x41\x4c\x30\x36\x37\x20\x0a\x0a\ +\x20\x20\x0a\x20\x20\x3c\x2f\x70\x3e\x0a\x3c\x21\x2d\x2d\x61\x20\ +\x68\x72\x65\x66\x3d\x22\x70\x61\x67\x65\x31\x2e\x68\x74\x6d\x6c\ +\x22\x3e\x68\x65\x72\x65\x3c\x2f\x61\x3e\x3c\x2f\x70\x2d\x2d\x3e\ +\x0a\x0a\x3c\x68\x32\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ +\x6f\x72\x3a\x62\x6c\x75\x65\x3b\x22\x3e\x54\x68\x65\x20\x52\x65\ +\x70\x6f\x73\x69\x74\x6f\x72\x79\x3c\x2f\x68\x32\x3e\x0a\x0a\x3c\ +\x70\x3e\x54\x68\x65\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\ +\x6e\x20\x63\x6f\x6d\x70\x72\x69\x73\x65\x73\x20\x74\x77\x6f\x20\ +\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x3a\x0a\x20\x20\x3c\x75\ +\x6c\x3e\x0a\x3c\x6c\x69\x3e\x0a\x20\x20\x54\x68\x65\x20\x6c\x6f\ +\x77\x2d\x6c\x65\x76\x65\x6c\x20\x41\x44\x43\x20\x64\x61\x74\x61\ +\x20\x61\x63\x71\x75\x69\x73\x69\x74\x69\x6f\x6e\x20\x73\x79\x73\ +\x74\x65\x6d\x2e\x3c\x62\x72\x3e\x0a\x20\x20\x3c\x73\x70\x61\x6e\ +\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x67\ +\x72\x65\x65\x6e\x3b\x22\x3e\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\ +\x69\x74\x2e\x70\x73\x69\x2e\x63\x68\x2f\x65\x70\x69\x63\x73\x5f\ +\x69\x6f\x63\x62\x6f\x6f\x74\x5f\x68\x69\x70\x61\x2f\x2e\x2e\x20\ +\x74\x6f\x20\x62\x65\x20\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64\x3c\ +\x2f\x73\x70\x61\x6e\x3e\x3c\x62\x72\x3e\x0a\x20\x0a\x20\x3c\x2f\ +\x6c\x69\x3e\x0a\x20\x20\x3c\x6c\x69\x3e\x0a\x20\x20\x20\x20\x41\ +\x20\x48\x69\x67\x68\x20\x4c\x65\x76\x65\x6c\x20\x41\x70\x70\x6c\ +\x69\x63\x61\x74\x69\x6f\x6e\x20\x28\x48\x4c\x41\x29\x20\x74\x68\ +\x61\x74\x20\x69\x73\x20\x61\x62\x6c\x65\x20\x74\x6f\x20\x69\x6e\ +\x74\x65\x72\x61\x63\x74\x20\x77\x69\x74\x68\x20\x74\x68\x65\x20\ +\x49\x4f\x43\x2c\x20\x73\x74\x61\x72\x74\x20\x61\x20\x6c\x6f\x77\ +\x2d\x6c\x65\x76\x65\x6c\x20\x64\x61\x74\x61\x20\x61\x63\x71\x75\ +\x69\x73\x74\x69\x6f\x6e\x20\x72\x75\x6e\x2c\x0a\x20\x20\x20\x20\ +\x61\x63\x71\x75\x69\x72\x65\x20\x74\x68\x65\x20\x72\x61\x77\x20\ +\x64\x61\x74\x61\x2c\x20\x61\x6e\x64\x20\x70\x65\x72\x66\x6f\x72\ +\x6d\x20\x74\x68\x65\x20\x6e\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\ +\x74\x65\x72\x6d\x73\x20\x61\x6e\x61\x6c\x79\x73\x69\x73\x2e\x3c\ +\x62\x72\x3e\x0a\x20\x20\x20\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\ +\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x67\x72\x65\x65\ +\x6e\x3b\x22\x3e\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\ +\x6c\x61\x62\x2e\x70\x73\x69\x2e\x63\x68\x2f\x68\x69\x70\x61\x5f\ +\x61\x70\x70\x73\x34\x6f\x70\x73\x2f\x74\x69\x6e\x61\x3c\x2f\x73\ +\x70\x61\x6e\x3e\x3c\x62\x72\x3e\x0a\x20\x20\x20\x20\x3c\x73\x70\ +\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ +\x20\x67\x72\x61\x79\x3b\x22\x3e\x20\x2f\x68\x69\x70\x61\x2f\x62\ +\x64\x2f\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x73\x2f\x74\ +\x69\x6e\x61\x2f\x6c\x61\x74\x65\x73\x74\x2f\x74\x69\x6e\x61\x2e\ +\x73\x68\x3c\x2f\x73\x70\x61\x6e\x3e\x0a\x20\x20\x20\x20\x3c\x2f\ +\x6c\x69\x3e\x0a\x3c\x2f\x75\x6c\x3e\x0a\x20\x20\x3c\x68\x32\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\ +\x65\x3b\x22\x3e\x47\x55\x49\x2c\x20\x43\x6f\x6e\x74\x72\x6f\x6c\ +\x20\x54\x61\x62\x3c\x2f\x68\x32\x3e\x0a\x20\x20\x4d\x61\x69\x6e\ +\x20\x70\x61\x6e\x65\x6c\x20\x66\x6f\x72\x20\x75\x73\x65\x20\x62\ +\x79\x20\x6f\x70\x65\x72\x61\x74\x6f\x72\x73\x2e\x20\x0a\x20\x20\ +\x3c\x68\x33\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\ +\x3a\x23\x37\x62\x36\x38\x65\x65\x3b\x22\x3e\x4f\x70\x65\x72\x61\ +\x74\x6f\x72\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x33\x3e\x0a\x20\ +\x0a\x20\x20\x3c\x68\x33\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\ +\x6c\x6f\x72\x3a\x23\x37\x62\x36\x38\x65\x65\x3b\x22\x3e\x45\x78\ +\x70\x65\x72\x74\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x33\x3e\x0a\ +\x20\x20\x53\x65\x6c\x65\x63\x74\x69\x6e\x67\x20\x74\x68\x65\x20\ +\x44\x72\x79\x20\x52\x75\x6e\x20\x6f\x70\x74\x69\x6f\x6e\x20\x64\ +\x69\x73\x61\x62\x6c\x65\x73\x20\x73\x65\x74\x74\x69\x6e\x67\x20\ +\x76\x61\x6c\x75\x65\x73\x20\x74\x6f\x20\x65\x70\x69\x63\x73\x20\ +\x70\x72\x6f\x63\x65\x73\x73\x20\x76\x61\x72\x69\x61\x62\x6c\x65\ +\x73\x2e\x0a\x20\x20\x0a\x20\x20\x20\x3c\x68\x33\x20\x73\x74\x79\ +\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x23\x37\x62\x36\x38\x65\ +\x65\x3b\x22\x3e\x54\x49\x4e\x41\x20\x49\x6d\x61\x67\x65\x3c\x2f\ +\x68\x33\x3e\x0a\x20\x20\x20\x3c\x74\x61\x62\x6c\x65\x3e\x0a\x20\ +\x20\x20\x20\x20\x3c\x74\x72\x3e\x3c\x74\x64\x3e\x0a\x20\x20\x20\ +\x3c\x69\x6d\x67\x20\x73\x72\x63\x3d\x22\x3a\x54\x69\x6e\x61\x2e\ +\x6a\x70\x67\x22\x20\x77\x69\x64\x74\x68\x3d\x39\x30\x20\x68\x65\ +\x69\x67\x68\x74\x3d\x39\x30\x2f\x3e\x20\x26\x6e\x62\x73\x70\x3b\ +\x20\x3c\x2f\x74\x64\x3e\x3c\x74\x64\x3e\x0a\x20\x20\x20\x54\x69\ +\x6e\x61\x20\x54\x75\x72\x6e\x65\x72\x3c\x2f\x74\x64\x3e\x0a\x20\ +\x20\x20\x3c\x2f\x74\x61\x62\x6c\x65\x3e\x0a\x3c\x70\x3e\x0a\x3c\ +\x2f\x70\x3e\x0a\x20\x20\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x34\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x35\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x32\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x33\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\x80\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x35\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x65\x74\x63\x2e\x2e\x2e\ +\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x70\x3e\x0a\ +\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ +" + +qt_resource_name = b"\ +\x00\x0a\ +\x08\x6a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x33\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x4a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x31\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x0c\xba\xf2\x7c\ +\x00\x69\ +\x00\x6e\x00\x64\x00\x65\x00\x78\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x7a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x34\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x5a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x32\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x8a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x35\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +" + +qt_resource_struct_v1 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x0a\x7c\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x09\xd1\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x0b\x27\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x56\ +" + +qt_resource_struct_v2 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ +\x00\x00\x01\x90\x02\x81\x83\xdc\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x0a\x7c\ +\x00\x00\x01\x90\x02\x81\x83\xe0\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x01\x90\x02\x81\x83\xed\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x09\xd1\ +\x00\x00\x01\x90\x02\x81\x83\xff\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x0b\x27\ +\x00\x00\x01\x90\x02\x81\x84\x13\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x56\ +\x00\x00\x01\x90\x07\x0e\x46\x39\ +" + +qt_version = [int(v) for v in QtCore.qVersion().split('.')] +if qt_version < [5, 8, 0]: + rcc_version = 1 + qt_resource_struct = qt_resource_struct_v1 +else: + rcc_version = 2 + qt_resource_struct = qt_resource_struct_v2 + +def qInitResources(): + QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources() diff --git a/pyrcc5/.gitignore b/pyrcc5/.gitignore new file mode 100644 index 0000000..9d85f00 --- /dev/null +++ b/pyrcc5/.gitignore @@ -0,0 +1,5 @@ +*.*~ +*.*-* +*.*+* +__pycache__ +__pycache__/*.* \ No newline at end of file diff --git a/pyrcc5/tina_resources.py b/pyrcc5/tina_resources.py new file mode 100644 index 0000000..f3345aa --- /dev/null +++ b/pyrcc5/tina_resources.py @@ -0,0 +1,282 @@ +# -*- coding: utf-8 -*- + +# Resource object code +# +# Created by: The Resource Compiler for PyQt5 (Qt v5.15.3) +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore + +qt_resource_data = b"\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x33\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x34\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x31\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x32\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x08\x77\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x54\x69\x6d\x65\x20\x6f\x66\x20\x46\x6c\x69\x67\x68\x74\ +\x20\x4d\x65\x61\x73\x75\x65\x6d\x65\x6e\x74\x20\x66\x6f\x72\x20\ +\x49\x6e\x6a\x65\x63\x74\x6f\x72\x20\x61\x6e\x64\x20\x52\x69\x6e\ +\x67\x20\x43\x79\x63\x6c\x6f\x74\x72\x6f\x6e\x20\x54\x75\x72\x6e\ +\x20\x4e\x75\x6d\x62\x65\x72\x20\x41\x73\x63\x65\x72\x74\x61\x69\ +\x6e\x6d\x65\x6e\x74\x2c\x20\x54\x49\x4e\x41\x3c\x2f\x74\x69\x74\ +\x6c\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\ +\x3e\x0a\x0a\x3c\x68\x35\x20\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\ +\x6f\x6c\x6f\x72\x3a\x67\x72\x61\x79\x3b\x22\x3e\x4a\x75\x6e\x65\ +\x20\x32\x30\x32\x34\x2c\x20\x4a\x61\x6e\x20\x43\x68\x72\x69\x6e\ +\x2c\x20\x50\x69\x65\x72\x72\x65\x2d\x41\x6e\x64\x72\x26\x65\x61\ +\x63\x75\x74\x65\x3b\x20\x44\x75\x70\x65\x72\x72\x65\x78\x2c\x20\ +\x57\x61\x6c\x64\x61\x6d\x61\x72\x20\x4b\x6f\x70\x72\x65\x6b\x3c\ +\x2f\x68\x35\x3e\x0a\x3c\x68\x34\x3e\x20\x3c\x73\x70\x61\x6e\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\ +\x64\x3b\x22\x3e\x54\x3c\x2f\x73\x70\x61\x6e\x3e\x69\x6d\x65\x20\ +\x6f\x66\x20\x46\x6c\x69\x67\x68\x74\x20\x4d\x65\x61\x73\x75\x72\ +\x65\x6d\x65\x6e\x74\x20\x66\x6f\x72\x20\x3c\x73\x70\x61\x6e\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\ +\x64\x3b\x22\x3e\x49\x3c\x2f\x73\x70\x61\x6e\x3e\x6e\x6a\x65\x63\ +\x74\x6f\x72\x20\x61\x6e\x64\x20\x52\x69\x6e\x67\x20\x43\x79\x63\ +\x6c\x6f\x74\x72\x6f\x6e\x20\x54\x75\x72\x6e\x20\x3c\x73\x70\x61\ +\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\ +\x72\x65\x64\x3b\x22\x3e\x4e\x3c\x2f\x73\x70\x61\x6e\x3e\x75\x6d\ +\x62\x65\x72\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\ +\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x41\x3c\ +\x2f\x73\x70\x61\x6e\x3e\x73\x63\x65\x72\x74\x61\x69\x6e\x6d\x65\ +\x6e\x74\x2c\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\ +\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x54\x49\ +\x4e\x41\x3c\x2f\x73\x70\x61\x6e\x3e\x3c\x2f\x68\x34\x3e\x0a\x3c\ +\x68\x32\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ +\x62\x6c\x75\x65\x3b\x22\x3e\x41\x62\x6f\x75\x74\x3c\x2f\x68\x32\ +\x3e\x0a\x0a\x0a\x3c\x70\x3e\x54\x68\x65\x20\x54\x49\x4e\x41\x20\ +\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x64\x65\x74\x65\ +\x72\x6d\x69\x6e\x65\x73\x20\x74\x68\x65\x20\x6e\x75\x6d\x62\x65\ +\x72\x20\x6f\x66\x20\x74\x75\x72\x6e\x73\x20\x69\x6e\x20\x61\x20\ +\x63\x79\x63\x6c\x6f\x74\x72\x6f\x6e\x0a\x66\x72\x6f\x6d\x20\x61\ +\x20\x54\x69\x6d\x65\x20\x6f\x66\x20\x46\x6c\x69\x67\x68\x74\x20\ +\x28\x54\x4f\x46\x29\x20\x6d\x65\x61\x73\x75\x72\x65\x6d\x65\x6e\ +\x74\x20\x74\x65\x63\x68\x6e\x69\x71\x75\x65\x20\x61\x6e\x64\x20\ +\x61\x20\x63\x72\x6f\x73\x73\x2d\x63\x6f\x72\x72\x65\x6c\x61\x74\ +\x69\x6f\x6e\x0a\x6f\x66\x20\x66\x61\x73\x74\x20\x73\x61\x6d\x70\ +\x6c\x65\x64\x20\x64\x61\x74\x61\x20\x66\x72\x6f\x6d\x20\x63\x61\ +\x70\x61\x63\x69\x74\x69\x76\x65\x20\x73\x65\x6e\x73\x6f\x72\x73\ +\x20\x6c\x6f\x63\x61\x74\x65\x64\x20\x61\x74\x20\x74\x68\x65\x20\ +\x65\x6e\x74\x72\x61\x6e\x63\x65\x20\x61\x6e\x64\x20\x65\x78\x69\ +\x74\x0a\x6f\x66\x20\x74\x68\x65\x20\x63\x79\x63\x6f\x6c\x6f\x74\ +\x72\x6f\x6e\x2e\x20\x54\x68\x69\x73\x20\x69\x73\x20\x62\x61\x73\ +\x65\x64\x20\x6f\x6e\x20\x61\x20\x70\x79\x74\x68\x6f\x6e\x20\x69\ +\x6d\x70\x6c\x65\x6d\x65\x6e\x74\x61\x74\x69\x6f\x6e\x20\x6f\x66\ +\x20\x61\x20\x4c\x61\x62\x56\x49\x45\x57\x20\x61\x70\x70\x6c\x69\ +\x63\x61\x74\x69\x6f\x6e\x20\x64\x65\x76\x65\x6c\x6f\x70\x65\x64\ +\x20\x62\x79\x0a\x50\x69\x65\x72\x72\x65\x2d\x41\x6e\x64\x72\x26\ +\x65\x61\x63\x75\x74\x65\x3b\x20\x44\x75\x70\x65\x72\x72\x65\x78\ +\x3a\x20\x20\x3c\x62\x72\x3e\x0a\x50\x2e\x2d\x41\x2e\x20\x44\x75\ +\x70\x65\x72\x72\x65\x78\x20\x61\x6e\x64\x20\x41\x2e\x20\x46\x61\ +\x63\x63\x68\x65\x74\x74\x69\x2c\x20\x0a\x4e\x75\x6d\x62\x65\x72\ +\x20\x6f\x66\x20\x54\x75\x72\x6e\x20\x4d\x65\x61\x73\x75\x72\x65\ +\x6d\x65\x6e\x74\x73\x20\x6f\x6e\x20\x74\x68\x65\x20\x48\x49\x50\ +\x41\x20\x43\x79\x63\x6c\x6f\x74\x72\x6f\x6e\x73\x20\x61\x74\x20\ +\x50\x53\x49\x2e\x3c\x62\x72\x3e\x0a\x64\x6f\x69\x3a\x31\x30\x2e\ +\x31\x38\x34\x32\x39\x2f\x4a\x41\x43\x6f\x57\x2d\x49\x50\x41\x43\ +\x32\x30\x31\x38\x2d\x57\x45\x50\x41\x4c\x30\x36\x37\x20\x0a\x0a\ +\x20\x20\x0a\x20\x20\x3c\x2f\x70\x3e\x0a\x3c\x21\x2d\x2d\x61\x20\ +\x68\x72\x65\x66\x3d\x22\x70\x61\x67\x65\x31\x2e\x68\x74\x6d\x6c\ +\x22\x3e\x68\x65\x72\x65\x3c\x2f\x61\x3e\x3c\x2f\x70\x2d\x2d\x3e\ +\x0a\x0a\x3c\x68\x32\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ +\x6f\x72\x3a\x62\x6c\x75\x65\x3b\x22\x3e\x54\x68\x65\x20\x52\x65\ +\x70\x6f\x73\x69\x74\x6f\x72\x79\x3c\x2f\x68\x32\x3e\x0a\x0a\x3c\ +\x70\x3e\x54\x68\x65\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\ +\x6e\x20\x63\x6f\x6d\x70\x72\x69\x73\x65\x73\x20\x74\x77\x6f\x20\ +\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x3a\x0a\x20\x20\x3c\x75\ +\x6c\x3e\x0a\x3c\x6c\x69\x3e\x0a\x20\x20\x54\x68\x65\x20\x6c\x6f\ +\x77\x2d\x6c\x65\x76\x65\x6c\x20\x41\x44\x43\x20\x64\x61\x74\x61\ +\x20\x61\x63\x71\x75\x69\x73\x69\x74\x69\x6f\x6e\x20\x73\x79\x73\ +\x74\x65\x6d\x2e\x3c\x62\x72\x3e\x0a\x20\x20\x3c\x73\x70\x61\x6e\ +\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x67\ +\x72\x65\x65\x6e\x3b\x22\x3e\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\ +\x69\x74\x2e\x70\x73\x69\x2e\x63\x68\x2f\x65\x70\x69\x63\x73\x5f\ +\x69\x6f\x63\x62\x6f\x6f\x74\x5f\x68\x69\x70\x61\x2f\x2e\x2e\x20\ +\x74\x6f\x20\x62\x65\x20\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64\x3c\ +\x2f\x73\x70\x61\x6e\x3e\x3c\x62\x72\x3e\x0a\x20\x0a\x20\x3c\x2f\ +\x6c\x69\x3e\x0a\x20\x20\x3c\x6c\x69\x3e\x0a\x20\x20\x20\x20\x41\ +\x20\x48\x69\x67\x68\x20\x4c\x65\x76\x65\x6c\x20\x41\x70\x70\x6c\ +\x69\x63\x61\x74\x69\x6f\x6e\x20\x28\x48\x4c\x41\x29\x20\x74\x68\ +\x61\x74\x20\x69\x73\x20\x61\x62\x6c\x65\x20\x74\x6f\x20\x69\x6e\ +\x74\x65\x72\x61\x63\x74\x20\x77\x69\x74\x68\x20\x74\x68\x65\x20\ +\x49\x4f\x43\x2c\x20\x73\x74\x61\x72\x74\x20\x61\x20\x6c\x6f\x77\ +\x2d\x6c\x65\x76\x65\x6c\x20\x64\x61\x74\x61\x20\x61\x63\x71\x75\ +\x69\x73\x74\x69\x6f\x6e\x20\x72\x75\x6e\x2c\x0a\x20\x20\x20\x20\ +\x61\x63\x71\x75\x69\x72\x65\x20\x74\x68\x65\x20\x72\x61\x77\x20\ +\x64\x61\x74\x61\x2c\x20\x61\x6e\x64\x20\x70\x65\x72\x66\x6f\x72\ +\x6d\x20\x74\x68\x65\x20\x6e\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\ +\x74\x65\x72\x6d\x73\x20\x61\x6e\x61\x6c\x79\x73\x69\x73\x2e\x3c\ +\x62\x72\x3e\x0a\x20\x20\x20\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\ +\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x67\x72\x65\x65\ +\x6e\x3b\x22\x3e\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\ +\x6c\x61\x62\x2e\x70\x73\x69\x2e\x63\x68\x2f\x68\x69\x70\x61\x5f\ +\x61\x70\x70\x73\x34\x6f\x70\x73\x2f\x74\x69\x6e\x61\x3c\x2f\x73\ +\x70\x61\x6e\x3e\x3c\x62\x72\x3e\x0a\x20\x20\x20\x20\x3c\x73\x70\ +\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ +\x20\x67\x72\x61\x79\x3b\x22\x3e\x20\x2f\x68\x69\x70\x61\x2f\x62\ +\x64\x2f\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x73\x2f\x74\ +\x69\x6e\x61\x2f\x6c\x61\x74\x65\x73\x74\x2f\x74\x69\x6e\x61\x2e\ +\x73\x68\x3c\x2f\x73\x70\x61\x6e\x3e\x0a\x20\x20\x20\x20\x3c\x2f\ +\x6c\x69\x3e\x0a\x3c\x2f\x75\x6c\x3e\x0a\x20\x20\x3c\x68\x32\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\ +\x65\x3b\x22\x3e\x47\x55\x49\x2c\x20\x43\x6f\x6e\x74\x72\x6f\x6c\ +\x20\x54\x61\x62\x3c\x2f\x68\x32\x3e\x0a\x20\x20\x4d\x61\x69\x6e\ +\x20\x70\x61\x6e\x65\x6c\x20\x66\x6f\x72\x20\x75\x73\x65\x20\x62\ +\x79\x20\x6f\x70\x65\x72\x61\x74\x6f\x72\x73\x2e\x20\x0a\x20\x20\ +\x3c\x68\x33\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\ +\x3a\x23\x37\x62\x36\x38\x65\x65\x3b\x22\x3e\x4f\x70\x65\x72\x61\ +\x74\x6f\x72\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x33\x3e\x0a\x20\ +\x0a\x20\x20\x3c\x68\x33\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\ +\x6c\x6f\x72\x3a\x23\x37\x62\x36\x38\x65\x65\x3b\x22\x3e\x45\x78\ +\x70\x65\x72\x74\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x33\x3e\x0a\ +\x20\x20\x53\x65\x6c\x65\x63\x74\x69\x6e\x67\x20\x74\x68\x65\x20\ +\x44\x72\x79\x20\x52\x75\x6e\x20\x6f\x70\x74\x69\x6f\x6e\x20\x64\ +\x69\x73\x61\x62\x6c\x65\x73\x20\x73\x65\x74\x74\x69\x6e\x67\x20\ +\x76\x61\x6c\x75\x65\x73\x20\x74\x6f\x20\x65\x70\x69\x63\x73\x20\ +\x70\x72\x6f\x63\x65\x73\x73\x20\x76\x61\x72\x69\x61\x62\x6c\x65\ +\x73\x2e\x0a\x20\x20\x0a\x20\x20\x20\x3c\x68\x33\x20\x73\x74\x79\ +\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x23\x37\x62\x36\x38\x65\ +\x65\x3b\x22\x3e\x54\x49\x4e\x41\x20\x49\x6d\x61\x67\x65\x3c\x2f\ +\x68\x33\x3e\x0a\x20\x20\x20\x3c\x74\x61\x62\x6c\x65\x3e\x0a\x20\ +\x20\x20\x20\x20\x3c\x74\x72\x3e\x3c\x74\x64\x3e\x0a\x20\x20\x20\ +\x3c\x69\x6d\x67\x20\x73\x72\x63\x3d\x22\x3a\x54\x69\x6e\x61\x2e\ +\x6a\x70\x67\x22\x20\x77\x69\x64\x74\x68\x3d\x39\x30\x20\x68\x65\ +\x69\x67\x68\x74\x3d\x39\x30\x2f\x3e\x20\x26\x6e\x62\x73\x70\x3b\ +\x20\x3c\x2f\x74\x64\x3e\x3c\x74\x64\x3e\x0a\x20\x20\x20\x54\x69\ +\x6e\x61\x20\x54\x75\x72\x6e\x65\x72\x3c\x2f\x74\x64\x3e\x0a\x20\ +\x20\x20\x3c\x2f\x74\x61\x62\x6c\x65\x3e\x0a\x3c\x70\x3e\x0a\x3c\ +\x2f\x70\x3e\x0a\x20\x20\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x34\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x35\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\xa7\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x32\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x33\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x00\x80\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ +\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x35\x20\x6f\ +\x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ +\x70\x3e\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x65\x74\x63\x2e\x2e\x2e\ +\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x70\x3e\x0a\ +\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ +" + +qt_resource_name = b"\ +\x00\x0a\ +\x08\x6a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x33\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x4a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x31\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x0c\xba\xf2\x7c\ +\x00\x69\ +\x00\x6e\x00\x64\x00\x65\x00\x78\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x7a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x34\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x5a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x32\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x8a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x35\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +" + +qt_resource_struct_v1 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x0a\x7c\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x09\xd1\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x0b\x27\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x56\ +" + +qt_resource_struct_v2 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ +\x00\x00\x01\x90\x02\x81\x83\xdc\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x0a\x7c\ +\x00\x00\x01\x90\x02\x81\x83\xe0\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x01\x90\x02\x81\x83\xed\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x09\xd1\ +\x00\x00\x01\x90\x02\x81\x83\xff\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x0b\x27\ +\x00\x00\x01\x90\x02\x81\x84\x13\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x56\ +\x00\x00\x01\x90\x07\x0e\x46\x39\ +" + +qt_version = [int(v) for v in QtCore.qVersion().split('.')] +if qt_version < [5, 8, 0]: + rcc_version = 1 + qt_resource_struct = qt_resource_struct_v1 +else: + rcc_version = 2 + qt_resource_struct = qt_resource_struct_v2 + +def qInitResources(): + QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources() diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..9d85f00 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,5 @@ +*.*~ +*.*-* +*.*+* +__pycache__ +__pycache__/*.* \ No newline at end of file diff --git a/src/analysis.py b/src/analysis.py new file mode 100644 index 0000000..b09d28f --- /dev/null +++ b/src/analysis.py @@ -0,0 +1,297 @@ +""" +Analysis class +""" +from datetime import datetime +import inspect +import os +from statistics import mean +import time + +import matplotlib + +import matplotlib.pyplot as plt +import numpy as np + +from qtpy.QtCore import QObject, Signal, Slot + +from pyqtacc.bdbase.enumkind import MsgSeverity + +matplotlib.use('Agg') + +_pymodule = os.path.basename(__file__) + +PROGRESS_BAR_THREAD_INIT = 0 +PROGRESS_BAR_THREAD_START = 1 +PROGRESS_BAR_THREAD_ABORTING = 2 +PROGRESS_BAR_THREAD_ABORTED = 3 +PROGRESS_BAR_THREAD_ERROR = 4 +PROGRESS_BAR_THREAD_END = 100 + +def _line(): + """Macro to return the current line number. + + The current line number within the file is used when + reporting messages to the message logging window. + + Returns: + int: Current line number. + """ + return inspect.currentframe().f_back.f_lineno + + + +class AnalysisProcedure(QObject): + """ + Analysis procedure + """ + trigger_abort = Signal() + def __init__(self, parent=None): + super(AnalysisProcedure, self).__init__(parent) + self.parent = parent + self.settings = self.parent.settings + self.cafe = self.parent.cafe + self.cyca = self.parent.cyca + + self.logging = self.parent.logging + self.logger = self.logging.getLogger(__name__) + self.logger.debug("Logging activated in analysis procedure") + + self.abort = False + self.raw_data = {} + self.trigger_abort.connect(self.receive_abort) + #Declare input parameters + + self.input_data = None + self.debug = False + self.simulation = True + self.facility = None + self.maxmin = None + self.maximize = None + self.N_events = None + self.N_points = None + + self.checkbox = None + + @Slot() + def receive_abort(self): + """ + Set abort variable to interrupt measurement + """ + + self.abort = True + self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_ABORTING) + + def aborting(self, line_no): + self.abort = False + mess = "Measurement aborted" + self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_ABORTED) + + + #########INITIALIZE THE INPUTS FOM THE GUI####################### + + def initialize_input_parameters(self, input_data: dict): + + self.input_data = input_data + + if 'debug' in self.input_data.keys(): + self.debug = self.input_data['debug'] + + if self.debug: + self.logger.debug("INPUT DATA to LOG:{0}".format(self.input_data)) + + self.simulation = bool(self.input_data['simulation']) + + print(self.input_data) + + #self.facility = self.input_data['facility'] + try: + self.maxmin = self.input_data['maxmin'] + self.N_events = int(self.input_data['N_events']) + self.N_points = int(self.input_data['N_points']) + self.checkbox = bool(self.input_data['checkbox']) + + self.tab_selected = self.input_data['qtabdata'] + self.npts = int(self.input_data['Vikings']['npts']) + self.nspins = int(self.input_data['Vikings']['nspins']) + self.nevents = int(self.input_data['Saxons']['nevents']) + self.niter = int(self.input_data['Saxons']['niter']) + + print("logging info level==>", self.logger.getEffectiveLevel(), flush=True) + self.loglevel = self.input_data['loggingLevel'] + self.logger.setLevel(self.logging.getLevelName(self.loglevel)) + print("logging info level==>", self.logger.getEffectiveLevel(), flush=True) + #self.logger.setLevel(self.logging.WARNING) + #print("logging info level==>", self.logger.getEffectiveLevel(), flush=True) + self.logger.debug("INPUT PARAMETERS") + + self.logger.debug("Measurement: {0}".format(self.tab_selected)) + + + self.logger.debug("Simulation {0}".format(self.simulation)) + #self.logger.debug("Facility {0}".format(self.facility)) + self.logger.debug("No. Events {0}".format(self.N_events)) + self.logger.debug("No. Points {0}".format(self.N_points)) + self.logger.debug("Checkbox? {0}".format(self.checkbox)) + + self.logger.debug("No. Viking Pts {0}".format(self.npts)) + self.logger.debug("No. Viking Spins {0}".format(self.nspins)) + self.logger.warning("No. Saxon Evnts {0}".format(self.nevents)) + self.logger.critical("No. Saxon Iter {0}".format(self.niter)) + + + except KeyError as ex: + self.logger.debug("KeyError {0}".format(ex)) + except ValueError as ex: + self.logger.debug("ValueError {0}".format(ex)) + except Exception as ex: + self.logger.debug("Exception {0}".format(ex)) + + + def measure_and_analyze(self, input_data=None): + ''' + This method is initiated by the START button in Procedure panel + ''' + if input_data is None: + mess = "No input parameters given; no measurement performed" + self.parent.trigger_log_message.emit( + MsgSeverity.INFO.name, _pymodule, _line(), mess, {}) + return None + + + #Read the input parameters from the GUI + self.initialize_input_parameters(input_data) + + + #Step 1 - Collect ambient data relate to the machine + ambient_data = self.collect_ambient_data() + self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_START) + + #Step 2 - Perform measurement and return data for processing + self.raw_data = self.measure() + + if self.raw_data is None: + self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_ERROR) + return None + + #Step 3 - Process the raw data + proc_data = self.process(ambient_data) + + #Step 4 - Provide plots + fig_data = self.make_figs(ambient_data, proc_data) + + #Step 5 - Package to all_data dictionary + all_data = self.combine_data(ambient_data, proc_data, fig_data) + + self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_END) + return all_data + + + def reanalyze(self, all_data): + + input_data = all_data['Input data'] + ambient_data = all_data['Ambient data'] + self.raw_data = all_data['Raw data'] + + proc_data = self.process(ambient_data, from_hdf5=True) + fig_data = self.make_figs(ambient_data, proc_data) + all_data_new = self.combine_data(ambient_data, proc_data, + fig_data) + return(all_data_new) + + + def collect_ambient_data(self): + """Collect ambient data and return it as a dictionary + """ + # Time in seconds in an integer and can be stored in hdf5 + time_in_seconds = time.time() + time_stamp = datetime.fromtimestamp( + time_in_seconds).strftime('%a %d-%m-%Y %H:%M:%S') + + #EPICS... + handles = self.cafe.getHandles()[0] + status = self.cafe.attachContext(handles[0]) + + if status == self.cyca.ECAFE_NULLCONTEXT: + options = {} + options['statusCode'] = (str(status) + " " + + self.cafe.getStatusCodeAsString(status)) + options['statusInfo'] = self.cafe.getStatusInfo(status) + self.parent.trigger_log_message.emit( + MsgSeverity.ERROR.name, _pymodule, _line(), + ("Cannot attach CA context in thread " + + "Scan will not be initiated!"), _options) + + if self.abort: + self.aborting(_line()) + return {} + + self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_ERROR) + return {} + + ambient_data = { + 'Time in seconds': time_in_seconds, + 'Time stamp': time_stamp, + } + + + self.logger.debug("{0}".format(ambient_data)) + + return ambient_data + + def measure(self): + + self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_START) + for i in range (1, 100): + if i%10 == 0: + self.parent.trigger_progressbar.emit(i) + time.sleep(0.2) + if self.abort: + self.aborting(_line()) + return None + + #Fill Raw data here + raw_data = {} + raw_data['test']='testing' + return raw_data + + def process(self, ambient_data, from_hdf5=False): + proc_data = {} + return proc_data + + def make_figs(self, ambient_data, proc_data): + + # Data for plotting + t = np.arange(0.0, 2.0, 0.01) + s = 1 + np.sin(2 * np.pi * t) + fig, ax = plt.subplots() #figsize=(0.3, 0.2)) + ax.plot(t, s) + ax.set(xlabel='Time (s)', ylabel='Voltage (mV)', + title='Sinusoidal Wave-1') + ax.grid() + t = np.arange(0.0, 3.0, 0.01) + s = 1 + np.sin(3 * np.pi * t) + + fig2, ax = plt.subplots() + ax.plot(t, s) + ax.set(xlabel='Time (s)', ylabel='Voltage (mV)', + title='Sinusoidal Wave-2') + ax.grid() + fig3, ax = plt.subplots() + ax.plot(t, s) + ax.set(xlabel='Time (s)', ylabel='Voltage (mV)', + title='Sinusoidal Wave-3') + ax.grid() + fig_data = {'Canvas 1': [fig, fig2]} + fig_data['Canvas 2'] = fig3 + + return fig_data + + def combine_data(self, ambient_data, proc_data, fig_data): + + all_data = {'Input data': self.input_data} + all_data['Ambient data'] = ambient_data + all_data['Raw data'] = self.raw_data + all_data['Processed data'] = proc_data + all_data['Figure data'] = fig_data + + return(all_data) diff --git a/src/gui.py b/src/gui.py new file mode 100644 index 0000000..72d9810 --- /dev/null +++ b/src/gui.py @@ -0,0 +1,54 @@ +import os + +#from qtpy import QtCore, QtGui +from qtpy.QtGui import QColor, QPixmap +from qtpy.QtCore import __version__ as QT_VERSION_STR +from qtpy.QtCore import QEventLoop, Qt, QTimer, Slot +from qtpy.QtWidgets import ( + QApplication, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QMessageBox, + QPushButton, QTabBar, QTabWidget, QTableWidgetItem, QTextEdit, QVBoxLayout, + QWidget) + +from common.packages import elog + +from apps4ops.bdbase.utils import _line + +from apps4ops.bdbase.enumkind import MsgSeverity +from caqtwidgets.pvwidgets import ( + CAQLabel, CAQLineEdit, CAQMessageButton, CAQTableWidget, CAQTextEntry, + QHLine) + +_pymodule = os.path.basename(__file__) + + +class AppGui(QWidget): + ''' Main GUI class + ''' + + def __init__(self, parent): + super().__init__() + self.parent = parent + self.cafe = self.parent.cafe + self.cyca = self.parent.cyca + self.check_status = self.parent.check_status + self.check_status_list = self.parent.check_status_list + self.elog_enum = self.parent.elog_enum + + self.send_to_log_window = self.parent.send_to_log_window + self.show_log_message = self.parent.show_log_message + self.statusbar = self.parent.statusbar + + self.gui_frame = self.parent.gui_frame + self.gui_header = self.parent.gui_header + self.font_gui = self.parent.gui_frame.font_gui + self.input_parameters = self.parent.input_parameters + self.input_labels = self.parent.input_labels + self.expert_parameters = self.parent.expert_parameters + self.gui_frame.expert_parameters_group.setFixedWidth(260) + self.gui_frame.expert_parameters_group.setFixedHeight(130) + self.gui_frame.operator_parameters_group.setFixedWidth(260) + self.gui_frame.operator_parameters_group.setFixedHeight(330) + self.gui_frame.measurement_tab_wgt.setFixedWidth(496) + self.gui_frame.measurement_tab_wgt.setFixedHeight(410) + self.gui_frame.operator_wgt.setFixedHeight(640) + self.gui_frame.expert_wgt.setFixedHeight(240) diff --git a/test.json b/test.json new file mode 100755 index 0000000..afbf82d --- /dev/null +++ b/test.json @@ -0,0 +1,52 @@ +{ + "menuFlags":{ + "hasFile": 0, + "loadInitFile": 0, + "hasDaq": 0, + "hasH5": 1, + "hasEpics": 1 + }, + "hdf": { + "destination" : "./" + }, + "SLS" : ["Injector", "Booster", "Ring"], + "SLS2" : {"test": ["Injector", "Booster", "Ring"]}, + "QTabViking":{ + "Vikings": { + "radiobutton" : {"data":{ "widget": "QRadioButton", "text" : "Radio Gaga", "value": ["This", "That", "The Other"], "startIdx": 1}}, + "readonly" : {"data":{ "widget": "QLineRead", "text" :"ReadOnly:", "value" : "input"}}, + "npts" : {"data":{ "widget": "QLineEdit", "text" :"No Events:", "value" : 22, "min": 0.01, "max": 0.99}}, + "nspins" : {"data":{ "widget": "QSpinBox", "text" : "No. Points:", "min": 1, "max": 10, "step": 1,"value": 1 }}, + "ndspins" : {"data":{ "widget": "QDoubleSpinBox", "text" : "No. Points:", "min": 1, "max": 10.0, "step": 0.1,"value": 1.5 }}, + "facility": {"data" : {"widget": "QComboBox", "text" : "Facility:", "link": ["SLS2", "test"],"layout" : "Horizontal"}}, + "checkbox" : {"data":{ "widget": "QCheckBox", "orientation" : "Qt.LeftToRight", "text" : "Checkbox", "value" : 1}} + }, + "Saxons": { + "nevents" : {"data":{ "widget": "QLineEdit", "text" :"No. Iterations:", "value" : 33}}, + "niter" : {"data":{ "widget": "QSpinBox", "text" : "Step size:", "min": 1, "max": 10, "step": 1,"value": 1 }} + } + }, + + "Parameters":{ + "maxmin" : {"flag" : 1, "data":{ "widget": "QRadioButton", "text" : "", "value": ["Maximize", "Minimize" ]}}, + "facility": {"flag": 0, "data" : {"widget": "QComboBox", "text" : "Facility:", + "link": ["SLS"],"layout" : "Horizontal"}}, + "N_events" : {"flag" : 1, "data":{ "widget": "QLineEdit", "text" : "No. events: ", "value": 2 }}, + "N_points" : {"flag" : 1, "data":{ "widget": "QSpinBox", "text" : "No. points:", "min": 1, "max": 10, "step": 1,"value": 1 }}, + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "checkbox" : {"flag" : 1, "data":{ "widget": "QCheckBox", "orientation" : "Qt.LeftToRight", + "text" : " Checkbox", "value" : 1}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "qtabdata" : {"flag" : 1, "data":{ "widget": "QTabWidget", "text" : "Measurement: ", "value" : 0, "link" : "QTabViking", "color" : ["#0080aa", "#0000ff"]}} + + }, + "Expert":{ + "debug": {"flag" : 1, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Simulation", "value" : 0}} + }, + "GUI": { + "resultsTabTitle" : "Results", + "subResultsTabTitle" : ["Plots", "Plot-2"], + "resultsSeq" : [10, 1] + } +} diff --git a/tina.json b/tina.json new file mode 100755 index 0000000..000afbe --- /dev/null +++ b/tina.json @@ -0,0 +1,45 @@ +{ + "menuFlags":{ + "hasFile": 0, + "loadInitFile": 0, + "hasDaq": 0, + "hasH5": 1, + "hasEpics": 1 + }, + "hdf": { + "destination" : "./" + }, + "header" : ["SHIFT", "INJ2", "IP2", "IW2", "PK1", "PK2", "SINQ", "UCN"], + + "HIPA": ["Injector", "Ring"], + "HIPA2": {"test": ["Injector", "Ring"]}, + "QTabAccelerator":{ + "Injector": { + "harmonic" : {"data":{ "widget": "QLineRead", "text" :"Harmonic No.:", "value": 10}}, + "freqrf" : {"data":{ "widget": "QLineEdit", "text" :"RF Freq. (Ms):", "value" : 50.6328 }}, + "deltaTcable" : {"data":{ "widget": "QLineRead", "text" : "dT Cable (ns):", "value": 6.9 }}, + "deltaNpickup" : {"data":{ "widget": "QLineEdit", "text" : "dN pickup:", "value": 4 }} + }, + "Cyclotron": { + "harmonic" : {"data":{ "widget": "QLineRead", "text" :"Harmonic No.:", "value" : 6}}, + "freqrf" : {"data":{ "widget": "QLineEdit", "text" :"RF Freq. (Ms):", "value" : 50.6328 }}, + "deltaTcable" : {"data":{ "widget": "QLineRead", "text" : "dT Cable (ns)", "value": 44 }}, + "deltaNpickup" : {"data":{ "widget": "QLineEdit", "text" : "dN Pickup:", "value": 1 }} + } + }, + "Parameters":{ + "facility": {"flag": 0, "data" : {"widget": "QComboBox", "text" : "Facility:", + "link": ["HIPA"],"layout" : "Horizontal"}}, + "qtabdata" : {"flag" : 1, "data":{ "widget": "QTabWidget", "text" : "Accelerator: ", "link" : "QTabAccelerator", "value" : 1, "color" : ["#0080aa", "#0000ff"]}} + + }, + "Expert":{ + "debug": {"flag" : 1, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Simulation", "value" : 0}} + }, + "GUI": { + "resultsTabTitle" : "Results", + "subResultsTabTitle" : ["Plots", "Plot-2"], + "resultsSeq" : [10, 1] + } +} diff --git a/tina.py b/tina.py new file mode 100644 index 0000000..c202f6f --- /dev/null +++ b/tina.py @@ -0,0 +1,209 @@ +"""Tina.py module for measuring the number of turns +""" + +import inspect +import os +import platform +import sys +import time + +from qtpy.QtCore import __version__ as QT_VERSION_STR +from qtpy.QtCore import PYQT_VERSION_STR, Signal, Slot +from qtpy.QtWidgets import QApplication, QMessageBox + +from apps4ops.bdbase.base import BaseWindow +from apps4ops.bdbase.utils import _line +from apps4ops.bdbase.enumkind import UserMode, Facility +from apps4ops.bdbase.helpbrowser import HelpBrowser +from apps4ops.hipa.sendeloghipa import QSendToELOG +from apps4ops.hipa.enumkind import ElogHIPA + +from src.gui import AppGui +from pyrcc5 import tina_resources + + +_pymodule = os.path.basename(__file__) +_appname, _appext = _pymodule.split(".") +_appversion = "0.0.0" +_title = "No of Turns Measurement" + +_appname = "Tina" + + + +class StartMain(BaseWindow): + trigger_log_message = Signal(str, str, int, str, dict) + + def __init__(self, parent=None): + super().__init__( + parent=parent, pymodule=_pymodule, appversion=_appversion, + title=_title, user_mode=UserMode.OPERATION, facility=Facility.HIPA, + has_optics=False, has_procedure=True) + + self.appname = _appname + self.elog_enum = ElogHIPA() + self.gui = AppGui(self) + + def prepare_elog_message(self): + """Define elog parameters and define message + """ + + self.projekt_idx = self.elog_enum.projekt.NONE + self.system_idx = self.elog_enum.system.BEAMDYNAMICS + self.eintrag_idx = self.elog_enum.eintrag.INFO + + self.ort_idx = self.elog_enum.ort.RING_CYCLOTRON #else INJECTOR2 + self.status_idx = self.elog_enum.status.NONE + self.effekt_idx = self.elog_enum.effekt.NO + + self.attach_files = [] + + simulation = self.input_parameters["simulation"] + + if self.all_data: + if self.all_data["Input data"] is not None: + try: + simulation = self.all_data["Input data"]["simulation"] + except KeyError: + simulation = self.input_parameters["simulation"] + pass + + self.logbook = "Sandkasten" if simulation else "HIPA" + self.title = _title + + self.no_turns = 180 + self.message = "The number of turns measured in the ring = {0}".format( + self.no_turns) + + @Slot() + def send_to_elog(self): + """Override abstract method + """ + + @Slot() + def save_fig_thread_finished(): + """Can take a few seconds to send to elog, + hence choose do this in a thread. + """ + time.sleep(0.2) + + if self.all_data: + QSendToELOG(self, logbook=self.logbook, + projektIdx=self.projekt_idx, + eintragIdx=self.eintrag_idx, + systemIdx=self.system_idx, + statusIdx=self.status_idx, + ordIdx=self.ort_idx, + effektIdx=self.effekt_idx, + title=self.title, + message=self.message, + attachFile=self.attach_files) + + time.sleep(1.0) + + # if not self.verify_send_to_elog(): + # return + + self.prepare_elog_message() + + print(self.message, flush=True) + + if not self.all_data: + QSendToELOG(self, logbook=self.logbook, + projektIdx=self.projekt_idx, + eintragIdx=self.eintrag_idx, + systemIdx=self.system_idx, + statusIdx=self.status_idx, + ortIdx=self.ort_idx, + effektIdx=self.effekt_idx, + title=self.title, + message=self.message, + attachFile=self.attach_files) + return + + folder_name = self.elog_dest + if not os.path.exists(folder_name): + os.makedirs(folder_name) + + time_in_seconds = self.all_data["Ambient data"]["Time in seconds"] + if self.all_data["Processed data"]["Reanalysis time"]: + reanalysis_time = self.all_data["Processed data"][ + "Reanalysis time in seconds"] + else: + reanalysis_time = None + + self.folder_name = folder_name + + save_fig_thread = self.SaveFigureThread( + self, self.folder_name, time_in_seconds, reanalysis_time) + save_fig_thread.finished.connect(save_fig_thread_finished) + + save_fig_thread.start() + time.sleep(0.05) + + + @Slot() + def closeEvent(self, event): + """ Close application only if conditions allow + """ + if not self.verify_close_event(): + event.ignore() + return + + BaseWindow.closeEvent(self, event) + + @Slot() + def show_about(self): + """ Behind the scences information + """ + QApplication.processEvents() + QMessageBox.about( + self, "About", + """{0} v {1} +

Copyright © Paul Scherrer Institut (PSI). + All rights reserved.

+

Authors: P.-A. Duperrex, W. Koprek, J. Chrin

+

A python implementation of the LabVIEW measurement developed by P.-A. Duperrex
+ Ref: P.-A. Duperrex and A. Facchetti
+ Number of Turn Measurements on the HIPA Cyclotrons at PSI
+ doi:10.18429/JACoW-IPAC2018-WEPAL067

+

Responsible: W. Koprek, WBBA/315, Tel. x3765, + waldemar.koprek@psi.ch

+

A main-window style application for the measurement of + the number of turns in the HIPA cyclotron and injector

+

Python {2} - Qt {3} - PyQt {4}
+ cafe {5} - epics {6} on {7}""".format( + _pymodule, _appversion, platform.python_version(), + QT_VERSION_STR, PYQT_VERSION_STR, + self.cafe.CAFE_version(), self.cafe.EPICS_version(), + platform.system())) + QApplication.processEvents() + + + @Slot() + def show_help(self): + """ Invoke help pages from tina_resources + """ + index_html = "index.html" + help_base = ":" + help_page = HelpBrowser(help_base, index_html, self) + help_page.show() + + + +######################################################################### +if __name__ == "__main__": + + app = QApplication(sys.argv) + splash = BaseWindow.initialize_application( + app, appname=_appname, delay=20, facility=Facility.HIPA) + + myapp = StartMain() + + myapp.show() + + if splash is not None: + splash.finish(myapp) + + app.exec_() + diff --git a/tina.sh b/tina.sh new file mode 100755 index 0000000..4d95728 --- /dev/null +++ b/tina.sh @@ -0,0 +1,107 @@ +#!/bin/bash +cd /hipa/bd/applications/tina/devl + +# For use if script is sourced rather than executed +appNameDefault="tina.sh" + +module unload gcc +module load gcc/7.3.0 + +if [ -z "$PS1" ] # no prompt? +### if [ -v PS1 ] # On Bash 4.2+ ... +then + # non-interactive + echo "Non-interactive script" +else + # interactive + echo "Interactive/sourced script" +fi + +# Select Python Version here. Currently one of 3.5, 3.7, 3.8 and 3.10 +PYTHON_VERSION=3.10 + + +if [ "$1" ]; then + + if [ "$1" == "3.5" -o "$1" == "35" ]; then + echo "Using default version $PYTHON_VERSION" + elif [ "$1" == "3.7" -o "$1" == "37" ]; then + PYTHON_VERSION=3.7 + + elif [ "$1" == "3.8" -o "$1" == "38" ]; then + PYTHON_VERSION=3.8 + + elif [ "$1" == "3.10" -o "$1" == "310" ]; then + PYTHON_VERSION=3.10 + + else + echo "Requested Python version is not supported" + echo "Using default version $PYTHON_VERSION" + fi + +fi + + +echo "PYTHON_VERSION $PYTHON_VERSION" + +_EPICS_HOST_ARCH=${RHREL}-x86_64 + +. /opt/gfa/python $PYTHON_VERSION + +#C_EXT version for Py 3.5, 3.7. 3.8, 3.10: + +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/hipa/bd/applications/deps/apps4ops/v1.10.0 + +echo $PYTHONPATH + +STDOUT_DIR="/tmp" +#Set to 0 if you do not wish std::out to write to logger +STDOUT_FLAG=1 + +if [ "$#" -gt "0" ]; then + appName=$0 + if [ "$appName" == "-bash" ]; then + appName=$appNameDefault + fi +else +appName=$appNameDefault +fi + +#echo "$appName $@ $#" +baseName="${appName##*/}" +name=$(echo "$baseName" | cut -f 1 -d '.') +nameLog=${name}-$USER +echo "Application: $name" +echo "nameLog: $nameLog" + +#Configuration files can be overwritten +#python ${name}.py -s="/sf/bd/deps/pyqtacc/common/config/style.json" -f="/hipa/bd/applications/deps/apps4ops/v1.10.0/apps4ops/qrc_resources/facility/hipa/config/base.json" -q="/sf/bd/deps/pyqtacc/common/config/acc.qss" & + +#python wakeup.py 00:00 & + +if [ "${STDOUT_FLAG}" -gt "0" ] ; then +#if changing the std::out destination, remember to also change it in your json config file (for reading) + if test -f "$STDOUT_DIR/${nameLog}.log---"; then + rm -f $STDOUT_DIR/${nameLog}.log--- + fi + if test -f "$STDOUT_DIR/${nameLog}.log--"; then + cp $STDOUT_DIR/${nameLog}.log-- $STDOUT_DIR/${nameLog}.log--- + rm -f $STDOUT_DIR/${nameLog}.log-- + fi + if test -f "$STDOUT_DIR/${nameLog}.log-"; then + cp $STDOUT_DIR/${nameLog}.log- $STDOUT_DIR/${nameLog}.log-- + rm -f $STDOUT_DIR/${nameLog}.log- + fi + if test -f "$STDOUT_DIR/${nameLog}.log"; then + cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- + rm -f $STDOUT_DIR/${nameLog}.log + fi + + python ${name}.py -u ${name}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & + chmod 777 $STDOUT_DIR/${nameLog}.log +else +#Run instead without std::out + python ${name}.py -u ${name}.json & +fi + + diff --git a/wakeup.py b/wakeup.py new file mode 100644 index 0000000..69eb410 --- /dev/null +++ b/wakeup.py @@ -0,0 +1,57 @@ +'''Precedes splashscreen of main application +''' +import sys +import time + +from qtpy.QtCore import Qt, QTime, QTimer +from qtpy.QtGui import QColor, QImage, QPainter, QPixmap +from qtpy.QtWidgets import QApplication, QLabel + +from pyqtacc.qrc_resources.facility.proscan.pyrcc5 import qrc_resources + + +app = QApplication(sys.argv) + +try: + due = QTime.currentTime() + message = "Tina will begin to load shortly" + if len(sys.argv) < 2: + raise ValueError + hours, mins = sys.argv[1].split(":") + due = QTime(int(hours), int(mins)) + if not due.isValid(): + raise ValueError + if len(sys.argv) > 2: + message = " ".join(sys.argv[2:]) +except ValueError: + message = "Usage: wakeup.py HH:MM [optional message]" + + +while QTime.currentTime() < due: + time.sleep(1) + +image = QImage(":/Hush.jpg") +p = QPainter(image) +font = p.font() +font.setPixelSize(54) +p.setFont(font) +p.setPen(QColor(Qt.red)) +#p.setStyleSheet("color:red;") +#p.save() +p.drawText(40, 350, message) +#p.restore() + +pixmap = QPixmap.fromImage(image) + +label = QLabel() +label.setPixmap(pixmap) +label.setScaledContents(True) + +label.setWindowFlags(Qt.SplashScreen) +label.setAlignment(Qt.AlignCenter) +label.setFixedHeight(600) +label.setFixedWidth(600) +label.show() +QTimer.singleShot(5000, app.quit) #5 seconds + +app.exec_()