forked from IPKM/nmreval
First commit
This commit is contained in:
commit
a222072b28
42
Makefile
Executable file
42
Makefile
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
#binaries
|
||||||
|
PYUIC = pyuic5
|
||||||
|
PYRCC = pyrcc5
|
||||||
|
|
||||||
|
#Directory with ui files
|
||||||
|
RESOURCE_DIR = resources/_ui
|
||||||
|
|
||||||
|
#Directory for compiled resources
|
||||||
|
COMPILED_DIR = nmreval/gui_qt/_py
|
||||||
|
|
||||||
|
#UI files to compile, uses every *.ui found in RESOURCE_DIR
|
||||||
|
UI_FILES = $(foreach dir, $(RESOURCE_DIR), $(notdir $(wildcard $(dir)/*.ui)))
|
||||||
|
COMPILED_UI = $(UI_FILES:%.ui=$(COMPILED_DIR)/%.py)
|
||||||
|
|
||||||
|
SVG_FILES = $(foreach dir, $(RCC_DIR), $(notdir $(wildcard $(dir)/*.svg)))
|
||||||
|
PNG_FILES = $(SVG_FILES:%.svg=$(RCC_DIR)/%.png)
|
||||||
|
|
||||||
|
all : ui
|
||||||
|
|
||||||
|
ui : $(COMPILED_UI)
|
||||||
|
|
||||||
|
rcc: $(PNG_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
$(COMPILED_DIR)/%.py : $(RESOURCE_DIR)/%.ui
|
||||||
|
$(PYUIC) $< -o $@
|
||||||
|
# replace import of ressource to correct path
|
||||||
|
# @sed -i s/images_rc/nmrevalqt.$(COMPILED_DIR).images_rc/g $@
|
||||||
|
# @sed -i /images_rc/d $@
|
||||||
|
|
||||||
|
$(RCC_DIR)/%.png : $(RCC_DIR)/%.svg
|
||||||
|
convert -background none $< $@
|
||||||
|
$(PYRCC) $(RCC_DIR)/images.qrc -o $(COMPILED_DIR)/images_rc.py
|
||||||
|
|
||||||
|
clean:
|
||||||
|
find . -name '*.pyc' -exec rm -f {} +
|
||||||
|
find . -name '*.pyo' -exec rm -f {} +
|
||||||
|
find . -name '*~' -exec rm -f {} +
|
||||||
|
find . -name '__pycache__' -exec rm -fr {} +
|
||||||
|
|
2
__init__.py
Executable file
2
__init__.py
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
from .version import __version__, __releasename__
|
18
bin/evaluate.py
Executable file
18
bin/evaluate.py
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
# pyqtgraph warns on Mac if QApplication is created when it is imported
|
||||||
|
import pyqtgraph
|
||||||
|
|
||||||
|
from nmreval.lib.logger import handle_exception
|
||||||
|
sys.excepthook = handle_exception
|
||||||
|
|
||||||
|
from nmreval.gui_qt import App
|
||||||
|
from nmreval.gui_qt.main.mainwindow import NMRMainWindow
|
||||||
|
|
||||||
|
app = App([])
|
||||||
|
|
||||||
|
mplQt = NMRMainWindow()
|
||||||
|
mplQt.show()
|
||||||
|
|
||||||
|
sys.exit(app.exec())
|
20
docs/Makefile
Normal file
20
docs/Makefile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Minimal makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line, and also
|
||||||
|
# from the environment for the first two.
|
||||||
|
SPHINXOPTS ?=
|
||||||
|
SPHINXBUILD ?= /autohome/dominik/miniconda3/bin/sphinx-build
|
||||||
|
SOURCEDIR = /autohome/dominik/nmreval/docs/source
|
||||||
|
BUILDDIR = /autohome/dominik/nmreval/docs/build
|
||||||
|
|
||||||
|
# Put it first so that "make" without argument is like "make help".
|
||||||
|
help:
|
||||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
%: Makefile
|
||||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
35
docs/make.bat
Normal file
35
docs/make.bat
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
pushd %~dp0
|
||||||
|
|
||||||
|
REM Command file for Sphinx documentation
|
||||||
|
|
||||||
|
if "%SPHINXBUILD%" == "" (
|
||||||
|
set SPHINXBUILD=sphinx-build
|
||||||
|
)
|
||||||
|
set SOURCEDIR=source
|
||||||
|
set BUILDDIR=build
|
||||||
|
|
||||||
|
if "%1" == "" goto help
|
||||||
|
|
||||||
|
%SPHINXBUILD% >NUL 2>NUL
|
||||||
|
if errorlevel 9009 (
|
||||||
|
echo.
|
||||||
|
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||||
|
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||||
|
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||||
|
echo.may add the Sphinx directory to PATH.
|
||||||
|
echo.
|
||||||
|
echo.If you don't have Sphinx installed, grab it from
|
||||||
|
echo.http://sphinx-doc.org/
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:help
|
||||||
|
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||||
|
|
||||||
|
:end
|
||||||
|
popd
|
BIN
docs/source/_static/fit_dialog.png
Normal file
BIN
docs/source/_static/fit_dialog.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
BIN
docs/source/_static/logo.png
Normal file
BIN
docs/source/_static/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 600 KiB |
25
docs/source/_templates/autosummary.rst
Normal file
25
docs/source/_templates/autosummary.rst
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{{ fullname | escape | underline }}
|
||||||
|
|
||||||
|
|
||||||
|
.. currentmodule:: {{ module }}
|
||||||
|
|
||||||
|
|
||||||
|
{% if objtype in ['class'] %}
|
||||||
|
|
||||||
|
Inheritance diagram
|
||||||
|
|
||||||
|
.. inheritance-diagram:: {{ objname }}
|
||||||
|
:parts: 1
|
||||||
|
|
||||||
|
{{ objtype }}
|
||||||
|
|
||||||
|
.. auto{{ objtype }}:: {{ objname }}
|
||||||
|
:special-members: __call__
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
.. auto{{ objtype }}:: {{ objname }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
23
docs/source/api/data.rst
Normal file
23
docs/source/api/data.rst
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
**************
|
||||||
|
Data container
|
||||||
|
**************
|
||||||
|
|
||||||
|
.. automodule:: nmreval.data
|
||||||
|
:no-members:
|
||||||
|
:no-undoc-members:
|
||||||
|
|
||||||
|
|
||||||
|
.. contents:: Table of Contents
|
||||||
|
:depth: 3
|
||||||
|
:local:
|
||||||
|
:backlinks: entry
|
||||||
|
|
||||||
|
|
||||||
|
.. autosummary::
|
||||||
|
:toctree: generated/
|
||||||
|
:template: autosummary.rst
|
||||||
|
:nosignatures:
|
||||||
|
|
||||||
|
nmreval.data.Points
|
||||||
|
nmreval.data.Signal
|
||||||
|
nmreval.data.BDS
|
29
docs/source/api/distributions/index.rst
Normal file
29
docs/source/api/distributions/index.rst
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
*********************************
|
||||||
|
Distribution of correlation times
|
||||||
|
*********************************
|
||||||
|
|
||||||
|
List of all implemented distributions and the associated correlation functions, spectral densities, susceptibilies
|
||||||
|
|
||||||
|
.. contents:: Table of Contents
|
||||||
|
:depth: 3
|
||||||
|
:local:
|
||||||
|
:backlinks: entry
|
||||||
|
|
||||||
|
Cole-Cole
|
||||||
|
---------
|
||||||
|
|
||||||
|
.. automodule:: nmreval.distributions.colecole
|
||||||
|
:members:
|
||||||
|
|
||||||
|
|
||||||
|
Cole-Davidson
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. automodule:: nmreval.distributions.coledavidson
|
||||||
|
:members:
|
||||||
|
|
||||||
|
Havriliak-Negami
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. automodule:: nmreval.distributions.havriliaknegami
|
||||||
|
:members:
|
23
docs/source/api/generated/nmreval.data.BDS.rst
Normal file
23
docs/source/api/generated/nmreval.data.BDS.rst
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
nmreval.data.BDS
|
||||||
|
================
|
||||||
|
|
||||||
|
|
||||||
|
.. currentmodule:: nmreval.data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Inheritance diagram
|
||||||
|
|
||||||
|
.. inheritance-diagram:: BDS
|
||||||
|
:parts: 1
|
||||||
|
|
||||||
|
class
|
||||||
|
|
||||||
|
.. autoclass:: BDS
|
||||||
|
:special-members: __call__
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|
||||||
|
|
||||||
|
|
23
docs/source/api/generated/nmreval.data.Points.rst
Normal file
23
docs/source/api/generated/nmreval.data.Points.rst
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
nmreval.data.Points
|
||||||
|
===================
|
||||||
|
|
||||||
|
|
||||||
|
.. currentmodule:: nmreval.data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Inheritance diagram
|
||||||
|
|
||||||
|
.. inheritance-diagram:: Points
|
||||||
|
:parts: 1
|
||||||
|
|
||||||
|
class
|
||||||
|
|
||||||
|
.. autoclass:: Points
|
||||||
|
:special-members: __call__
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|
||||||
|
|
||||||
|
|
23
docs/source/api/generated/nmreval.data.Signal.rst
Normal file
23
docs/source/api/generated/nmreval.data.Signal.rst
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
nmreval.data.Signal
|
||||||
|
===================
|
||||||
|
|
||||||
|
|
||||||
|
.. currentmodule:: nmreval.data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Inheritance diagram
|
||||||
|
|
||||||
|
.. inheritance-diagram:: Signal
|
||||||
|
:parts: 1
|
||||||
|
|
||||||
|
class
|
||||||
|
|
||||||
|
.. autoclass:: Signal
|
||||||
|
:special-members: __call__
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|
||||||
|
|
||||||
|
|
12
docs/source/api/index.rst
Normal file
12
docs/source/api/index.rst
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
==========
|
||||||
|
References
|
||||||
|
==========
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:caption: Table of contents
|
||||||
|
:maxdepth: 2
|
||||||
|
:glob:
|
||||||
|
|
||||||
|
data.rst
|
||||||
|
models/index.rst
|
||||||
|
distributions/index.rst
|
6
docs/source/api/models/basic.rst
Normal file
6
docs/source/api/models/basic.rst
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
************************
|
||||||
|
``nmreval.models.basic``
|
||||||
|
************************
|
||||||
|
|
||||||
|
.. automodule:: nmreval.models.basic
|
||||||
|
:members:
|
31
docs/source/api/models/index.rst
Normal file
31
docs/source/api/models/index.rst
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
**************
|
||||||
|
Model function
|
||||||
|
**************
|
||||||
|
|
||||||
|
List of all implemented functions
|
||||||
|
|
||||||
|
.. contents:: Table of Contents
|
||||||
|
:depth: 3
|
||||||
|
:local:
|
||||||
|
:backlinks: entry
|
||||||
|
|
||||||
|
Basic functions
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. currentmodule:: nmreval
|
||||||
|
|
||||||
|
.. autosummary::
|
||||||
|
:toctree:
|
||||||
|
|
||||||
|
nmreval.models.basic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NMR relaxation functions
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. automodule:: nmreval.models.relaxation
|
||||||
|
:members:
|
||||||
|
|
||||||
|
|
37
docs/source/api/models/nmreval.models.basic.rst
Normal file
37
docs/source/api/models/nmreval.models.basic.rst
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
nmreval.models.basic
|
||||||
|
====================
|
||||||
|
|
||||||
|
.. automodule:: nmreval.models.basic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. rubric:: Classes
|
||||||
|
|
||||||
|
.. autosummary::
|
||||||
|
|
||||||
|
Constant
|
||||||
|
ExpFunc
|
||||||
|
Linear
|
||||||
|
Log
|
||||||
|
MittagLeffler
|
||||||
|
Parabola
|
||||||
|
PowerLaw
|
||||||
|
PowerLawCross
|
||||||
|
Sine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
424
docs/source/conf.py
Normal file
424
docs/source/conf.py
Normal file
@ -0,0 +1,424 @@
|
|||||||
|
# Configuration file for the Sphinx documentation builder.
|
||||||
|
#
|
||||||
|
# This file only contains a selection of the most common options. For a full
|
||||||
|
# list see the documentation:
|
||||||
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||||
|
|
||||||
|
# -- Path setup --------------------------------------------------------------
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#
|
||||||
|
import sys
|
||||||
|
import sphinx_bootstrap_theme
|
||||||
|
sys.path.append('/autohome/dominik/nmreval')
|
||||||
|
import nmreval
|
||||||
|
|
||||||
|
|
||||||
|
# -- Project information -----------------------------------------------------
|
||||||
|
project = 'NMREval'
|
||||||
|
author = 'Dominik Demuth'
|
||||||
|
copyright = '2022, Dominik Demuth'
|
||||||
|
|
||||||
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
# built documents.
|
||||||
|
#
|
||||||
|
# The short X.Y version
|
||||||
|
release = nmreval.__version__
|
||||||
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
version = release
|
||||||
|
|
||||||
|
|
||||||
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
# ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
'sphinx.ext.autosummary',
|
||||||
|
'sphinx.ext.inheritance_diagram',
|
||||||
|
'sphinx.ext.napoleon',
|
||||||
|
'sphinx.ext.viewcode',
|
||||||
|
'sphinx.ext.intersphinx',
|
||||||
|
]
|
||||||
|
|
||||||
|
# The suffix(es) of source filenames.
|
||||||
|
# You can specify multiple suffix as a list of string:
|
||||||
|
#
|
||||||
|
# source_suffix = ['.rst', '.md']
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
# This pattern also affects html_static_path and html_extra_path.
|
||||||
|
exclude_patterns = []
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
#
|
||||||
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
|
# Usually you set "language" from the command line for these cases.
|
||||||
|
language = None
|
||||||
|
|
||||||
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
|
# non-false value, then it is used:
|
||||||
|
#
|
||||||
|
# today = ''
|
||||||
|
#
|
||||||
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
|
#
|
||||||
|
# today_fmt = '%B %d, %Y'
|
||||||
|
|
||||||
|
# The reST default role (used for this markup: `text`) to use for all
|
||||||
|
# documents.
|
||||||
|
#
|
||||||
|
# default_role = None
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
#
|
||||||
|
add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
#
|
||||||
|
add_module_names = False
|
||||||
|
|
||||||
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
|
# output. They are ignored by default.
|
||||||
|
#
|
||||||
|
# show_authors = False
|
||||||
|
|
||||||
|
# A list of ignored prefixes for module index sorting.
|
||||||
|
# modindex_common_prefix = []
|
||||||
|
|
||||||
|
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||||
|
# keep_warnings = False
|
||||||
|
|
||||||
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||||
|
todo_include_todos = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
#
|
||||||
|
# html_theme = 'bootstrap'
|
||||||
|
html_theme = 'pydata_sphinx_theme'
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
#
|
||||||
|
# html_theme_options = {
|
||||||
|
# # 'source_link_position': "footer",
|
||||||
|
# 'bootswatch_theme': "cosmo",
|
||||||
|
# 'navbar_title': "Welcome to hell",
|
||||||
|
# 'navbar_sidebarrel': True,
|
||||||
|
# 'nosidebar': False,
|
||||||
|
# 'body_max_width': '100%',
|
||||||
|
# 'navbar_links': [
|
||||||
|
# ('User guide', 'user_guide/index'),
|
||||||
|
# ('References', 'api/index'),
|
||||||
|
# ],
|
||||||
|
# }
|
||||||
|
html_theme_options = {
|
||||||
|
'collapse_navigation': False,
|
||||||
|
'show_prev_next': False,
|
||||||
|
'navbar_end': ['navbar-icon-links.html', 'search-field.html'],
|
||||||
|
'show_toc_level': 3
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
|
# html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
|
||||||
|
|
||||||
|
# The name for this set of Sphinx documents.
|
||||||
|
# "<project> v<release> documentation" by default.
|
||||||
|
#
|
||||||
|
# html_title = u'NMREval v0.0.1'
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
|
# html_short_title = None
|
||||||
|
|
||||||
|
# (Optional) Logo. Should be small enough to fit the navbar (ideally 24x24).
|
||||||
|
# Path should be relative to the ``_static`` files directory.
|
||||||
|
html_logo = '_static/logo.png'
|
||||||
|
|
||||||
|
# Custom sidebar templates, maps document names to template names.
|
||||||
|
html_sidebars = {'**': ['sidebar-nav-bs.html']}
|
||||||
|
# html_sidebars = {
|
||||||
|
# '**': ['localtoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html'],
|
||||||
|
# }
|
||||||
|
|
||||||
|
# If true, links to the reST sources are added to the pages.
|
||||||
|
html_show_sourcelink = False
|
||||||
|
|
||||||
|
# The name of an image file (within the static path) to use as favicon of the
|
||||||
|
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
|
# pixels large.
|
||||||
|
# html_favicon = None
|
||||||
|
|
||||||
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
|
# using the given strftime format.
|
||||||
|
html_last_updated_fmt = ''
|
||||||
|
|
||||||
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
|
# template names.
|
||||||
|
html_additional_pages = {}
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
html_domain_indices = False
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
html_use_index = True
|
||||||
|
|
||||||
|
# If true, the index is split into individual pages for each letter.
|
||||||
|
html_split_index = False
|
||||||
|
|
||||||
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
|
# html_show_sphinx = True
|
||||||
|
|
||||||
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
|
# html_show_copyright = True
|
||||||
|
|
||||||
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
|
# base URL from which the finished HTML is served.
|
||||||
|
# html_use_opensearch = ''
|
||||||
|
|
||||||
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
|
html_file_suffix = None
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
# htmlhelp_basename = 'pydoc'
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
#
|
||||||
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
#
|
||||||
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
#
|
||||||
|
# 'preamble': '',
|
||||||
|
|
||||||
|
# Latex figure (float) alignment
|
||||||
|
#
|
||||||
|
# 'figure_align': 'htbp',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title,
|
||||||
|
# author, documentclass [howto, manual, or own class]).
|
||||||
|
latex_documents = [
|
||||||
|
(master_doc, 'NMREval.tex', u'NMREval Documentation',
|
||||||
|
u'Dominik Demuth', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
# the title page.
|
||||||
|
#
|
||||||
|
# latex_logo = None
|
||||||
|
|
||||||
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
|
# not chapters.
|
||||||
|
#
|
||||||
|
# latex_use_parts = False
|
||||||
|
|
||||||
|
# If true, show page references after internal links.
|
||||||
|
#
|
||||||
|
# latex_show_pagerefs = False
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#
|
||||||
|
# latex_show_urls = False
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#
|
||||||
|
# latex_appendices = []
|
||||||
|
|
||||||
|
# It false, will not define \strong, \code, itleref, \crossref ... but only
|
||||||
|
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
|
||||||
|
# packages.
|
||||||
|
#
|
||||||
|
# latex_keep_old_macro_names = True
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for manual page output ---------------------------------------
|
||||||
|
|
||||||
|
# One entry per manual page. List of tuples
|
||||||
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [
|
||||||
|
(master_doc, 'nmreval', u'NMREval Documentation',
|
||||||
|
[author], 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#
|
||||||
|
# man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Texinfo output -------------------------------------------
|
||||||
|
|
||||||
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
|
# (source start file, target name, title, author,
|
||||||
|
# dir menu entry, description, category)
|
||||||
|
texinfo_documents = [
|
||||||
|
(master_doc, 'NMREval', u'NMREval Documentation',
|
||||||
|
author, 'NMREval', 'One line description of project.',
|
||||||
|
'Miscellaneous'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#
|
||||||
|
# texinfo_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# texinfo_domain_indices = True
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#
|
||||||
|
# texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
|
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||||
|
#
|
||||||
|
# texinfo_no_detailmenu = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Epub output ----------------------------------------------
|
||||||
|
|
||||||
|
# Bibliographic Dublin Core info.
|
||||||
|
epub_title = project
|
||||||
|
epub_author = author
|
||||||
|
epub_publisher = author
|
||||||
|
epub_copyright = copyright
|
||||||
|
|
||||||
|
# The basename for the epub file. It defaults to the project name.
|
||||||
|
# epub_basename = project
|
||||||
|
|
||||||
|
# The HTML theme for the epub output. Since the default themes are not
|
||||||
|
# optimized for small screen space, using the same theme for HTML and epub
|
||||||
|
# output is usually not wise. This defaults to 'epub', a theme designed to save
|
||||||
|
# visual space.
|
||||||
|
#
|
||||||
|
# epub_theme = 'epub'
|
||||||
|
|
||||||
|
# The language of the text. It defaults to the language option
|
||||||
|
# or 'en' if the language is not set.
|
||||||
|
#
|
||||||
|
# epub_language = ''
|
||||||
|
|
||||||
|
# The scheme of the identifier. Typical schemes are ISBN or URL.
|
||||||
|
# epub_scheme = ''
|
||||||
|
|
||||||
|
# The unique identifier of the text. This can be a ISBN number
|
||||||
|
# or the project homepage.
|
||||||
|
#
|
||||||
|
# epub_identifier = ''
|
||||||
|
|
||||||
|
# A unique identification for the text.
|
||||||
|
#
|
||||||
|
# epub_uid = ''
|
||||||
|
|
||||||
|
# A tuple containing the cover image and cover page html template filenames.
|
||||||
|
#
|
||||||
|
# epub_cover = ()
|
||||||
|
|
||||||
|
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
|
||||||
|
#
|
||||||
|
# epub_guide = ()
|
||||||
|
|
||||||
|
# HTML files that should be inserted before the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
#
|
||||||
|
# epub_pre_files = []
|
||||||
|
|
||||||
|
# HTML files that should be inserted after the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
#
|
||||||
|
# epub_post_files = []
|
||||||
|
|
||||||
|
# A list of files that should not be packed into the epub file.
|
||||||
|
epub_exclude_files = ['search.html']
|
||||||
|
|
||||||
|
# The depth of the table of contents in toc.ncx.
|
||||||
|
#
|
||||||
|
# epub_tocdepth = 3
|
||||||
|
|
||||||
|
# Allow duplicate toc entries.
|
||||||
|
#
|
||||||
|
# epub_tocdup = True
|
||||||
|
|
||||||
|
# Choose between 'default' and 'includehidden'.
|
||||||
|
#
|
||||||
|
# epub_tocscope = 'default'
|
||||||
|
|
||||||
|
# Fix unsupported image types using the Pillow.
|
||||||
|
#
|
||||||
|
# epub_fix_images = False
|
||||||
|
|
||||||
|
# Scale large images.
|
||||||
|
#
|
||||||
|
# epub_max_image_width = 0
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#
|
||||||
|
# epub_show_urls = 'inline'
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#
|
||||||
|
# epub_use_index = True
|
||||||
|
|
||||||
|
|
||||||
|
# configuration for intersphinx
|
||||||
|
intersphinx_mapping = {
|
||||||
|
'Pillow': ('https://pillow.readthedocs.io/en/stable/', None),
|
||||||
|
'cycler': ('https://matplotlib.org/cycler/', None),
|
||||||
|
'dateutil': ('https://dateutil.readthedocs.io/en/stable/', None),
|
||||||
|
'ipykernel': ('https://ipykernel.readthedocs.io/en/latest/', None),
|
||||||
|
'numpy': ('https://numpy.org/doc/stable/', None),
|
||||||
|
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
|
||||||
|
'pytest': ('https://pytest.org/en/stable/', None),
|
||||||
|
'python': ('https://docs.python.org/3/', None),
|
||||||
|
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
|
||||||
|
'tornado': ('https://www.tornadoweb.org/en/stable/', None),
|
||||||
|
'xarray': ('https://xarray.pydata.org/en/stable/', None),
|
||||||
|
'PyQt': ('https://www.riverbankcomputing.com/static/Docs/PyQt5/', None),
|
||||||
|
}
|
||||||
|
|
||||||
|
# autodoc options
|
||||||
|
autodoc_typehints = 'none'
|
||||||
|
autodoc_class_signature = 'separated'
|
||||||
|
autoclass_content = 'class'
|
||||||
|
|
||||||
|
# autosummay options
|
||||||
|
autosummary_generate = True
|
||||||
|
|
26
docs/source/index.rst
Normal file
26
docs/source/index.rst
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
.. NMREval documentation master file, created by
|
||||||
|
sphinx-quickstart on Sun Feb 20 17:26:03 2022.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
###################################
|
||||||
|
NMREval documentation
|
||||||
|
###################################
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 1
|
||||||
|
|
||||||
|
user_guide/index
|
||||||
|
|
||||||
|
nmr/index
|
||||||
|
|
||||||
|
api/index
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
BIN
docs/source/nmr/depake.png
Normal file
BIN
docs/source/nmr/depake.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
8
docs/source/nmr/index.rst
Normal file
8
docs/source/nmr/index.rst
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
=============
|
||||||
|
NMR specifics
|
||||||
|
=============
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
pake
|
43
docs/source/nmr/pake.rst
Normal file
43
docs/source/nmr/pake.rst
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
.. _nmr.pake:
|
||||||
|
|
||||||
|
Wideline spectra
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Calculation of spectra
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
In general, time signals are calculated by integration of all orientations (see also :ref:`list.orienations`):
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
g(t) = \int f[\omega_\text{int}(\theta, \phi)t]\sin\theta\,\mathrm{d}\theta\,\mathrm{d}\phi
|
||||||
|
|
||||||
|
with :math:`f(\theta, \phi, t) = \cos[\omega_\text{int}(\theta, \phi) t]` or :math:`\exp[i\omega_\text{int}(\theta) t]` and fourier transform for a spectrum.
|
||||||
|
However, summation over :math:`\theta`, :math:`\phi`, and calculating :math:`f(\theta, \phi, t)` for each orientation is time consuming.
|
||||||
|
|
||||||
|
Alternatively, if the orientations are equidistant in :math:`\cos\theta`, one can get to the spectrum directly by creating a histogram of :math:`\omega_\text{int}(\theta, \phi)`, thus circumventing a lot of calculations.
|
||||||
|
|
||||||
|
|
||||||
|
De-Paked spectra
|
||||||
|
----------------
|
||||||
|
|
||||||
|
A superposition of different Pake spectra complicates the evaluation of relaxation times or similar.
|
||||||
|
The idea is to deconvolute these broad spectra into one line corresponding to relative orientation :math:`\theta = 0` [mccabe97]_.
|
||||||
|
|
||||||
|
For :math:`\omega_\text{int}(\theta) \propto (3\cos^2\theta -1)/2 = P_2(\cos\theta)`, the property :math:`\omega_\text{int}(\theta) = \omega_\text{int}(0) \omega_\text{int}(\theta)` is used to write
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
g(t) = \int_0^{1} f[0, \omega_\text{int}(\theta)t]\,\mathrm{d}\cos\theta.
|
||||||
|
|
||||||
|
This way, the integration is not over orientations at one time :math:`t`, but over times at one orientation 0.
|
||||||
|
After some integrations, rearrangenments, and substitutions, a spectrum can be calculated by
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
F(-2\omega) = \sqrt{\frac{3|\omega |}{2\pi}}(1\pm i) \text{FT}[g(t)\sqrt{t}]
|
||||||
|
|
||||||
|
with :math:`1+i` for :math:`\omega > 0` and :math:`1-i` for :math:`\omega > 0`.
|
||||||
|
|
||||||
|
.. figure:: depake.png
|
||||||
|
:scale: 50 %
|
||||||
|
|
||||||
|
|
||||||
|
.. [mccabe97] M.A. McCabe, S.R. Wassail: Rapid deconvolution of NMR powder spectra by weighted fast Fourier transformation, Solid State Nuclear Magnetic Resonance (1997). https://doi.org/10.1016/S0926-2040(97)00024-6
|
43
docs/source/user_guide/fit.rst
Normal file
43
docs/source/user_guide/fit.rst
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
.. _user_guide.fit:
|
||||||
|
|
||||||
|
============
|
||||||
|
Fitting data
|
||||||
|
============
|
||||||
|
|
||||||
|
.. image:: ../_static/fit_dialog.png
|
||||||
|
:scale: 80%
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
The picture gives an example of dialog to setup and start fits.
|
||||||
|
First, there is the possibiity to fit different functions, called models to differentiate from the functions inside each
|
||||||
|
model, to different data simultaneously.
|
||||||
|
In the given example, two models were would be used during fit:
|
||||||
|
test1 and test3 use the default model, in this case model a,
|
||||||
|
while test2 uses model b.
|
||||||
|
|
||||||
|
In the middle column, the functions of model a are currently given in a tree structure:
|
||||||
|
It is comprised of three functions: a constant, a sine curve, which is a child of the constant, and free diffusion.
|
||||||
|
Functions can be dragged by mouse to each position, including a child position, and it is possible to switch between the
|
||||||
|
four basic arithmetic operations (+, -, \*, /) by striking the corresponding key.
|
||||||
|
Function at the same level, e.g., constant and free diffusion, are evaluated in the given order.
|
||||||
|
Children of a function take precedence over the following functions.
|
||||||
|
This means for the given example, that model a is something like
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
f(x) = [\text{constant} / \text{sine}] + \text{diffusion}
|
||||||
|
|
||||||
|
It is possible to skip functions by de-selecting it.
|
||||||
|
This choice alse affects children, even if they are selected.
|
||||||
|
|
||||||
|
The right column gives access to the parameter of selected function, in this case of the free diffusion function.
|
||||||
|
Here, the parameter :math:`M_0` is linked to the parameter :math:`C` of another constant function of model b
|
||||||
|
(identifiable by the number behind the name).
|
||||||
|
Linkage links not only parameter between function but all settings, e.g., if :math:`C` is fixed, :math:`M_0` is fixed.
|
||||||
|
Some parameters like gradient :math:`g` are predefined as fixed parameters and are lacking any options besides their value.
|
||||||
|
Upper and lower bounds may be given.
|
||||||
|
If one or two of the bounds are not given, this parameter is unbounded on the respective side.
|
||||||
|
|
||||||
|
If a parameter has one entry, this value is initial parameter for all data sets.
|
||||||
|
If the number of entries is greater than the number of data sets, the first :math:`n` values are used.
|
||||||
|
Here, test1 uses 1 as parameter for :math:`t_{ev}` and test3 uses 3.
|
||||||
|
If the number of entries is less than the number of data sets, the last value will be used for each additional set.
|
11
docs/source/user_guide/index.rst
Normal file
11
docs/source/user_guide/index.rst
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
==========
|
||||||
|
User Guide
|
||||||
|
==========
|
||||||
|
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
read
|
||||||
|
fit
|
||||||
|
shift_scale
|
19
docs/source/user_guide/read.rst
Normal file
19
docs/source/user_guide/read.rst
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
.. _user_guide.read:
|
||||||
|
|
||||||
|
*************
|
||||||
|
Reading files
|
||||||
|
*************
|
||||||
|
|
||||||
|
Supported filetypes are
|
||||||
|
|
||||||
|
* Text files,
|
||||||
|
* DAMARIS HDF5 files,
|
||||||
|
* Grace images.
|
||||||
|
* HP alpha-analyzer EPS files
|
||||||
|
* NTNMR .tnt files
|
||||||
|
|
||||||
|
DAMARIS HDF files
|
||||||
|
=================
|
||||||
|
|
||||||
|
After scanning the selected file the program shows a list of the available data.
|
||||||
|
|
16
docs/source/user_guide/shift_scale.rst
Normal file
16
docs/source/user_guide/shift_scale.rst
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.. _usage.shift_scale:
|
||||||
|
|
||||||
|
Moving and scaling
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Values are always used and displayed in scientific notation *x.yyyyez* where x is a signed single digit larger than 0.
|
||||||
|
The relative stepsize (by default 0.0001) increases or decreases is always of the same magnitude as the current value, e.g.,
|
||||||
|
1.2345e0 changes by 0.0001, but 1.2345e20 changes by 0.0001e20.
|
||||||
|
If the step results in a new order of magnitude the value will be adjusted accordingly, i.e., a step from 9.9999e1 to 10.0000e1 will become 1.0000e2.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
This behaviour leads almost always to values different from zero when using the arrow buttons. Please enter it directly to get a value of zero.
|
||||||
|
|
||||||
|
Boxes :guilabel:`log x` and :guilabel:`log y` change the respective axis from a linear to logarithmic scaling and vice versa.
|
||||||
|
|
||||||
|
Every selected set will be recalculated according to :math:`new = scale \cdot old + offset`.
|
1
nmreval/__init__.py
Normal file
1
nmreval/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
__version__ = '0.0.2'
|
1
nmreval/bds/__init__.py
Normal file
1
nmreval/bds/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
69
nmreval/configs.py
Normal file
69
nmreval/configs.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import configparser
|
||||||
|
import pathlib
|
||||||
|
import pickle
|
||||||
|
import logging.handlers
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['config_paths', 'read_configuration', 'write_configuration', 'allowed_values', 'write_state', 'read_state']
|
||||||
|
|
||||||
|
|
||||||
|
def config_paths() -> pathlib.Path:
|
||||||
|
# TODO adjust for different OS
|
||||||
|
searchpaths = ['~/.local/share/auswerten', '~/.auswerten', '/usr/share/nmreval']
|
||||||
|
path = None
|
||||||
|
for p in searchpaths:
|
||||||
|
path = pathlib.Path(p).expanduser()
|
||||||
|
if path.exists():
|
||||||
|
break
|
||||||
|
|
||||||
|
if path is None:
|
||||||
|
raise FileNotFoundError('No valid configuration path found')
|
||||||
|
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def read_configuration() -> configparser.ConfigParser:
|
||||||
|
try:
|
||||||
|
config_file = config_paths() / 'nmreval.cfg'
|
||||||
|
if not config_file.exists():
|
||||||
|
write_configuration({'GUI': {'theme': 'normal', 'color': 'light'}})
|
||||||
|
# raise FileNotFoundError('Configuration file not found')
|
||||||
|
#
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
raise e
|
||||||
|
|
||||||
|
parser = configparser.ConfigParser()
|
||||||
|
parser.read(config_file)
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def write_configuration(opts: dict):
|
||||||
|
config_file = config_paths() / 'nmreval.cfg'
|
||||||
|
|
||||||
|
parser = configparser.ConfigParser()
|
||||||
|
parser.read_dict(opts)
|
||||||
|
|
||||||
|
with config_file.open('w') as f:
|
||||||
|
parser.write(f)
|
||||||
|
|
||||||
|
|
||||||
|
allowed_values = {
|
||||||
|
('GUI', 'theme'): ['normal', 'pokemon'],
|
||||||
|
('GUI', 'color'): ['light', 'dark'],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def write_state(opts: dict):
|
||||||
|
config_file = config_paths() / 'guistate.ini'
|
||||||
|
with config_file.open('wb') as f:
|
||||||
|
pickle.dump(opts, f)
|
||||||
|
|
||||||
|
|
||||||
|
def read_state() -> dict:
|
||||||
|
config_file = config_paths() / 'guistate.ini'
|
||||||
|
if not config_file.exists():
|
||||||
|
return {}
|
||||||
|
|
||||||
|
with config_file.open('rb') as f:
|
||||||
|
return pickle.load(f)
|
5
nmreval/data/__init__.py
Executable file
5
nmreval/data/__init__.py
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
from .points import Points
|
||||||
|
from .signals import Signal
|
||||||
|
from .bds import BDS
|
||||||
|
from .dsc import DSC
|
||||||
|
from .nmr import FID, Spectrum
|
47
nmreval/data/bds.py
Normal file
47
nmreval/data/bds.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from scipy.signal import savgol_filter
|
||||||
|
|
||||||
|
from . import Points
|
||||||
|
from .signals import Signal
|
||||||
|
|
||||||
|
|
||||||
|
class BDS(Signal):
|
||||||
|
"""
|
||||||
|
Extension of Signal for dielectric spectroscopy purposes.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, x, y, **kwargs: Any):
|
||||||
|
super().__init__(x, y, **kwargs)
|
||||||
|
|
||||||
|
if np.all(self._x > 0) and not np.allclose(np.diff(self._x), self._x[1]-self._x[0]):
|
||||||
|
self.dx = self.x[1] / self.x[0]
|
||||||
|
else:
|
||||||
|
self.dx = self._x[1] - self._x[0]
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
return f"{self.meta['mode']}: {self.name}"
|
||||||
|
|
||||||
|
def derivative(self, window_length=9) -> Points:
|
||||||
|
"""
|
||||||
|
Calculates the derivative :math:`-\\frac{\\pi}{2}\\frac{d\\epsilon'}{d\\ln\\omega}`.
|
||||||
|
To reduce :func:`scipy.signal.savgol_filter`
|
||||||
|
|
||||||
|
Args:
|
||||||
|
window_length (int)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Points
|
||||||
|
New Points instance with
|
||||||
|
|
||||||
|
References:
|
||||||
|
Wübbenhorst, M.; van Turnhout, J.: Analysis of complex dielectric spectra.
|
||||||
|
I. One-dimensional derivative techniques and three-dimensional modelling.
|
||||||
|
J. Non-Cryst. Solid. 305 (2002) https://doi.org/10.1016/s0022-3093(02)01086-4
|
||||||
|
|
||||||
|
"""
|
||||||
|
y = -savgol_filter(self.y[self.mask].real, window_length, 2, deriv=1) * np.pi / 2
|
||||||
|
data = Points(x=self.x[self.mask], y=y)
|
||||||
|
data.update(self.meta)
|
||||||
|
return data
|
6
nmreval/data/dsc.py
Normal file
6
nmreval/data/dsc.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from .points import Points
|
||||||
|
|
||||||
|
|
||||||
|
class DSC(Points):
|
||||||
|
def __init__(self, x, y, **kwargs):
|
||||||
|
super().__init__(x, y, **kwargs)
|
179
nmreval/data/nmr.py
Normal file
179
nmreval/data/nmr.py
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
import warnings
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from .signals import Signal
|
||||||
|
|
||||||
|
|
||||||
|
class FID(Signal):
|
||||||
|
def __init__(self, x, y, **kwargs):
|
||||||
|
super().__init__(x, y, **kwargs)
|
||||||
|
|
||||||
|
self.meta['apod'] = []
|
||||||
|
self.meta['zf'] = 0
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"FID: {self.name}"
|
||||||
|
|
||||||
|
def baseline(self, percentage=0.12):
|
||||||
|
self._y -= self._y[int(-percentage * self.length):].mean()
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def apod(self, p, method=None):
|
||||||
|
try:
|
||||||
|
self._y *= method.apod(self._x, *p)
|
||||||
|
self.meta['apod'].append((str(method), p))
|
||||||
|
except KeyError:
|
||||||
|
print(f'Unknown apodization {method}')
|
||||||
|
|
||||||
|
def zerofill(self, pad: int = 1):
|
||||||
|
_max_x = self._x.max()
|
||||||
|
|
||||||
|
factor = 2**pad
|
||||||
|
if factor < 1:
|
||||||
|
self._x = self._x[:int(self.length*factor)]
|
||||||
|
self._y = self._y[:int(self.length*factor)]
|
||||||
|
self._y_err = self._y_err[:int(self.length*factor)]
|
||||||
|
self.mask = self.mask[:int(self.length*factor)]
|
||||||
|
|
||||||
|
elif factor > 1:
|
||||||
|
add_length = int((factor-1) * self.length)
|
||||||
|
self._y = np.concatenate((self._y, np.zeros(add_length)))
|
||||||
|
self._y_err = np.concatenate((self._y_err, np.zeros(add_length)))
|
||||||
|
self.mask = np.concatenate((self.mask, np.ones(add_length, dtype=bool)))
|
||||||
|
|
||||||
|
_temp_x = np.arange(1, add_length+1) * self.dx + np.max(self._x)
|
||||||
|
self._x = np.concatenate((self._x, _temp_x))
|
||||||
|
|
||||||
|
self.meta['zf'] += pad
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def fourier(self):
|
||||||
|
ft = np.fft.fftshift(np.fft.fft(self._y)) / self.dx
|
||||||
|
freq = np.fft.fftshift(np.fft.fftfreq(self.length, self.dx))
|
||||||
|
|
||||||
|
spec = Spectrum(freq, ft, dx=self.dx)
|
||||||
|
spec.update(self.meta)
|
||||||
|
|
||||||
|
return spec
|
||||||
|
|
||||||
|
def fft_depake(self, scale: bool = False):
|
||||||
|
"""
|
||||||
|
Calculate deconvoluted Pake spectra
|
||||||
|
M.A. McCabe, S.R. Wassail:
|
||||||
|
Rapid deconvolution of NMR powder spectra by weighted fast Fourier transformation,
|
||||||
|
SSNMR (1997), Vol.10, Nr.1-2, pp. 53-61,
|
||||||
|
"""
|
||||||
|
_y = self._y + 0
|
||||||
|
# Perform FFT depaking
|
||||||
|
_y *= np.sqrt(self._x)
|
||||||
|
|
||||||
|
# built halves
|
||||||
|
right = np.fft.fftshift(np.fft.fft(_y)) * (1 + 1j)
|
||||||
|
left = np.fft.fftshift(np.fft.fft(_y)) * (1 - 1j)
|
||||||
|
|
||||||
|
freq = np.fft.fftshift(np.fft.fftfreq(self.length, self.dx))
|
||||||
|
|
||||||
|
if scale:
|
||||||
|
# fourier transform should be multiplied with \sqrt(|omega|)
|
||||||
|
# but lines at omega=0 are suppressed, so sometimes not a good idea
|
||||||
|
right *= np.sqrt(np.abs(freq))
|
||||||
|
left *= np.sqrt(np.abs(freq))
|
||||||
|
|
||||||
|
# built depaked spectrum
|
||||||
|
new_spc = np.concatenate([left[:(self.length//2)], right[(self.length//2):]])
|
||||||
|
|
||||||
|
spec = Spectrum(2*freq, new_spc, dx=self.dx)
|
||||||
|
spec.update(self.meta)
|
||||||
|
|
||||||
|
return spec
|
||||||
|
|
||||||
|
def convert(self):
|
||||||
|
spec = Spectrum(self._x, self._y, dx=self.dx)
|
||||||
|
self.update(self.meta)
|
||||||
|
|
||||||
|
return spec
|
||||||
|
|
||||||
|
def _calc_noise(self):
|
||||||
|
# noise per channel, so divide by sqrt(2)
|
||||||
|
self._y_err = np.std(self._y[-int(0.1*self.length):])/1.41
|
||||||
|
return self._y_err * np.ones(self.length)
|
||||||
|
|
||||||
|
def shift(self, points: Union[str, float], mode: str = 'pts'):
|
||||||
|
"""
|
||||||
|
|
||||||
|
Args:
|
||||||
|
points : shift value,
|
||||||
|
mode (str):
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
if mode == 'pts':
|
||||||
|
super().shift(points)
|
||||||
|
else:
|
||||||
|
pts = int(points//self.dx)
|
||||||
|
super().shift(pts)
|
||||||
|
|
||||||
|
|
||||||
|
class Spectrum(Signal):
|
||||||
|
def __init__(self, x, y, dx=None, **kwargs):
|
||||||
|
super().__init__(x, y, **kwargs)
|
||||||
|
if dx is None:
|
||||||
|
if 2 * abs(self._x[0])/len(self._x) - abs(self._x[1]-self._x[0]) < 1e-9:
|
||||||
|
self.dx = 1/(2 * abs(self._x[0]))
|
||||||
|
else:
|
||||||
|
self.dx = 1
|
||||||
|
else:
|
||||||
|
self.dx = dx
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"Spectrum: {self.name}"
|
||||||
|
|
||||||
|
def baseline(self, percentage: float = 0.12):
|
||||||
|
corr = np.mean([self._y[int(-percentage*self.length):], self._y[:int(percentage*self.length)]])
|
||||||
|
self._y -= corr
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def fourier(self):
|
||||||
|
ft = np.fft.ifft(np.fft.ifftshift(self._y * self.dx))
|
||||||
|
t = np.arange(len(ft))*self.dx
|
||||||
|
shifted = np.fft.ifftshift(self._x)[0]
|
||||||
|
if shifted != 0:
|
||||||
|
warnings.warn(f'Shift of {shifted}: Spectrum is not zero-centered and FFT may give wrong results!')
|
||||||
|
ft *= np.exp(1j * shifted * 2*np.pi*t)
|
||||||
|
|
||||||
|
fid = FID(t, ft)
|
||||||
|
fid.update(self.meta)
|
||||||
|
|
||||||
|
return fid
|
||||||
|
|
||||||
|
def convert(self):
|
||||||
|
fid = FID(self._x, self._y)
|
||||||
|
fid.update(self.meta)
|
||||||
|
|
||||||
|
return fid
|
||||||
|
|
||||||
|
def _calc_noise(self):
|
||||||
|
step = int(0.05 * self.length)
|
||||||
|
start = np.argmin(abs(self._x - max(self._x.min(), -2e5)))
|
||||||
|
stop = np.argmin(abs(self._x - min(self._x.max(), 2e5)))
|
||||||
|
if start > stop:
|
||||||
|
stop, start = start, stop
|
||||||
|
stop -= step
|
||||||
|
self._y_err = np.inf
|
||||||
|
for i in range(start, stop):
|
||||||
|
# scan regions to find minimum noise (undisturbed by signals)
|
||||||
|
self._y_err = min(np.std(self._y[i:i + step])/np.sqrt(2), self._y_err)
|
||||||
|
|
||||||
|
return self._y_err * np.ones(self.length)
|
||||||
|
|
||||||
|
def shift(self, points, mode='pts'):
|
||||||
|
if mode == 'pts':
|
||||||
|
super().shift(points)
|
||||||
|
else:
|
||||||
|
return self
|
665
nmreval/data/points.py
Normal file
665
nmreval/data/points.py
Normal file
@ -0,0 +1,665 @@
|
|||||||
|
import copy
|
||||||
|
from numbers import Number, Real
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any, List, Optional, Tuple, TypeVar, Union
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
try:
|
||||||
|
from scipy.integrate import simpson, cumulative_trapezoid
|
||||||
|
except ImportError:
|
||||||
|
from scipy.integrate import simps as simpson, cumtrapz as cumulative_trapezoid
|
||||||
|
|
||||||
|
from ..lib.utils import ArrayLike
|
||||||
|
from ..utils import NUMBER_RE
|
||||||
|
|
||||||
|
PointLike = TypeVar('PointLike', bound='Points')
|
||||||
|
|
||||||
|
"""
|
||||||
|
This is a test for all and everything
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class Points:
|
||||||
|
"""
|
||||||
|
Base class for all datatypes
|
||||||
|
|
||||||
|
Args:
|
||||||
|
x (array_like): x values
|
||||||
|
y (array_like): y values
|
||||||
|
y_err (array_like, optional): errors
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __init__(self, x: ArrayLike, y: ArrayLike, y_err: Optional[ArrayLike] = None, **kwargs: Any):
|
||||||
|
|
||||||
|
self._x, self._y, self._y_err, self.mask = self._prepare_xy(x, y, y_err=y_err)
|
||||||
|
|
||||||
|
name = str(kwargs.pop('name', ''))
|
||||||
|
value = kwargs.pop('value', None)
|
||||||
|
self.meta = {
|
||||||
|
'group': '',
|
||||||
|
'name': name.split('/')[-1]
|
||||||
|
}
|
||||||
|
self.meta.update(kwargs)
|
||||||
|
|
||||||
|
if isinstance(value, str):
|
||||||
|
for m in NUMBER_RE.finditer(value):
|
||||||
|
value = float(m.group().replace('p', '.'))
|
||||||
|
|
||||||
|
try:
|
||||||
|
value = float(value)
|
||||||
|
except ValueError:
|
||||||
|
value = None
|
||||||
|
|
||||||
|
if value is None:
|
||||||
|
for m in NUMBER_RE.finditer(name):
|
||||||
|
value = float(m.group().replace('p', '.'))
|
||||||
|
if not value:
|
||||||
|
value = 0.0
|
||||||
|
|
||||||
|
self.meta['value'] = value
|
||||||
|
if self.name == '':
|
||||||
|
self.name = str(value)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _prepare_xy(x: ArrayLike, y: ArrayLike, y_err: Optional[ArrayLike] = None):
|
||||||
|
x = np.atleast_1d(x).astype(float)
|
||||||
|
if x.ndim > 1:
|
||||||
|
raise TypeError('x axis cannot be multidimensional')
|
||||||
|
|
||||||
|
y = np.atleast_1d(y)
|
||||||
|
if not np.iscomplexobj(y):
|
||||||
|
y = y.astype(float)
|
||||||
|
|
||||||
|
if x.shape != y.shape:
|
||||||
|
# remove ugly 1-length dims
|
||||||
|
x = np.squeeze(x)
|
||||||
|
y = np.squeeze(y)
|
||||||
|
if x.shape != y.shape:
|
||||||
|
raise ValueError(f'x ({x.shape}) and y ({y.shape}) have different shapes')
|
||||||
|
|
||||||
|
mask = np.ones_like(x, dtype=bool)
|
||||||
|
|
||||||
|
if y_err is None:
|
||||||
|
y_err = np.zeros(y.shape, dtype=float)
|
||||||
|
|
||||||
|
elif isinstance(y_err, Real):
|
||||||
|
y_err = np.ones(y.shape, dtype=float) * y_err
|
||||||
|
else:
|
||||||
|
y_err = np.atleast_1d(y_err)
|
||||||
|
if y_err.shape != y.shape:
|
||||||
|
raise ValueError(f'y_err ({y_err.shape}) and y ({y.shape}) have different shapes')
|
||||||
|
|
||||||
|
return x, y, y_err, mask
|
||||||
|
|
||||||
|
@property
|
||||||
|
def x(self) -> np.ndarray:
|
||||||
|
return self._x
|
||||||
|
|
||||||
|
@x.setter
|
||||||
|
def x(self, value: ArrayLike):
|
||||||
|
value = np.asarray(value, dtype=float)
|
||||||
|
if value.shape == self._x.shape:
|
||||||
|
self._x = value
|
||||||
|
elif value.shape == self._x[self.mask].shape:
|
||||||
|
self._x = value
|
||||||
|
self._y = self._y[self.mask]
|
||||||
|
self._y_err = self._y_err[self.mask]
|
||||||
|
else:
|
||||||
|
raise ValueError('Shape mismatch in setting x')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def y(self) -> np.ndarray:
|
||||||
|
return self._y
|
||||||
|
|
||||||
|
@y.setter
|
||||||
|
def y(self, value: ArrayLike):
|
||||||
|
"""
|
||||||
|
Set new y values. If the length of the new array equals that of original y including masked points
|
||||||
|
this is equivalent to a simple assignment. If the length equals the masked points then masked points are
|
||||||
|
discarded.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value: array of the same length as full or masked y
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
value = np.asarray(value, dtype=self._y.dtype)
|
||||||
|
if value.shape == self._y.shape:
|
||||||
|
self._y = value
|
||||||
|
elif value.shape == self._y[self.mask].shape:
|
||||||
|
self._y[self.mask] = value
|
||||||
|
self._x = self._x[self.mask]
|
||||||
|
self._y_err = self._y_err[self.mask]
|
||||||
|
else:
|
||||||
|
raise ValueError('Shape mismatch in setting y')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def y_err(self) -> np.ndarray:
|
||||||
|
return self._y_err
|
||||||
|
|
||||||
|
@y_err.setter
|
||||||
|
def y_err(self, value: ArrayLike):
|
||||||
|
value = np.asarray(value, dtype=float)
|
||||||
|
if value.shape == self._y_err.shape:
|
||||||
|
self._y_err = value
|
||||||
|
elif value.shape == self._y_err[self.mask].shape:
|
||||||
|
self._y[self.mask] = value
|
||||||
|
else:
|
||||||
|
raise ValueError('Shape mismatch in setting y_err')
|
||||||
|
|
||||||
|
def __len__(self) -> int:
|
||||||
|
return len(self._x[self.mask])
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
return f'Point: {self.name}'
|
||||||
|
|
||||||
|
def __getitem__(self, item: str) -> Any:
|
||||||
|
try:
|
||||||
|
return self.meta[item]
|
||||||
|
except KeyError:
|
||||||
|
KeyError(f'{item} not found')
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any):
|
||||||
|
self.meta[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str):
|
||||||
|
del self.meta[key]
|
||||||
|
|
||||||
|
def update(self, opts: dict) -> None:
|
||||||
|
"""
|
||||||
|
Update metadata
|
||||||
|
|
||||||
|
Args:
|
||||||
|
opts:
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
self.meta.update(opts)
|
||||||
|
|
||||||
|
def __lshift__(self, other):
|
||||||
|
if isinstance(other, Real):
|
||||||
|
_tempx = self._x - other
|
||||||
|
ret = type(self)(_tempx, self._y)
|
||||||
|
self.update(self.meta)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
else:
|
||||||
|
raise TypeError(f'{other} is not a number')
|
||||||
|
|
||||||
|
def __rshift__(self, other):
|
||||||
|
return self.__lshift__(-other)
|
||||||
|
|
||||||
|
def __ilshift__(self, other):
|
||||||
|
if isinstance(other, Real):
|
||||||
|
self._x -= other
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
raise TypeError(f'{other} is not a number')
|
||||||
|
|
||||||
|
def __irshift__(self, other):
|
||||||
|
return self.__ilshift__(-other)
|
||||||
|
|
||||||
|
def __add__(self, other):
|
||||||
|
"""
|
||||||
|
Implements self + other
|
||||||
|
"""
|
||||||
|
if isinstance(other, Number):
|
||||||
|
_tempy = self._y + other
|
||||||
|
ret = type(self)(self._x, _tempy)
|
||||||
|
ret.update(self.meta)
|
||||||
|
return ret
|
||||||
|
elif isinstance(other, self.__class__):
|
||||||
|
if np.equal(self._x, other.x).all():
|
||||||
|
_tempy = self._y + other.y
|
||||||
|
ret = type(self)(self._x, _tempy)
|
||||||
|
ret.update(self.meta)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
else:
|
||||||
|
raise ValueError('Objects have different x values')
|
||||||
|
|
||||||
|
def __radd__(self, other):
|
||||||
|
"""
|
||||||
|
Implements other + self
|
||||||
|
"""
|
||||||
|
return self.__add__(other)
|
||||||
|
|
||||||
|
def __iadd__(self, other):
|
||||||
|
"""
|
||||||
|
Implements self += other
|
||||||
|
"""
|
||||||
|
if isinstance(other, Number):
|
||||||
|
self._y += other
|
||||||
|
return self
|
||||||
|
elif isinstance(other, self.__class__):
|
||||||
|
# restrict to same x values
|
||||||
|
if np.equal(self._x, other.x).all():
|
||||||
|
self._y += other.y
|
||||||
|
else:
|
||||||
|
raise ValueError('Objects have different x values')
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __neg__(self):
|
||||||
|
"""
|
||||||
|
Implements -self
|
||||||
|
"""
|
||||||
|
ret = type(self)(self._x, self._y * (-1))
|
||||||
|
ret.update(self.meta)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
@property
|
||||||
|
def value(self):
|
||||||
|
return self.meta['value']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def group(self):
|
||||||
|
return self.meta['group']
|
||||||
|
|
||||||
|
@group.setter
|
||||||
|
def group(self, value: str):
|
||||||
|
self.meta['group'] = str(value)
|
||||||
|
|
||||||
|
@value.setter
|
||||||
|
def value(self, value: float):
|
||||||
|
self.meta['value'] = float(value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
return self.meta['name']
|
||||||
|
|
||||||
|
@name.setter
|
||||||
|
def name(self, value):
|
||||||
|
self.meta['name'] = str(value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def length(self):
|
||||||
|
return len(self._x)
|
||||||
|
|
||||||
|
def points(self, idx: Optional[list] = None, special: Optional[str] = None,
|
||||||
|
avg_range: Tuple[int, int] = (0, 0), avg_mode: str = 'mean',
|
||||||
|
pts: Optional[list] = None) -> List[tuple]:
|
||||||
|
"""
|
||||||
|
Return (x, y) values at specific positions.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
idx (list, optional) : List of indexes to evaluate.
|
||||||
|
special (str, {'max', 'min', 'absmax', 'absmin'}, optional) :
|
||||||
|
Special positions to extract.
|
||||||
|
|
||||||
|
`max` : Selects position of the maximum of y, or real part if y is complex.
|
||||||
|
|
||||||
|
'min' : Selects position of the minimum of y, or real part if y is complex.
|
||||||
|
|
||||||
|
'absmax' : Selects position at the maximum of the absolute value of y.
|
||||||
|
|
||||||
|
'absmin' : Selects position at the minimum of the absolute value of y.
|
||||||
|
|
||||||
|
avg_range (tuple of int) :
|
||||||
|
Region for average of y values. Tuple (a, b) uses ``y[i-a:i+b+1]`` around index `i`. Default is (0, 0).
|
||||||
|
avg_mode (str {'mean', 'sum', 'integral'} , optional) :
|
||||||
|
Averaging type
|
||||||
|
|
||||||
|
`mean` : Arithmetic average
|
||||||
|
|
||||||
|
`sum`: Sum over y values
|
||||||
|
|
||||||
|
'integral`: Integration over range using Simpson's rule
|
||||||
|
|
||||||
|
pts (list, optional) :
|
||||||
|
If given, points will be appended.
|
||||||
|
|
||||||
|
Returns :
|
||||||
|
list of tuples (x, y, y_err)
|
||||||
|
"""
|
||||||
|
|
||||||
|
if (idx is None) and (special is None):
|
||||||
|
raise ValueError('Either `idx` or `special` must be given')
|
||||||
|
|
||||||
|
if avg_mode not in ['mean', 'sum', 'integral']:
|
||||||
|
raise ValueError(f'Parameter `avg_mode` is `mean`, `sum`, `integral`, not `{avg_mode}`' )
|
||||||
|
|
||||||
|
if pts is None:
|
||||||
|
pts = []
|
||||||
|
|
||||||
|
for x in idx:
|
||||||
|
if isinstance(x, tuple):
|
||||||
|
x_idx = np.argmin(np.abs(self._x[self.mask] - (x[0]+x[1])/2))
|
||||||
|
left_b = np.argmin(np.abs(self._x[self.mask] - x[0]))
|
||||||
|
right_b = np.argmin(np.abs(self._x[self.mask] - x[1]))
|
||||||
|
else:
|
||||||
|
x_idx = np.argmin(np.abs(self._x[self.mask]-x))
|
||||||
|
left_b = int(max(0, x_idx - avg_range[0]))
|
||||||
|
right_b = int(min(len(self), x_idx + avg_range[1] + 1))
|
||||||
|
|
||||||
|
if left_b < right_b:
|
||||||
|
pts.append([self._x[x_idx], *self._average(avg_mode, x_idx, left_b, right_b)])
|
||||||
|
else:
|
||||||
|
pts.append([self._x[x_idx], self._y[x_idx], self._y_err[x_idx]])
|
||||||
|
|
||||||
|
if special is not None:
|
||||||
|
if special not in ['max', 'min', 'absmax', 'absmin']:
|
||||||
|
raise ValueError('Parameter "special" must be "max", "min", "absmax", "absmin".')
|
||||||
|
|
||||||
|
if special == 'max':
|
||||||
|
x_idx = np.argmax(self._y.real[self.mask])
|
||||||
|
elif special == 'min':
|
||||||
|
x_idx = np.argmax(self._y.real[self.mask])
|
||||||
|
elif special == 'absmax':
|
||||||
|
x_idx = np.argmax(np.abs(self._y[self.mask]))
|
||||||
|
else:
|
||||||
|
x_idx = np.argmin(np.abs(self._y[self.mask]))
|
||||||
|
|
||||||
|
left_b = int(max(0, x_idx - avg_range[0]))
|
||||||
|
right_b = int(min(len(self), x_idx + avg_range[1] + 1))
|
||||||
|
|
||||||
|
pts.append([self._x[self.mask][x_idx], *self._average(avg_mode, x_idx, left_b, right_b)])
|
||||||
|
|
||||||
|
return pts
|
||||||
|
|
||||||
|
def _average(self, mode: str, idx, left: int, right: int) -> Tuple[float, float]:
|
||||||
|
if mode == 'mean':
|
||||||
|
y_mean = np.mean(self._y[self.mask][left:right].real)
|
||||||
|
y_err = np.linalg.norm(self._y_err[self.mask][left:right]) / (right - left)
|
||||||
|
|
||||||
|
elif mode == 'sum':
|
||||||
|
y_mean = np.sum(self._y[self.mask][left:right].real)
|
||||||
|
y_err = np.linalg.norm(self._y_err[self.mask][left:right])
|
||||||
|
|
||||||
|
elif mode == 'integral':
|
||||||
|
y_mean = simpson(self._y[self.mask][left:right].real, x=self._x[left:right])
|
||||||
|
y_err = np.linalg.norm(cumulative_trapezoid(self._y_err[self.mask][left:right].real, x=self._x[left:right]))
|
||||||
|
|
||||||
|
else:
|
||||||
|
y_mean = self._y[self.mask][idx].real
|
||||||
|
y_err = self._y_err[self.mask][idx]
|
||||||
|
|
||||||
|
return y_mean, y_err
|
||||||
|
|
||||||
|
def concatenate(self, other):
|
||||||
|
"""
|
||||||
|
Add the values of an object of the same
|
||||||
|
|
||||||
|
Args:
|
||||||
|
other: Dataset of same type
|
||||||
|
|
||||||
|
"""
|
||||||
|
if isinstance(other, self.__class__):
|
||||||
|
self._x = np.r_[self._x, other.x]
|
||||||
|
self._y = np.r_[self._y, other.y]
|
||||||
|
self.mask = np.r_[self.mask, other.mask]
|
||||||
|
self._y_err = np.r_[self._y_err, other.y_err]
|
||||||
|
else:
|
||||||
|
raise TypeError(f'{other} is of type {type(other)}')
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def integrate(self, log: bool = False, limits: Tuple[float, float] = None) -> PointLike:
|
||||||
|
new_data = self.copy()
|
||||||
|
|
||||||
|
if limits is not None:
|
||||||
|
new_data.cut(*limits)
|
||||||
|
|
||||||
|
if log:
|
||||||
|
new_data.y = cumulative_trapezoid(y=new_data.y, x=np.log(new_data.x), initial=0)
|
||||||
|
else:
|
||||||
|
new_data.y = cumulative_trapezoid(y=new_data.y, x=new_data.x, initial=0)
|
||||||
|
|
||||||
|
return new_data
|
||||||
|
|
||||||
|
def diff(self, log: bool = False, limits: Optional[Tuple[float, float]] = None) -> PointLike:
|
||||||
|
"""
|
||||||
|
|
||||||
|
Args:
|
||||||
|
log:
|
||||||
|
limits:
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
new_data = self.copy()
|
||||||
|
|
||||||
|
if limits is not None:
|
||||||
|
new_data.cut(*limits)
|
||||||
|
|
||||||
|
if log:
|
||||||
|
new_data.y = np.gradient(new_data.y, np.log(new_data.x))
|
||||||
|
else:
|
||||||
|
new_data.y = np.gradient(new_data.y, new_data.x)
|
||||||
|
|
||||||
|
return new_data
|
||||||
|
|
||||||
|
def magnitude(self) -> PointLike:
|
||||||
|
new_data = self.copy()
|
||||||
|
new_data.y.real = np.abs(self.y)
|
||||||
|
if np.iscomplexobj(new_data.y):
|
||||||
|
new_data.y.imag = 0.
|
||||||
|
|
||||||
|
return new_data
|
||||||
|
|
||||||
|
def copy(self) -> PointLike:
|
||||||
|
"""
|
||||||
|
Copy the object
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A copy of the object
|
||||||
|
"""
|
||||||
|
return copy.deepcopy(self)
|
||||||
|
|
||||||
|
def get_values(self, idx: int) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
|
||||||
|
"""
|
||||||
|
Return values at a given index
|
||||||
|
|
||||||
|
Args:
|
||||||
|
idx (int) : Index value
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Tuple of (`x[idx]`, `y[idx]` , `y_err[idx]`)
|
||||||
|
"""
|
||||||
|
return self._x[idx], self._y[idx], self._y_err[idx]
|
||||||
|
|
||||||
|
def set_values(self, idx: int, value: Union[list, tuple, np.ndarray]) -> PointLike:
|
||||||
|
if not (isinstance(value, (list, tuple, np.ndarray)) and (len(value) in [2, 3])):
|
||||||
|
raise TypeError('Values should be list type of length 2 or 3')
|
||||||
|
|
||||||
|
self._x[idx] = value[0]
|
||||||
|
self._y[idx] = value[1]
|
||||||
|
|
||||||
|
if len(value) == 3:
|
||||||
|
self._y_err[idx] = value[2]
|
||||||
|
else:
|
||||||
|
self._y_err[idx] = 0
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def set_data(self,
|
||||||
|
x: Optional[np.ndarray] = None,
|
||||||
|
y: Optional[np.ndarray] = None,
|
||||||
|
y_err: Optional[np.ndarray] = None) -> PointLike:
|
||||||
|
if x is None:
|
||||||
|
x = self._x
|
||||||
|
if y is None:
|
||||||
|
y = self._y
|
||||||
|
if y_err is not None:
|
||||||
|
y_err = self._y_err
|
||||||
|
|
||||||
|
self._x, self._y, self._y_err, self.mask = self._prepare_xy(x, y, y_err)
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def append(self, x: ArrayLike, y: ArrayLike, y_err: Optional[ArrayLike] = None):
|
||||||
|
x, y, y_err, mask = self._prepare_xy(x, y, y_err)
|
||||||
|
|
||||||
|
self._x = np.r_[self._x, x]
|
||||||
|
self._y = np.r_[self._y, y]
|
||||||
|
self._y_err = np.r_[self._y_err, y_err]
|
||||||
|
self.mask = np.r_[self.mask, mask]
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def remove(self, idx):
|
||||||
|
self._x = np.delete(self._x, idx)
|
||||||
|
self._y = np.delete(self._y, idx)
|
||||||
|
self.mask = np.delete(self.mask, idx)
|
||||||
|
self._y_err = np.delete(self._y_err, idx)
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def cut(self, *limits):
|
||||||
|
if len(limits) != 2:
|
||||||
|
raise ValueError('Two arguments are needed')
|
||||||
|
|
||||||
|
low_lim, high_lim = limits
|
||||||
|
if low_lim is None:
|
||||||
|
low_lim = np.min(self._x)
|
||||||
|
|
||||||
|
if high_lim is None:
|
||||||
|
high_lim = np.max(self._x)
|
||||||
|
|
||||||
|
_mask = np.ma.masked_inside(self._x, low_lim, high_lim).mask
|
||||||
|
|
||||||
|
self._x = self._x[_mask]
|
||||||
|
self._y = self._y[_mask]
|
||||||
|
self._y_err = self._y_err[_mask]
|
||||||
|
self.mask = self.mask[_mask]
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def shift(self, points: int) -> PointLike:
|
||||||
|
"""
|
||||||
|
Move y values `points` indexes, remove invalid indexes and fill remaining with zeros
|
||||||
|
Negative `points` shift to the left, positive `points` shift to the right
|
||||||
|
|
||||||
|
Args:
|
||||||
|
points (int) : shift value
|
||||||
|
|
||||||
|
Example:
|
||||||
|
>>> pts = Points(x=[0., 1., 2., 3.], y=[1., 2., 3., 4.])
|
||||||
|
>>> pts.shift(2)
|
||||||
|
>>> pts.x
|
||||||
|
array([0., 1., 2., 3.])
|
||||||
|
>>> pts.y
|
||||||
|
array([3., 4., 0., 0.])
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The original object with shifted values.
|
||||||
|
"""
|
||||||
|
if points > 0:
|
||||||
|
self._y = np.roll(self._y, -int(points))
|
||||||
|
self._y[-int(points)-1:] = 0
|
||||||
|
else:
|
||||||
|
self._y = np.roll(self._y, int(points))
|
||||||
|
self._y[:-int(points)] = 0
|
||||||
|
|
||||||
|
self.meta['shift'] += points
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def sort(self, axis=0):
|
||||||
|
if axis == 0:
|
||||||
|
sort_order = np.argsort(self._x)
|
||||||
|
else:
|
||||||
|
sort_order = np.argsort(self._y)
|
||||||
|
self._x = self._x[sort_order]
|
||||||
|
self._y = self._y[sort_order]
|
||||||
|
self._y_err = self._y_err[sort_order]
|
||||||
|
self.mask = self.mask[sort_order]
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def normalize(self, mode):
|
||||||
|
if mode == 'first':
|
||||||
|
scale = self._y[0].real
|
||||||
|
elif mode == 'last':
|
||||||
|
scale = self._y[-1].real
|
||||||
|
elif mode == 'max':
|
||||||
|
scale = np.max(self._y.real)
|
||||||
|
elif mode == 'maxabs':
|
||||||
|
scale = np.max(np.abs(self._y))
|
||||||
|
elif mode == 'area':
|
||||||
|
try:
|
||||||
|
from scipy.integrate import simpson
|
||||||
|
except ImportError:
|
||||||
|
from scipy.integrate import simps as simpson
|
||||||
|
scale = simpson(self._y.real, x=self._x)
|
||||||
|
else:
|
||||||
|
raise ValueError(f'Unknown normalize mode {mode}')
|
||||||
|
|
||||||
|
self._y /= scale
|
||||||
|
self._y_err /= scale
|
||||||
|
|
||||||
|
return scale
|
||||||
|
|
||||||
|
def toarray(self, err=True):
|
||||||
|
if np.count_nonzero(self._y_err) == 0 or not err:
|
||||||
|
return np.c_[self._x, self._y]
|
||||||
|
else:
|
||||||
|
return np.c_[self._x, self._y, self._y_err]
|
||||||
|
|
||||||
|
def tohdf(self, hdffile):
|
||||||
|
grp = hdffile
|
||||||
|
grp2_name = self.name
|
||||||
|
|
||||||
|
try:
|
||||||
|
dset = grp.create_dataset(grp2_name, shape=(len(self._x),),
|
||||||
|
dtype=np.dtype([('x', 'f'), ('y', 'f')]),
|
||||||
|
compression='gzip')
|
||||||
|
except RuntimeError:
|
||||||
|
dset = grp[grp2_name]
|
||||||
|
|
||||||
|
dset['x'] = self._x
|
||||||
|
dset['y'] = self._y
|
||||||
|
dset.attrs['TITLE'] = self.group + '/' + self.name
|
||||||
|
dset.attrs['damaris_type'] = 'MeasurementResult'
|
||||||
|
|
||||||
|
def savetxt(self, fname, err=False):
|
||||||
|
path = Path(fname)
|
||||||
|
|
||||||
|
if not path.parent.exists():
|
||||||
|
path.parent.mkdir(parents=True)
|
||||||
|
|
||||||
|
header = []
|
||||||
|
for k, v in self.meta.items():
|
||||||
|
header.append('%s: %s' % (k, str(v)))
|
||||||
|
header = '\n'.join(header)
|
||||||
|
|
||||||
|
if np.all(self.mask):
|
||||||
|
np.savetxt(path, self.toarray(err=err), header=header, fmt='%.10f')
|
||||||
|
else:
|
||||||
|
with path.open('w') as f:
|
||||||
|
f.write(header)
|
||||||
|
for i, l in enumerate(self.toarray(err=err)):
|
||||||
|
if self.mask[i]:
|
||||||
|
f.write('\t'.join(map(str, l.tolist())) + '\n')
|
||||||
|
else:
|
||||||
|
f.write('#' + '\t'.join(map(str, l.tolist())) + '\n')
|
||||||
|
|
||||||
|
def get_state(self) -> dict:
|
||||||
|
ret_dic = {'x': self._x.tolist(),
|
||||||
|
'y': self._y.tolist(),
|
||||||
|
'mask': (np.where(~self.mask)[0]).tolist()}
|
||||||
|
|
||||||
|
if np.all(self._y_err == 0):
|
||||||
|
ret_dic['y_err'] = 0.0
|
||||||
|
else:
|
||||||
|
ret_dic['y_err'] = self._y_err.tolist()
|
||||||
|
|
||||||
|
ret_dic.update(self.meta)
|
||||||
|
|
||||||
|
return ret_dic
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def set_state(cls, state: dict):
|
||||||
|
_x = state.pop('x')
|
||||||
|
_y = state.pop('y')
|
||||||
|
_yerr = state.pop('y_err')
|
||||||
|
data = cls(x=_x, y=_y, y_err=_yerr)
|
||||||
|
_m = state.pop('mask')
|
||||||
|
data.mask[_m] = False
|
||||||
|
data.meta.update(state)
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
100
nmreval/data/signals.py
Normal file
100
nmreval/data/signals.py
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
from .points import Points
|
||||||
|
|
||||||
|
|
||||||
|
class Signal(Points):
|
||||||
|
"""
|
||||||
|
Extension of Points for complex y values.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, x, y, **kwargs):
|
||||||
|
y = np.atleast_1d(y)
|
||||||
|
if (y.ndim == 1) or y.shape[0] == 1:
|
||||||
|
y = y.astype(complex)
|
||||||
|
else:
|
||||||
|
y = y[0, :] + 1j * y[1, :]
|
||||||
|
|
||||||
|
super().__init__(x, y, **kwargs)
|
||||||
|
|
||||||
|
self.dx = kwargs.get('dx', abs(self._x[1] - self._x[0]))
|
||||||
|
self.meta.update({'phase': [], 'shift': 0})
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return 'Signal: ' + self.name
|
||||||
|
|
||||||
|
def swap(self):
|
||||||
|
"""
|
||||||
|
|
||||||
|
Swaps real and imaginary part of y
|
||||||
|
|
||||||
|
"""
|
||||||
|
self._y.real, self._y.imag = self._y.imag, self._y.real
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def phase(self, method: str = 'manual', **kwargs):
|
||||||
|
if method == 'manual':
|
||||||
|
self.manual_phase(**kwargs)
|
||||||
|
elif method == 'simple':
|
||||||
|
self.simple_phase(**kwargs)
|
||||||
|
else:
|
||||||
|
raise KeyError(f'Not implemented method {method}')
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def manual_phase(self, ph0: float = 0., ph1: float = 0., pvt: float = 0):
|
||||||
|
self._y *= np.exp(1j * ph0 * np.pi / 180.)
|
||||||
|
if ph1 != 0:
|
||||||
|
x = (self._x - pvt) / max(self._x)
|
||||||
|
self._y *= np.exp(1j * x * ph1 * np.pi / 180.)
|
||||||
|
self.meta['phase'].append((ph0, ph1, pvt))
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def simple_phase(self, pos: int = 0, avg: int = 0):
|
||||||
|
ph = np.mean(np.angle(self._y)[pos-avg:pos+avg+1])
|
||||||
|
self._y *= np.exp(-1j*ph)
|
||||||
|
|
||||||
|
self.meta['phase'].append((ph, 0, 0))
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def baseline_spline(self, line):
|
||||||
|
self._y -= line
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def divide(self, part):
|
||||||
|
if part:
|
||||||
|
self.cut(0.01*self._x[0], self._x[int(self.length//2)+1])
|
||||||
|
else:
|
||||||
|
self.cut(self._x[int(self.length//2)], 10*self._x[-1])
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
def toarray(self, err=False):
|
||||||
|
if not err or np.all(self._y_err == 0.):
|
||||||
|
return np.c_[self._x, self._y.real, self._y.imag]
|
||||||
|
else:
|
||||||
|
return np.c_[self._x, self._y.real, self._y.imag, self._y_err]
|
||||||
|
|
||||||
|
def tohdf(self, hdffile):
|
||||||
|
grp = hdffile
|
||||||
|
try:
|
||||||
|
grp2 = grp.create_group(self.name)
|
||||||
|
is_empty = True
|
||||||
|
except ValueError:
|
||||||
|
is_empty = False
|
||||||
|
grp2 = grp[self.name]
|
||||||
|
grp2.attrs['damaris_type'] = 'Accumulation'
|
||||||
|
grp2.attrs['TITLE'] = self.group + '/' + self.name
|
||||||
|
if is_empty:
|
||||||
|
grp2.create_dataset('accu_data', data=np.c_[self._y.real, self._y.imag],
|
||||||
|
compression='gzip')
|
||||||
|
idx = grp2.create_dataset('indices', (1,), dtype=np.dtype([('dwelltime', 'f')]))
|
||||||
|
idx['dwelltime'] = self.dx
|
||||||
|
else:
|
||||||
|
grp2['accu_data'][...] = np.c_[self._y.real, self._y.imag]
|
||||||
|
grp2['indices']['dwelltime'] = self.dx
|
7
nmreval/distributions/__init__.py
Normal file
7
nmreval/distributions/__init__.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
from .havriliaknegami import HavriliakNegami
|
||||||
|
from .colecole import ColeCole
|
||||||
|
from .coledavidson import ColeDavidson
|
||||||
|
from .debye import Debye
|
||||||
|
from .kww import KWW
|
||||||
|
from .loggaussian import LogGaussian
|
85
nmreval/distributions/base.py
Normal file
85
nmreval/distributions/base.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import abc
|
||||||
|
from warnings import warn
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class Distribution(abc.ABC):
|
||||||
|
name = 'Abstract distribution'
|
||||||
|
parameter = None
|
||||||
|
bounds = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __repr__(cls):
|
||||||
|
return cls.name
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@abc.abstractmethod
|
||||||
|
def distribution(taus, tau0, *args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@abc.abstractmethod
|
||||||
|
def susceptibility(omega, tau, *args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def specdens(cls, omega, tau, *args):
|
||||||
|
return -cls.susceptibility(omega, tau, *args).imag / omega
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@abc.abstractmethod
|
||||||
|
def correlation(t, tau0, *args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def mean_value(cls, *args, mode='mean'):
|
||||||
|
if mode == 'mean':
|
||||||
|
return cls.mean(*args)
|
||||||
|
if mode == 'logmean':
|
||||||
|
return np.exp(cls.logmean(*args))
|
||||||
|
if mode in ['max', 'peak']:
|
||||||
|
return cls.max(*args)
|
||||||
|
|
||||||
|
return args[0]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def convert(cls, *args, from_='raw', to_='mean'):
|
||||||
|
if from_ == to_:
|
||||||
|
return args[0]
|
||||||
|
|
||||||
|
if from_ == 'raw':
|
||||||
|
return cls.mean_value(*args, mode=to_)
|
||||||
|
else:
|
||||||
|
# makes only sense as long as mean/peak is given by <x> = factor * x
|
||||||
|
factor = cls.mean_value(1, *args[1:], mode=from_)
|
||||||
|
try:
|
||||||
|
raw = args[0] / factor
|
||||||
|
except ZeroDivisionError:
|
||||||
|
raise ZeroDivisionError('Conversion between mean values impossible')
|
||||||
|
|
||||||
|
if to_ == 'raw':
|
||||||
|
return raw
|
||||||
|
else:
|
||||||
|
return cls.mean_value(raw, *args[1:], mode=to_)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def logmean(*args):
|
||||||
|
"""
|
||||||
|
Return mean logarithmic tau
|
||||||
|
|
||||||
|
Args:
|
||||||
|
*args:
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return np.log(args[0])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def mean(*args):
|
||||||
|
return args[0]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def max(*args):
|
||||||
|
return args[0]
|
105
nmreval/distributions/colecole.py
Normal file
105
nmreval/distributions/colecole.py
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
from ..math.mittagleffler import mlf
|
||||||
|
|
||||||
|
|
||||||
|
class ColeCole(Distribution):
|
||||||
|
"""
|
||||||
|
Functions based on Cole-Cole distribution
|
||||||
|
"""
|
||||||
|
name = 'Cole-Cole'
|
||||||
|
parameter = [r'\alpha']
|
||||||
|
bounds = [(0, 1)]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(taus, tau0, alpha):
|
||||||
|
"""
|
||||||
|
Distribution of correlation times
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
G(\ln\\tau) = \\frac{1}{2\pi} \\frac{\\sin(\\pi\\alpha)}{\cosh[\\alpha\ln(\\tau/\\tau_0)] + \cos(\\alpha \pi))}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
taus:
|
||||||
|
tau0:
|
||||||
|
alpha:
|
||||||
|
"""
|
||||||
|
z = np.log(taus/tau0)
|
||||||
|
return np.sin(np.pi*alpha)/(np.cosh(z*alpha) + np.cos(alpha*np.pi))/(2*np.pi)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau, alpha):
|
||||||
|
"""
|
||||||
|
Susceptibility
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\chi(\omega, \\tau, \\alpha) = \\frac{1}{1-(i\omega\\tau_0)^\\alpha}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
omega:
|
||||||
|
tau:
|
||||||
|
alpha:
|
||||||
|
"""
|
||||||
|
_tau = np.atleast_1d(tau)
|
||||||
|
_omega = np.atleast_1d(omega)
|
||||||
|
val = 1/(1+(1j*_omega[:, None]*_tau[None, :])**alpha)
|
||||||
|
return np.conjugate(val).squeeze()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, tau, alpha):
|
||||||
|
"""
|
||||||
|
Spectral density
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
J(\omega, \\tau, \\alpha) = \\frac{\sin(\\alpha\pi/2)(\omega\\tau)^\\alpha}{\omega[1+(\omega\\tau)^{2\\alpha} + 2\\pi\cos(\\alpha\pi/2)(\omega\\tau)^\\alpha]}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
omega:
|
||||||
|
tau:
|
||||||
|
alpha:
|
||||||
|
"""
|
||||||
|
_tau = np.atleast_1d(tau)
|
||||||
|
_omega = np.atleast_1d(omega)
|
||||||
|
omtau = (_omega*_tau)**alpha
|
||||||
|
return np.sin(alpha*np.pi/2) * omtau / (1 + omtau**2 + 2*np.cos(alpha*np.pi/2)*omtau) / omega
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, alpha):
|
||||||
|
"""
|
||||||
|
Correlation function :math:`C(t)`
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
C(t) = E_\\alpha[-(t/\\tau_0)^\\alpha]
|
||||||
|
|
||||||
|
with Mittag-Leffler function :math:`E_a(x)`
|
||||||
|
|
||||||
|
Args:
|
||||||
|
t:
|
||||||
|
tau0:
|
||||||
|
alpha:
|
||||||
|
"""
|
||||||
|
return mlf(-(t/tau0)**alpha, alpha)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
x = np.logspace(-3, 3, num=61)
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(2, 2)
|
||||||
|
ax[0, 0].set_title('Distribution')
|
||||||
|
ax[0, 1].set_title('Correlation func.')
|
||||||
|
ax[1, 0].set_title('Spectral density')
|
||||||
|
ax[1, 1].set_title('Susceptibility')
|
||||||
|
|
||||||
|
for a in [0.4, 0.6, 0.8]:
|
||||||
|
ax[0, 0].loglog(x, ColeCole.distribution(x, 1, a))
|
||||||
|
ax[0, 1].semilogx(x, ColeCole.correlation(x, 1, a))
|
||||||
|
ax[1, 0].loglog(x, ColeCole.specdens(x, 1, a))
|
||||||
|
g = ax[1, 1].loglog(x, ColeCole.susceptibility(x, 1, a).imag)
|
||||||
|
ax[1, 1].loglog(x, ColeCole.susceptibility(x, 1, a).real, '--', color=g[0].get_color())
|
||||||
|
|
||||||
|
fig.tight_layout()
|
||||||
|
|
||||||
|
plt.show()
|
179
nmreval/distributions/coledavidson.py
Normal file
179
nmreval/distributions/coledavidson.py
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
import numbers
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from scipy.special import psi, gammaincc
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
from ..utils.constants import Eu
|
||||||
|
|
||||||
|
|
||||||
|
class ColeDavidson(Distribution):
|
||||||
|
"""
|
||||||
|
Functions based on Cole-Davidson distribution
|
||||||
|
"""
|
||||||
|
name = 'Cole-Davidson'
|
||||||
|
parameter = [r'\gamma']
|
||||||
|
bounds = [(0, 1)]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau, gamma):
|
||||||
|
"""
|
||||||
|
Susceptibility
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\chi(\omega, \\tau, \\gamma) = \\frac{1}{(1-i\omega\\tau_0)^\\gamma}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
omega:
|
||||||
|
tau:
|
||||||
|
gamma:
|
||||||
|
"""
|
||||||
|
return (1/(1+1j*omega*tau)**gamma).conjugate()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, tau,gamma):
|
||||||
|
"""
|
||||||
|
Spectral density
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
J(\omega, \\tau, \\gamma) = \\frac{\sin[\\gamma\\arctan(\\omega\\tau)]}{\omega[1+(\omega\\tau)^2]^{\\gamma/2}}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
omega:
|
||||||
|
tau:
|
||||||
|
gamma:
|
||||||
|
"""
|
||||||
|
gam = gamma
|
||||||
|
_w = np.atleast_1d(omega)
|
||||||
|
_t = np.atleast_1d(tau)
|
||||||
|
omtau = _w[:, None] * _t[None, :]
|
||||||
|
|
||||||
|
ret_val = np.sin(gam*np.arctan2(omtau, 1)) / (1 + omtau**2)**(gam/2.) / _w[:, None]
|
||||||
|
ret_val[_w == 0, :] = gam*_t
|
||||||
|
|
||||||
|
return np.squeeze(ret_val)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def mean(tau, gamma):
|
||||||
|
"""
|
||||||
|
Mean tau
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\\langle \\tau \\rangle = \\gamma \\tau
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tau:
|
||||||
|
gamma:
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
return tau*gamma
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def logmean(tau, gamma):
|
||||||
|
"""
|
||||||
|
Mean logarithm of tau
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\\langle \ln \\tau \\rangle = \ln\\tau + \psi(\gamma) + \mathrm{Eu}
|
||||||
|
|
||||||
|
with the Euler's constant :math:`\mathrm{Eu} \\approx 0.57721567\ldots` and the digamma function
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\psi(x) = \\frac{d}{dx} \ln(\Gamma(x))
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tau:
|
||||||
|
gamma:
|
||||||
|
|
||||||
|
References:
|
||||||
|
R. Zorn: Logartihmic moments of relaxation time distribution. J. Chem. Phys. (2002). http://dx.doi.org/10.1063/1.1446035
|
||||||
|
|
||||||
|
"""
|
||||||
|
return np.log(tau) + psi(gamma) + Eu
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def max(tau, gamma):
|
||||||
|
"""
|
||||||
|
Calculate :math:`\\tau_\\text{peak}`, i.e. the inverse of the maximum frequency of the imaginary part of the susceptibility
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\\tau_\\text{peak} = \\frac{\\tau}{\\tan[\\pi/(2\gamma+2)]}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tau:
|
||||||
|
gamma:
|
||||||
|
|
||||||
|
References:
|
||||||
|
R. Dı́az-Calleja: Comment on the Maximum in the Loss Permittivity for the Havriliak-Negami Equation.
|
||||||
|
Macromolecules (2000). https://doi.org/10.1021/ma991082i
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
return tau/np.tan(np.pi/(2*gamma+2))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(tau, tau0, gamma):
|
||||||
|
"""
|
||||||
|
Distribution of correlation times
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
G(\ln\\tau) =
|
||||||
|
\\begin{cases}
|
||||||
|
\\frac{\sin(\pi\gamma)}{\pi} \\Big(\\frac{\\tau}{\\tau_0 - \\tau}\\Big)^\gamma & \\tau < \\tau_0 \\\\
|
||||||
|
0 & \\text{else}
|
||||||
|
\end{cases}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tau:
|
||||||
|
tau0:
|
||||||
|
gamma:
|
||||||
|
"""
|
||||||
|
|
||||||
|
if isinstance(tau, numbers.Number):
|
||||||
|
return np.sin(np.pi*gamma) / np.pi * (1 / (tau0/tau - 1))**gamma if tau < tau0 else 0
|
||||||
|
|
||||||
|
ret_val = np.zeros_like(tau)
|
||||||
|
ret_val[tau < tau0] = np.sin(np.pi*gamma) / np.pi * (1 / (tau0/tau[tau < tau0] - 1))**gamma
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, gamma):
|
||||||
|
r"""
|
||||||
|
Correlation function
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
C(t, \tau_0, \gamma) = \frac{\Gamma(\gamma, t/\tau_0)}{\Gamma(\gamma)}
|
||||||
|
|
||||||
|
with incomplete Gamma function
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\Gamma(\gamma, t/\tau_0) = \frac{1}{\Gamma(\gamma)}\int_{t/\tau_0}^\infty x^{\gamma-1}\text{e}^{-x}\,\mathrm{d}x
|
||||||
|
|
||||||
|
Args:
|
||||||
|
t:
|
||||||
|
tau0:
|
||||||
|
gamma:
|
||||||
|
|
||||||
|
References:
|
||||||
|
R. Hilfer: H-function representations for stretched exponential relaxation and non-Debye susceptibilities in glassy systems. Phys. Rev. E (2002) https://doi.org/10.1103/PhysRevE.65.061510
|
||||||
|
|
||||||
|
"""
|
||||||
|
return gammaincc(gamma, t / tau0)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
x = np.logspace(-3, 3, num=61)
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(2, 2)
|
||||||
|
|
||||||
|
for g in [0.4, 0.6, 0.8]:
|
||||||
|
ax[0, 0].loglog(x, ColeDavidson.distribution(x, 1, g))
|
||||||
|
ax[0, 1].semilogx(x, ColeDavidson.correlation(x, 1, g))
|
||||||
|
ax[1, 0].loglog(x, ColeDavidson.specdens(x, 1, g))
|
||||||
|
gr = ax[1, 1].loglog(x, ColeDavidson.susceptibility(x, 1, g).imag)
|
||||||
|
ax[1, 1].loglog(x, ColeDavidson.susceptibility(x, 1, g).real, '--', color=gr[0].get_color())
|
||||||
|
plt.show()
|
30
nmreval/distributions/debye.py
Normal file
30
nmreval/distributions/debye.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import numbers
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
|
||||||
|
|
||||||
|
class Debye(Distribution):
|
||||||
|
name = 'Debye'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, *args):
|
||||||
|
return np.exp(-t/tau0)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau0, *args):
|
||||||
|
return 1/(1 + 1j*omega*tau0)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, tau0, *args):
|
||||||
|
return tau0 / (1 + (omega*tau0)**2)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(taus, tau0, *args):
|
||||||
|
if isinstance(taus, numbers.Number):
|
||||||
|
return 1 if taus == tau0 else 0
|
||||||
|
|
||||||
|
ret_val = np.zeros_like(taus)
|
||||||
|
ret_val[np.argmin(abs(taus - tau0))] = 1
|
||||||
|
return ret_val
|
124
nmreval/distributions/energy.py
Normal file
124
nmreval/distributions/energy.py
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
from itertools import product
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from scipy.integrate import simps as simpson
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
from ..utils.constants import kB
|
||||||
|
|
||||||
|
|
||||||
|
class EnergyBarriers(Distribution):
|
||||||
|
name = 'Energy barriers'
|
||||||
|
parameter = [r'\tau_{0}', r'E_{m}', r'\Delta E']
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(tau, temperature, *args):
|
||||||
|
t0, em, sigma = args
|
||||||
|
m = np.exp(em / (kB * temperature)) * t0
|
||||||
|
return temperature * np.exp(-0.5 * (np.log(tau/m)*kB*temperature/sigma)**2) / np.sqrt(2*np.pi)/sigma
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def rate(t0, e_a, te):
|
||||||
|
return np.exp(-e_a / (kB * te)) / t0
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def energydistribution(e_a, mu, sigma):
|
||||||
|
return np.exp(-0.5 * ((mu-e_a) / sigma) ** 2) / (np.sqrt(2 * np.pi) * sigma)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, temperature, *args):
|
||||||
|
tau0, e_m, e_b = args
|
||||||
|
|
||||||
|
def integrand(e_a, ti, t0, mu, sigma, te):
|
||||||
|
# correlation time would go to inf for higher energies, so we use rate
|
||||||
|
return np.exp(-ti*EnergyBarriers.rate(t0, e_a, te)) * EnergyBarriers.energydistribution(e_a, mu, sigma)
|
||||||
|
|
||||||
|
t = np.atleast_1d(t)
|
||||||
|
temperature = np.atleast_1d(temperature)
|
||||||
|
|
||||||
|
e_axis = np.linspace(max(0, e_m-50*e_b), e_m+50*e_b, num=5001)
|
||||||
|
|
||||||
|
ret_val = np.array([simpson(integrand(e_axis, o, tau0, e_m, e_b, tt), e_axis)
|
||||||
|
for o in t for tt in temperature])
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, temperature, *args):
|
||||||
|
# in contrast to other spectral densities, it's omega and temperature
|
||||||
|
tau0, e_m, e_b = args
|
||||||
|
|
||||||
|
def integrand_real(e_a, w, t0, mu, sigma, t):
|
||||||
|
r = EnergyBarriers.rate(t0, e_a, t)
|
||||||
|
return 1/(r**2 + w**2) * EnergyBarriers.energydistribution(e_a, mu, sigma)
|
||||||
|
|
||||||
|
def integrand_imag(e_a, w, t0, mu, sigma, t):
|
||||||
|
r = EnergyBarriers.rate(t0, e_a, t)
|
||||||
|
return w*r/(r**2 + w**2) * EnergyBarriers.energydistribution(e_a, mu, sigma)
|
||||||
|
|
||||||
|
omega = np.atleast_1d(omega)
|
||||||
|
temperature = np.atleast_1d(temperature)
|
||||||
|
|
||||||
|
e_axis = np.linspace(max(0, e_m-50*e_b), e_m+50*e_b, num=5001)
|
||||||
|
ret_val = []
|
||||||
|
for o, tt in product(omega, temperature):
|
||||||
|
ret_val.append(simpson(integrand_real(e_axis, o, tau0, e_m, e_b, tt), e_axis) -
|
||||||
|
1j * simpson(integrand_imag(e_axis, o, tau0, e_m, e_b, tt), e_axis))
|
||||||
|
|
||||||
|
return np.array(ret_val)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, temperature, *args):
|
||||||
|
# in contrast to other spectral densities, it's omega and temperature
|
||||||
|
tau0, e_m, e_b = args
|
||||||
|
|
||||||
|
def integrand(e_a, w, t0, mu, sigma, t):
|
||||||
|
r = EnergyBarriers.rate(t0, e_a, t)
|
||||||
|
return r/(r**2 + w**2) * EnergyBarriers.energydistribution(e_a, mu, sigma)
|
||||||
|
|
||||||
|
omega = np.atleast_1d(omega)
|
||||||
|
temperature = np.atleast_1d(temperature)
|
||||||
|
|
||||||
|
e_axis = np.linspace(max(0, e_m-50*e_b), e_m+50*e_b, num=5001)
|
||||||
|
|
||||||
|
ret_val = np.array([simpson(integrand(e_axis, o, tau0, e_m, e_b, tt), e_axis)
|
||||||
|
for o in omega for tt in temperature])
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def mean(*args):
|
||||||
|
return args[1]*np.exp(args[2]/(kB*args[0]))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def logmean(*args):
|
||||||
|
return args[1] + args[2] / (kB * args[0])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def max(*args):
|
||||||
|
return args[1] * np.exp(args[2] / (kB * args[0]))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
x = np.logspace(-12, 12, num=601)
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(2, 2)
|
||||||
|
ax[0, 0].set_title('Distribution')
|
||||||
|
ax[0, 1].set_title('Correlation func.')
|
||||||
|
ax[1, 0].set_title('Spectral density')
|
||||||
|
ax[1, 1].set_title('Susceptibility')
|
||||||
|
|
||||||
|
p = [1e-12, 0.3, 0.02]
|
||||||
|
|
||||||
|
for a in [100, 150, 300]:
|
||||||
|
ax[0, 0].semilogx(x, EnergyBarriers.distribution(x, a, *p))
|
||||||
|
ax[0, 1].semilogx(x, EnergyBarriers.correlation(x, a, *p))
|
||||||
|
ax[1, 0].loglog(x, EnergyBarriers.specdens(x, a, *p))
|
||||||
|
g = ax[1, 1].loglog(x, -EnergyBarriers.susceptibility(x, a, *p).imag)
|
||||||
|
ax[1, 1].loglog(x, EnergyBarriers.susceptibility(x, a, *p).real, '--', color=g[0].get_color())
|
||||||
|
|
||||||
|
fig.tight_layout()
|
||||||
|
|
||||||
|
plt.show()
|
111
nmreval/distributions/gengamma.py
Normal file
111
nmreval/distributions/gengamma.py
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
from typing import Union
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from scipy.integrate import simps
|
||||||
|
from scipy.special import gammaln
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
|
||||||
|
|
||||||
|
class GGAlpha(Distribution):
|
||||||
|
name = r'General \Gamma (\alpha-process)'
|
||||||
|
parameter = [r'\alpha', r'\beta']
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, *args):
|
||||||
|
logtau0 = np.log(tau0)
|
||||||
|
logtau = np.linspace(logtau0-20, logtau0+20, num=4001)
|
||||||
|
taus = np.exp(logtau)
|
||||||
|
gtau = GGAlpha.distribution(taus, tau0, *args)
|
||||||
|
ret_val = np.array([simps(np.exp(-xvals/taus)*gtau, logtau) for xvals in t])
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau0, *args):
|
||||||
|
logtau0 = np.log(tau0)
|
||||||
|
logtau = np.linspace(logtau0 - 20, logtau0 + 20, num=4001)
|
||||||
|
taus = np.exp(logtau)
|
||||||
|
gtau = GGAlpha.distribution(taus, tau0, *args)
|
||||||
|
ret_val = np.array([simps(1/(1+1j*xvals*taus) * gtau, logtau) for xvals in omega])
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(taus: Union[float, np.ndarray], tau: float, *args) -> Union[float, np.ndarray]:
|
||||||
|
alpha, beta = args
|
||||||
|
b_to_a = beta / alpha
|
||||||
|
norm = np.exp(gammaln(b_to_a) - b_to_a * np.log(b_to_a)) / alpha
|
||||||
|
t_to_t0 = taus / tau
|
||||||
|
ret_val = np.exp(-b_to_a * t_to_t0 ** alpha) * t_to_t0 ** beta
|
||||||
|
|
||||||
|
return ret_val / norm
|
||||||
|
|
||||||
|
|
||||||
|
class GGAlphaEW(Distribution):
|
||||||
|
name = r'General \Gamma (\alpha-process + EW)'
|
||||||
|
parameter = [r'\alpha', r'\beta']
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, *args):
|
||||||
|
logtau0 = np.log(tau0)
|
||||||
|
logtau = np.linspace(logtau0-20, logtau0+20, num=4001)
|
||||||
|
taus = np.exp(logtau)
|
||||||
|
gtau = GGAlphaEW.distribution(taus, tau0, *args)
|
||||||
|
# wir integrieren ueber lntau, nicht tau
|
||||||
|
ret_val = np.array([simps(np.exp(-xvals/taus)*gtau, logtau) for xvals in t])
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau0, *args):
|
||||||
|
logtau0 = np.log(tau0)
|
||||||
|
logtau = np.linspace(logtau0 - 20, logtau0 + 20, num=4001)
|
||||||
|
taus = np.exp(logtau)
|
||||||
|
gtau = GGAlphaEW.distribution(taus, tau0, *args)
|
||||||
|
ret_val = np.array([simps(1/(1+1j*xvals*taus) * gtau, logtau) for xvals in omega])
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(tau: Union[float, np.ndarray], tau0: float, *args) -> Union[float, np.ndarray]:
|
||||||
|
alpha, beta, sigma, gamma = args
|
||||||
|
if gamma == beta:
|
||||||
|
return GGAlpha.distribution(tau, tau0, alpha, beta)
|
||||||
|
b_to_a = beta / alpha
|
||||||
|
g_to_a = gamma / alpha
|
||||||
|
t_to_t0 = tau / tau0
|
||||||
|
norm = (np.exp(gammaln(b_to_a)) + sigma**(gamma-beta) *
|
||||||
|
np.exp(gammaln(g_to_a) + (b_to_a-g_to_a)*np.log(b_to_a))) / np.exp(b_to_a*np.log(b_to_a)) / alpha
|
||||||
|
|
||||||
|
ret_val = np.exp(-b_to_a * t_to_t0**alpha) * t_to_t0**beta * (1 + (t_to_t0*sigma)**(gamma-beta))
|
||||||
|
|
||||||
|
return ret_val / norm
|
||||||
|
|
||||||
|
|
||||||
|
class GGBeta(Distribution):
|
||||||
|
name = r'General \Gamma (\beta-process)'
|
||||||
|
parameter = [r'\alpha', r'\beta']
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, *args):
|
||||||
|
logtau0 = np.log(tau0)
|
||||||
|
logtau = np.linspace(logtau0-20, logtau0+20, num=4001)
|
||||||
|
taus = np.exp(logtau)
|
||||||
|
gtau = GGBeta.distribution(taus, tau0, *args)
|
||||||
|
# wir integrieren ueber lntau, nicht tau
|
||||||
|
ret_val = np.array([simps(np.exp(-xvals/taus)*gtau, logtau) for xvals in t])
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau0, *args):
|
||||||
|
logtau0 = np.log(tau0)
|
||||||
|
logtau = np.linspace(logtau0 - 20, logtau0 + 20, num=4001)
|
||||||
|
taus = np.exp(logtau)
|
||||||
|
gtau = GGBeta.distribution(taus, tau0, *args)
|
||||||
|
ret_val = np.array([simps(1/(1+1j*xvals*taus) * gtau, logtau) for xvals in omega])
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(tau: Union[float, np.ndarray], tau0: float, *args) -> Union[float, np.ndarray]:
|
||||||
|
a, b = args
|
||||||
|
norm = a * (1+b) * np.sin(np.pi*b/(1+b)) * b**(b/(1+b)) / np.pi
|
||||||
|
ret_val = b * (tau/tau0)**a + (tau/tau0)**(-a*b)
|
||||||
|
|
||||||
|
return norm / ret_val
|
106
nmreval/distributions/havriliaknegami.py
Normal file
106
nmreval/distributions/havriliaknegami.py
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
import numpy as np
|
||||||
|
from scipy.special import psi
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
from ..math.mittagleffler import mlf
|
||||||
|
from ..utils import Eu
|
||||||
|
|
||||||
|
|
||||||
|
class HavriliakNegami(Distribution):
|
||||||
|
"""
|
||||||
|
Functions based on Cole-Davidson distribution
|
||||||
|
"""
|
||||||
|
|
||||||
|
name = 'Havriliak-Negami'
|
||||||
|
parameter = [r'\alpha', r'\gamma']
|
||||||
|
bounds = [(0, 1), (0, 1)]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, alpha, gamma):
|
||||||
|
r"""
|
||||||
|
Correlation function
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
C(t, \tau_0, \alpha, \gamma) = 1 - \left(\frac{t}{\tau_0}\right)^{\alpha\gamma} \text{E}_{\alpha,\alpha\gamma+1}^\gamma\left[-\left(\frac{t}{\tau_0}\right)^\alpha\right]
|
||||||
|
|
||||||
|
with incomplete Gamma function
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\Gamma(\gamma, t/\tau_0) = \frac{1}{\Gamma(\gamma)}\int_{t/\tau_0}^\infty x^{\gamma-1}\text{e}^{-x}\,\mathrm{d}x
|
||||||
|
|
||||||
|
Args:
|
||||||
|
t:
|
||||||
|
tau0:
|
||||||
|
alpha:
|
||||||
|
gamma:
|
||||||
|
|
||||||
|
References:
|
||||||
|
R. Hilfer: H-function representations for stretched exponential relaxation and non-Debye susceptibilities in glassy systems. Phys. Rev. E (2002) https://doi.org/10.1103/PhysRevE.65.061510
|
||||||
|
|
||||||
|
"""
|
||||||
|
return 1 - (t/tau0)**(alpha*gamma) * mlf(-(t/tau0)**alpha, alpha, alpha*gamma+1, gamma)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau, alpha, gamma):
|
||||||
|
return np.conjugate(1/(1 + (1j*omega[:, None]*tau[None, :])**alpha)**gamma).squeeze()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, tau, alpha, gamma):
|
||||||
|
omtau = (omega[:, None]*tau[None, :])**alpha
|
||||||
|
|
||||||
|
zaehler = np.sin(gamma * np.arctan2(omtau*np.sin(0.5*alpha*np.pi), 1 + omtau*np.cos(0.5*alpha*np.pi)))
|
||||||
|
nenner = (1 + 2*omtau * np.cos(0.5*alpha*np.pi) + omtau**2)**(0.5*gamma)
|
||||||
|
|
||||||
|
return ((1 / omega) * (zaehler/nenner)).squeeze()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(tau, tau0, alpha, gamma):
|
||||||
|
if alpha == 1:
|
||||||
|
from .coledavidson import ColeDavidson
|
||||||
|
return ColeDavidson.distribution(tau, tau0, gamma)
|
||||||
|
elif gamma == 1:
|
||||||
|
from .colecole import ColeCole
|
||||||
|
return ColeCole.distribution(tau, tau0, alpha)
|
||||||
|
else:
|
||||||
|
_y = tau/tau0
|
||||||
|
om_y = (1 + 2*np.cos(np.pi*alpha)*(_y**alpha) + _y**(2*alpha))**(-gamma/2)
|
||||||
|
theta_y = np.arctan2(np.sin(np.pi * alpha), _y**alpha + np.cos(np.pi*alpha))
|
||||||
|
|
||||||
|
return np.sin(gamma*theta_y) * om_y * (_y**(alpha*gamma)) / np.pi
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def max(tau, alpha, gamma):
|
||||||
|
return tau*(np.sin(0.5*np.pi*alpha*gamma/(gamma+1)) / np.sin(0.5*np.pi*alpha/(gamma+1)))**(1/alpha)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def logmean(tau, alpha, gamma):
|
||||||
|
r"""
|
||||||
|
Calculate mean logarithm of tau
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\langle \ln \tau \rangle = \ln \tau + \frac{\Psi(\gamma) + \text{Eu}}{\alpha}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tau:
|
||||||
|
alpha:
|
||||||
|
gamma:
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return np.log(tau) + (psi(gamma)+Eu)/alpha
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def mean(tau, alpha, gamma):
|
||||||
|
# approximation according to Th. Bauer et al., J. Chem. Phys. 133, 144509 (2010).
|
||||||
|
return tau * alpha*gamma
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
x = np.logspace(-7, 3)
|
||||||
|
y = HavriliakNegami.correlation(x, 1, 0.8, 0.26)
|
||||||
|
|
||||||
|
plt.semilogx(x, y)
|
||||||
|
plt.show()
|
99
nmreval/distributions/intermolecular.py
Normal file
99
nmreval/distributions/intermolecular.py
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
import numpy as np
|
||||||
|
from scipy.integrate import quad
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
|
||||||
|
|
||||||
|
class FFHS(Distribution):
|
||||||
|
name = 'Intermolecular (FFHS)'
|
||||||
|
parameter = None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(taus, tau0, *args):
|
||||||
|
# Distribution over tau, not log(tau), like in other cases
|
||||||
|
z = taus / tau0
|
||||||
|
return 54 * np.sqrt(z) / (162*z**3 + 18*z**2 - 4*z + 2) / np.pi / tau0
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, *args):
|
||||||
|
def integrand(u, tt, tau0):
|
||||||
|
return FFHS.distribution(u, tau0) * np.exp(-tt/u) / u
|
||||||
|
|
||||||
|
ret_val = np.array([quad(integrand, 0, np.infty, args=(tt, tau0), epsabs=1e-12, epsrel=1e-12)[0] for tt in t])
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, tau0, *args):
|
||||||
|
def integrand(u, o, tau0):
|
||||||
|
return FFHS.distribution(u, tau0) * u / (1+o**2 * u**2)
|
||||||
|
|
||||||
|
ret_val = np.array([quad(integrand, 0, np.infty, args=(o, tau0), epsabs=1e-12, epsrel=1e-12)[0] for o in omega])
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau0, *args):
|
||||||
|
def integrand_real(u, o, tau0):
|
||||||
|
return FFHS.distribution(u, tau0) / (1+o**2 * u**2)
|
||||||
|
|
||||||
|
def integrand_imag(u, o, tau0):
|
||||||
|
return FFHS.distribution(u, tau0) * o*u / (1+o**2 * u**2)
|
||||||
|
|
||||||
|
ret_val = np.array([quad(integrand_real, 0, np.infty, args=(o, tau0),
|
||||||
|
epsabs=1e-12, epsrel=1e-12)[0] for o in omega], dtype=complex)
|
||||||
|
|
||||||
|
ret_val.imag += np.array([quad(integrand_imag, 0, np.infty, args=(o, tau0),
|
||||||
|
epsabs=1e-12, epsrel=1e-12)[0] for o in omega])
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
|
||||||
|
# class Bessel(Distribution):
|
||||||
|
# name = 'Intermolecular (Bessel)'
|
||||||
|
# parameter = None
|
||||||
|
#
|
||||||
|
# @staticmethod
|
||||||
|
# def distribution(taus, tau0, *args):
|
||||||
|
# x = np.sqrt(tau0 / taus)
|
||||||
|
# return special.jv(1.5, x)**2 / tau0 / 2
|
||||||
|
#
|
||||||
|
# @staticmethod
|
||||||
|
# def correlation(t, tau0, *args):
|
||||||
|
# def integrand(lx, tt):
|
||||||
|
# x = np.exp(lx)
|
||||||
|
# return Bessel.distribution(x, tau0)*np.exp(-tt/lx)
|
||||||
|
#
|
||||||
|
# logaxis = np.linspace(-20+np.log(tau0), 20+np.log(tau0), num=5001)
|
||||||
|
#
|
||||||
|
# ret_val = np.array([simps(integrand(logaxis, tt), logaxis) for tt in t])
|
||||||
|
#
|
||||||
|
# return ret_val
|
||||||
|
#
|
||||||
|
# @staticmethod
|
||||||
|
# def susceptibility(omega, tau0, *args):
|
||||||
|
# def integrand(lx, o):
|
||||||
|
# x = np.exp(lx)
|
||||||
|
# return Bessel.distribution(x, tau0) * 1/(1+1j*omega*x)
|
||||||
|
#
|
||||||
|
# logaxis = np.linspace(-20 + np.log(tau0), 20 + np.log(tau0), num=5001)
|
||||||
|
#
|
||||||
|
# ret_val = np.array([simps(integrand(logaxis, o), logaxis) for o in omega])
|
||||||
|
#
|
||||||
|
# return ret_val
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
x = np.logspace(-3, 3, num=61)
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(2, 2)
|
||||||
|
|
||||||
|
ax[0, 0].loglog(x, FFHS.distribution(x, 1))
|
||||||
|
ax[0, 1].semilogx(x, FFHS.correlation(x, 1))
|
||||||
|
ax[1, 0].loglog(x, FFHS.specdens(x, 1))
|
||||||
|
ax[1, 1].loglog(x, FFHS.susceptibility(x, 1).real,
|
||||||
|
x, -FFHS.susceptibility(x, 1).imag)
|
||||||
|
fig.tight_layout()
|
||||||
|
plt.show()
|
84
nmreval/distributions/kww.py
Normal file
84
nmreval/distributions/kww.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import numpy as np
|
||||||
|
from scipy.interpolate import interp1d
|
||||||
|
from scipy.special import gamma
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
from ..math.kww import kww_cos, kww_sin
|
||||||
|
from ..utils.constants import Eu
|
||||||
|
|
||||||
|
|
||||||
|
class KWW(Distribution):
|
||||||
|
name = 'KWW'
|
||||||
|
parameter = [r'\beta']
|
||||||
|
boounds = [(0, 1)]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(taus, tau, *args):
|
||||||
|
b = args[0]
|
||||||
|
assert 0.1 <= b <= 0.9
|
||||||
|
b_supp = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
|
||||||
|
B_supp = [0.145, 0.197, 0.243, 0.285, 0.382, 0.306, 0.360, 0.435, 0.700]
|
||||||
|
C_supp = [0.89, 0.50, 0.35, 0.25, 0, 0.13, 0.22, 0.4015, 0.32]
|
||||||
|
|
||||||
|
B = interp1d(b_supp, B_supp)(b)
|
||||||
|
C = interp1d(b_supp, C_supp)(b)
|
||||||
|
|
||||||
|
tt = tau/taus
|
||||||
|
|
||||||
|
delta = b * abs(b-0.5) / (1-b)
|
||||||
|
if b > 0.5:
|
||||||
|
f = 1 + C * tt**delta
|
||||||
|
else:
|
||||||
|
f = 1 / (1 + C * tt**delta)
|
||||||
|
ret_val = tau * B * np.exp(-(1-b) * b**(b/(1-b)) / tt**(b/(1-b))) / tt**((1-0.5*b)/(1-b))
|
||||||
|
|
||||||
|
return ret_val * f / taus
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau, *args):
|
||||||
|
return np.exp(-(t/tau)**args[0])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau, *args):
|
||||||
|
return 1-omega*kww_sin(omega, tau, args[0]) + 1j*omega*kww_cos(omega, tau, args[0])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, tau, *args):
|
||||||
|
return kww_cos(omega, tau, args[0])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def mean(*args):
|
||||||
|
tau, beta = args
|
||||||
|
return tau/beta * gamma(1 / beta)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def logmean(*args):
|
||||||
|
tau, beta = args
|
||||||
|
return (1-1/beta) * Eu + np.log(tau)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def max(*args):
|
||||||
|
tau, beta = args
|
||||||
|
return (1.7851 - 0.87052*beta - 0.028836*beta**2 + 0.11391*beta**3) * tau
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
x = np.logspace(-3, 3, num=61)
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(2, 2)
|
||||||
|
ax[0, 0].set_title('Distribution')
|
||||||
|
ax[0, 1].set_title('Correlation func.')
|
||||||
|
ax[1, 0].set_title('Spectral density')
|
||||||
|
ax[1, 1].set_title('Susceptibility')
|
||||||
|
|
||||||
|
for g in [0.3, 0.5, 0.7, 0.9]:
|
||||||
|
ax[0, 0].semilogx(x, KWW.distribution(x, 1, g))
|
||||||
|
ax[0, 1].semilogx(x, KWW.correlation(x, 1, g))
|
||||||
|
ax[1, 0].loglog(x, KWW.specdens(x, 1, g))
|
||||||
|
a = ax[1, 1].loglog(x, KWW.susceptibility(x, 1, g).imag)
|
||||||
|
ax[1, 1].loglog(x, KWW.susceptibility(x, 1, g).real, '--', color=a[0].get_color())
|
||||||
|
|
||||||
|
fig.tight_layout()
|
||||||
|
plt.show()
|
138
nmreval/distributions/loggaussian.py
Normal file
138
nmreval/distributions/loggaussian.py
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
from multiprocessing import Pool, cpu_count
|
||||||
|
from itertools import product
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
try:
|
||||||
|
from scipy.integrate import simpson
|
||||||
|
except ImportError:
|
||||||
|
from scipy.integrate import simps as simpson
|
||||||
|
from scipy.integrate import quad
|
||||||
|
|
||||||
|
from .base import Distribution
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['LogGaussian']
|
||||||
|
|
||||||
|
|
||||||
|
class LogGaussian(Distribution):
|
||||||
|
name = 'Log-Gaussian'
|
||||||
|
parameter = [r'\sigma']
|
||||||
|
bounds = [(0, 10)]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def distribution(tau, tau0, *args):
|
||||||
|
sigma = args[0]
|
||||||
|
return np.exp(-0.5*(np.log(tau/tau0)/sigma)**2)/np.sqrt(2*np.pi)/sigma
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def correlation(t, tau0, *args):
|
||||||
|
sigma = args[0]
|
||||||
|
_t = np.atleast_1d(t)
|
||||||
|
_tau = np.atleast_1d(tau0)
|
||||||
|
|
||||||
|
pool = Pool(processes=min(cpu_count(), 4))
|
||||||
|
integration_ranges = [(omega_i, tau_j, sigma) for (omega_i, tau_j) in product(_t, _tau)]
|
||||||
|
|
||||||
|
with np.errstate(divide='ignore'):
|
||||||
|
res = np.array(pool.map(_integrate_process_3, integration_ranges))
|
||||||
|
ret_val = res.reshape((_t.shape[0], _tau.shape[0]))
|
||||||
|
|
||||||
|
return ret_val.squeeze()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def susceptibility(omega, tau0, *args):
|
||||||
|
sigma = args[0]
|
||||||
|
_omega = np.atleast_1d(omega)
|
||||||
|
_tau = np.atleast_1d(tau0)
|
||||||
|
|
||||||
|
pool = Pool(processes=min(cpu_count(), 4))
|
||||||
|
integration_ranges = [(omega_i, tau_j, sigma) for (omega_i, tau_j) in product(_omega, _tau)]
|
||||||
|
|
||||||
|
with np.errstate(divide='ignore'):
|
||||||
|
res_real = np.array(pool.map(_integrate_process_1, integration_ranges))
|
||||||
|
res_imag = np.array(pool.map(_integrate_process_2, integration_ranges))
|
||||||
|
ret_val = (res_real+1j*res_imag).reshape((_omega.shape[0], _tau.shape[0]))
|
||||||
|
|
||||||
|
return ret_val.squeeze()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def specdens(omega, tau0, *args):
|
||||||
|
sigma = args[0]
|
||||||
|
_omega = np.atleast_1d(omega)
|
||||||
|
_tau = np.atleast_1d(tau0)
|
||||||
|
|
||||||
|
pool = Pool(processes=min(cpu_count(), 4))
|
||||||
|
integration_ranges = [(omega_i, tau_j, sigma) for (omega_i, tau_j) in product(_omega, _tau)]
|
||||||
|
|
||||||
|
with np.errstate(divide='ignore'):
|
||||||
|
res = np.array(pool.map(_integrate_process_1, integration_ranges))
|
||||||
|
ret_val = res.reshape((_omega.shape[0], _tau.shape[0]))
|
||||||
|
|
||||||
|
ret_val /= _omega[:, None]
|
||||||
|
|
||||||
|
return ret_val.squeeze()
|
||||||
|
|
||||||
|
def mean(*args):
|
||||||
|
return args[0]*np.exp(args[1]**2 / 2)
|
||||||
|
|
||||||
|
|
||||||
|
def _integrate_process_1(args):
|
||||||
|
omega_i, tau_j, sigma = args
|
||||||
|
area = quad(_integrand_freq_imag_high, 0, 50, args=(omega_i, tau_j, sigma))[0]
|
||||||
|
area += quad(_integrand_freq_imag_low, -50, 0, args=(omega_i, tau_j, sigma))[0]
|
||||||
|
|
||||||
|
return area
|
||||||
|
|
||||||
|
|
||||||
|
def _integrate_process_2(args):
|
||||||
|
omega_i, tau_j, sigma = args
|
||||||
|
area = quad(_integrand_freq_real_high, 0, 50, args=(omega_i, tau_j, sigma))[0]
|
||||||
|
area += quad(_integrand_freq_real_low, -50, 0, args=(omega_i, tau_j, sigma))[0]
|
||||||
|
|
||||||
|
return area
|
||||||
|
|
||||||
|
|
||||||
|
def _integrate_process_3(args):
|
||||||
|
omega_i, tau_j, sigma = args
|
||||||
|
return quad(_integrand_time, -50, 50, args=(omega_i, tau_j, sigma))[0]
|
||||||
|
|
||||||
|
|
||||||
|
def _integrand_time(u, t, tau, sigma):
|
||||||
|
uu = np.exp(u)
|
||||||
|
return LogGaussian.distribution(uu, tau, sigma) * np.exp(-t/uu)
|
||||||
|
|
||||||
|
|
||||||
|
def _integrand_freq_imag_low(u, omega, tau, sigma):
|
||||||
|
uu = np.exp(u)
|
||||||
|
return LogGaussian.distribution(uu, tau, sigma) * omega * uu / (1 + (omega*uu)**2)
|
||||||
|
|
||||||
|
|
||||||
|
def _integrand_freq_imag_high(u, omega, tau, sigma):
|
||||||
|
uu = np.exp(-u)
|
||||||
|
return LogGaussian.distribution(1/uu, tau, sigma) * omega * uu / (uu**2 + omega**2)
|
||||||
|
|
||||||
|
|
||||||
|
def _integrand_freq_real_low(u, omega, tau, sigma):
|
||||||
|
uu = np.exp(u)
|
||||||
|
return LogGaussian.distribution(uu, tau, sigma) / (1 + (omega*uu)**2)
|
||||||
|
|
||||||
|
|
||||||
|
def _integrand_freq_real_high(u, omega, tau, sigma):
|
||||||
|
uu = np.exp(-2*u)
|
||||||
|
return LogGaussian.distribution(np.exp(u), tau, sigma) * uu / (uu + omega**2)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
x = np.logspace(-3, 3, num=61)
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(2, 2)
|
||||||
|
|
||||||
|
for g in [1, 2, 5]:
|
||||||
|
ax[0, 0].loglog(x, LogGaussian.distribution(x, 1, g))
|
||||||
|
ax[0, 1].semilogx(x, LogGaussian.correlation(x, 1, g))
|
||||||
|
ax[1, 0].loglog(x, LogGaussian.specdens(1, x, g))
|
||||||
|
gr = ax[1, 1].loglog(x, -LogGaussian.susceptibility(x, 1, g).imag)
|
||||||
|
ax[1, 1].loglog(x, LogGaussian.susceptibility(x, 1, g).real, '--', color=gr[0].get_color())
|
||||||
|
plt.show()
|
290
nmreval/dsc/calibration.py
Normal file
290
nmreval/dsc/calibration.py
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
__version__ = '0.1.3'
|
||||||
|
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import scipy.interpolate
|
||||||
|
from scipy.integrate import simps
|
||||||
|
|
||||||
|
from nmreval.io.dsc import DSCSample, Cyclohexane
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Calibrate DSC data')
|
||||||
|
parser.add_argument('sample', type=str, help='filename of DSC sample')
|
||||||
|
parser.add_argument('empty', type=str, help='filename of empty pan')
|
||||||
|
parser.add_argument('reference', help='filename of reference', type=str)
|
||||||
|
parser.add_argument('--cooling', help='Show figure of found cooling rates', action='store_true')
|
||||||
|
|
||||||
|
|
||||||
|
def evaluate(sample, empty, reference, ref_points=Cyclohexane, show_cooling=False):
|
||||||
|
sample = DSCSample(sample)
|
||||||
|
empty = DSCSample(empty)
|
||||||
|
reference = DSCSample(reference)
|
||||||
|
|
||||||
|
if show_cooling:
|
||||||
|
fig, ax = plt.subplots()
|
||||||
|
print('\n')
|
||||||
|
for k, v in sample.heating.items():
|
||||||
|
print('Plot run {} with cooling rate {} K/min'.format(k, v))
|
||||||
|
c = sample.flow_data(v, mode='c')
|
||||||
|
ax.plot(c[0], c[1], label=str(v)+' K/min')
|
||||||
|
ax.set_xlabel('T / K')
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
run_list = []
|
||||||
|
if len(sample.heating) > 1:
|
||||||
|
run = None
|
||||||
|
print('\nMultiple heat rates found:')
|
||||||
|
for k, v in sample.heating.items():
|
||||||
|
print(' run {}: {} K/min'.format(k, v))
|
||||||
|
while run not in sample.heating:
|
||||||
|
# choose your own adventure!!!
|
||||||
|
value = input('\nPlease select a run (press Enter for all heat rates): ')
|
||||||
|
if value == '':
|
||||||
|
run_list = list(sample.heating.keys())
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
run = int(value)
|
||||||
|
run_list = [run]
|
||||||
|
else:
|
||||||
|
run_list = list(sample.heating.keys())
|
||||||
|
|
||||||
|
for run in run_list:
|
||||||
|
rate = sample.heating[run]
|
||||||
|
|
||||||
|
print('\nProcessing heat rate {} K/min'.format(rate))
|
||||||
|
|
||||||
|
print('Load data of heating data')
|
||||||
|
len_sample = sample.length(run)
|
||||||
|
|
||||||
|
# sanity checks
|
||||||
|
try:
|
||||||
|
reference_data = reference.flow_data(rate)
|
||||||
|
except IndexError:
|
||||||
|
print('ERROR: Reference measurement has no heat rate {} K/min'.format(rate))
|
||||||
|
print('Stop evaluation')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
try:
|
||||||
|
run_baseline = empty.get_run(rate)
|
||||||
|
except ValueError:
|
||||||
|
print('ERROR: Empty measurement has no heat rate {} K/min'.format(rate))
|
||||||
|
print('Stop evaluation')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
len_baseline = empty.length(run_baseline)
|
||||||
|
if len_baseline != len_sample:
|
||||||
|
print('WARNING: measurements differ by {} points'.format(abs(len_baseline - len_sample)))
|
||||||
|
# max_length = min(len_baseline, len_sample)
|
||||||
|
|
||||||
|
sample_data = sample.flow_data(rate, length=None)
|
||||||
|
empty_data = empty.flow_data(rate, length=None)
|
||||||
|
|
||||||
|
# plot input data
|
||||||
|
fig1, ax1 = plt.subplots(2, 3, **{'figsize': (10, 6)})
|
||||||
|
ax1[0, 0].set_title('raw data')
|
||||||
|
ax1[0, 0].set_xlabel('T / K')
|
||||||
|
|
||||||
|
ax1[0, 0].plot(sample_data[0], sample_data[1], 'k-', label='Sample')
|
||||||
|
ax1[0, 0].plot(empty_data[0], empty_data[1], 'b-', label='Empty')
|
||||||
|
ax1[0, 0].plot(reference_data[0], reference_data[1], 'r-', label='Reference')
|
||||||
|
ax1[0, 0].legend()
|
||||||
|
|
||||||
|
print('Substract empty data\n')
|
||||||
|
sample_baseline = sample_data.copy()
|
||||||
|
empty_y = empty_data[1]
|
||||||
|
if len_sample != len_baseline:
|
||||||
|
with np.errstate(all='ignore'):
|
||||||
|
empty_y = scipy.interpolate.interp1d(empty_data[0], empty_data[1],
|
||||||
|
fill_value='extrapolate')(sample_data[0])
|
||||||
|
sample_baseline[1] = sample_data[1] - empty_y
|
||||||
|
|
||||||
|
# plot baseline correction
|
||||||
|
ax1[0, 1].set_title('baseline correction')
|
||||||
|
ax1[0, 1].set_xlabel('T / K')
|
||||||
|
|
||||||
|
ax1[0, 1].plot(sample_data[0], sample_data[1], 'k--', label='Raw')
|
||||||
|
ax1[0, 1].plot(sample_baseline[0], sample_baseline[1], 'k-', label='Baseline corrected')
|
||||||
|
ax1[0, 1].plot(empty_data[0], empty_data[1], 'b-', label='Empty')
|
||||||
|
ax1[0, 1].legend()
|
||||||
|
|
||||||
|
print('Load isothermal data around heat rate')
|
||||||
|
mean_isotherms = []
|
||||||
|
for offset, where, ls in [(-1, 'low', '-'), (1, 'high', '--')]:
|
||||||
|
# read isotherms and baseline correct
|
||||||
|
len_baseline = empty.length(run_baseline+offset)
|
||||||
|
len_sample = sample.length(run+offset)
|
||||||
|
if len_baseline != len_sample:
|
||||||
|
print('WARNING: {} T isotherms differ by {} points'.format(where, abs(len_baseline-len_sample)))
|
||||||
|
|
||||||
|
max_length = min(len_baseline, len_sample)
|
||||||
|
isotherm_sample = sample.isotherm_data(run_baseline+offset, length=max_length)
|
||||||
|
isotherm_empty = empty.isotherm_data(run+offset, length=max_length)
|
||||||
|
|
||||||
|
isotherm_sample[1] -= isotherm_empty[1]
|
||||||
|
|
||||||
|
# get mean isotherm value
|
||||||
|
m = np.polyfit(isotherm_sample[0, 200:-200], isotherm_sample[1, 200:-200], 0)[0]
|
||||||
|
mean_isotherms.append(m)
|
||||||
|
print('Calculated {} heat flow: {:.4} mW'.format(where, m))
|
||||||
|
|
||||||
|
ax1[0, 2].plot(isotherm_sample[0], isotherm_sample[1], 'k--')
|
||||||
|
|
||||||
|
# calculate slope from difference between isotherms
|
||||||
|
slope = (mean_isotherms[1]-mean_isotherms[0]) / (sample_data[2, -1] - empty_data[2, 0])
|
||||||
|
print('Heat flow slope from isotherms: {:.4} per minute'.format(slope*60))
|
||||||
|
|
||||||
|
# calculate mean slope of heat flow at points in the beginning
|
||||||
|
slope_baseline = np.gradient(sample_baseline[1, int(4000/rate):int(9000/rate)],
|
||||||
|
sample_baseline[2, 300]-sample_baseline[2, 299]).mean()
|
||||||
|
print('Heat flow slope from initial heating: {:.4f} per minute\n'.format(slope_baseline*60))
|
||||||
|
|
||||||
|
drift_corrected = sample_baseline[1] - mean_isotherms[0] - (sample_baseline[2]-empty_data[2, 0])*slope
|
||||||
|
drift_from_slope = sample_baseline[1] - mean_isotherms[0] - (sample_baseline[2]-empty_data[2, 0])*slope_baseline
|
||||||
|
|
||||||
|
# plot
|
||||||
|
ax1[0, 2].axhline(mean_isotherms[0], linestyle=':')
|
||||||
|
ax1[0, 2].axhline(mean_isotherms[1], linestyle=':')
|
||||||
|
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], sample_baseline[1], 'k-', label='Baseline corrected')
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], drift_corrected, 'g-', label='Corrected (isotherm)')
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], drift_from_slope, 'b-', label='Corrected (heating)')
|
||||||
|
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], mean_isotherms[0] + (sample_baseline[2]-empty_data[2, 0])*slope, 'g--')
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], mean_isotherms[0] + slope_baseline*(sample_baseline[2]-empty_data[2, 0]),
|
||||||
|
'b--')
|
||||||
|
|
||||||
|
ax1[0, 2].plot(sample_baseline[2, int(4000/rate):int(9000/rate)],
|
||||||
|
sample_baseline[1, int(4000/rate):int(9000/rate)], 'r--')
|
||||||
|
|
||||||
|
ax1[0, 2].set_title('time dependence')
|
||||||
|
ax1[0, 2].set_xlabel('t / s')
|
||||||
|
ax1[0, 2].legend()
|
||||||
|
|
||||||
|
melts = []
|
||||||
|
for i, (ref_temp, enthalpy) in enumerate(ref_points.transitions):
|
||||||
|
# region around reference peaks
|
||||||
|
t_low_lim = ref_temp - 15
|
||||||
|
t_high_lim = ref_temp + 15
|
||||||
|
low_border = np.argmin(np.abs(reference_data[0]-t_low_lim))
|
||||||
|
high_border = np.argmin(np.abs(reference_data[0]-t_high_lim))
|
||||||
|
ref_zoom = reference_data[:, low_border:high_border]
|
||||||
|
x_val = np.array([[ref_zoom[0, 0], 1],
|
||||||
|
[ref_zoom[0, -1], 1]])
|
||||||
|
y_val = np.array([ref_zoom[1, 0],
|
||||||
|
ref_zoom[1, -1]])
|
||||||
|
print('Baseline correct reference of %.2f transition' % ref_temp)
|
||||||
|
sol = np.linalg.solve(x_val, y_val)
|
||||||
|
ref_zoom[1] -= (ref_zoom[0] * sol[0] + sol[1])
|
||||||
|
peak_max = ref_zoom[:, np.argmax(ref_zoom[1])]
|
||||||
|
integration_limit = np.argmin(abs(ref_zoom[0]-peak_max[0]+3)), np.argmin(abs(ref_zoom[0]-peak_max[0]-3))
|
||||||
|
|
||||||
|
# substract baseline around reference peaks
|
||||||
|
x_val = np.array([[ref_zoom[0, integration_limit[0]], 1],
|
||||||
|
[ref_zoom[0, integration_limit[1]], 1]])
|
||||||
|
y_val = np.array([ref_zoom[1, integration_limit[0]],
|
||||||
|
ref_zoom[1, integration_limit[1]]])
|
||||||
|
|
||||||
|
print('Baseline correct reference of %.2f transition' % ref_temp)
|
||||||
|
sol = np.linalg.solve(x_val, y_val)
|
||||||
|
ref_zoom[1] -= (ref_zoom[0] * sol[0] + sol[1])
|
||||||
|
|
||||||
|
# calculate onset slope (use points at position of maximum gradient +/- 100/rate)
|
||||||
|
ref_grad = np.gradient(ref_zoom[1])
|
||||||
|
max_grad = np.argmax(ref_grad)
|
||||||
|
|
||||||
|
x_val = np.array([[ref_zoom[0, max_grad-int(100/rate)], 1],
|
||||||
|
[ref_zoom[0, max_grad+int(100/rate)+1], 1]])
|
||||||
|
y_val = np.array([ref_zoom[1, max_grad-int(100/rate)],
|
||||||
|
ref_zoom[1, max_grad+int(100/rate)+1]])
|
||||||
|
sol = np.linalg.solve(x_val, y_val)
|
||||||
|
onset = sol[0]*ref_zoom[0] + sol[1]
|
||||||
|
|
||||||
|
melts.append(-sol[1]/sol[0])
|
||||||
|
|
||||||
|
# plot
|
||||||
|
ax1[1, i].set_title(f'reference: {ref_temp:.2f}')
|
||||||
|
ax1[1, i].set_xlabel('T / K')
|
||||||
|
|
||||||
|
ax1[1, i].plot(reference_data[0], reference_data[1], 'r-')
|
||||||
|
ax1[1, i].plot(ref_zoom[0, max_grad], ref_zoom[0, max_grad], 'kx')
|
||||||
|
ax1[1, i].plot(ref_zoom[0], onset, 'k--')
|
||||||
|
ax1[1, i].axhline(0, color='k', linestyle='--')
|
||||||
|
|
||||||
|
ax1[1, i].set_xlim(ref_zoom[0, integration_limit[0]], ref_zoom[0, integration_limit[1]])
|
||||||
|
ax1[1, i].set_ylim(-max(ref_zoom[1])/10, max(ref_zoom[1])*1.1)
|
||||||
|
|
||||||
|
print('Onset of transition: %.2f K found at %.2f' % (ref_temp, melts[-1]))
|
||||||
|
if enthalpy is not None:
|
||||||
|
# integrate over low temperature peak to calibrate y axis
|
||||||
|
# delta H in J/g: Integrate Peak over time and divide by weight
|
||||||
|
area = 1e-3 * simps(ref_zoom[1, integration_limit[0]:integration_limit[1]],
|
||||||
|
ref_zoom[2, integration_limit[0]:integration_limit[1]],
|
||||||
|
even='avg')
|
||||||
|
calib_y_axis = enthalpy / (area / reference.weight)
|
||||||
|
print("Calibration factor of peak: %f\n" % calib_y_axis)
|
||||||
|
|
||||||
|
sample_baseline[1] *= calib_y_axis
|
||||||
|
|
||||||
|
fig1.delaxes(ax1[1, 2])
|
||||||
|
fig1.tight_layout()
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
# give a choice how to compensate for long-time drift
|
||||||
|
mode = None
|
||||||
|
while mode not in ['i', 'h']:
|
||||||
|
mode = input('\nUse [i]sotherms or initial [h]eating for long-time correction? (Default: i) ')
|
||||||
|
if mode == '':
|
||||||
|
mode = 'i'
|
||||||
|
|
||||||
|
if mode == 'h':
|
||||||
|
print('\nCorrect slope from initial heating')
|
||||||
|
sample_baseline[1] = drift_from_slope
|
||||||
|
else:
|
||||||
|
print('\nCorrect slope from isotherm')
|
||||||
|
sample_baseline[1] = drift_corrected
|
||||||
|
|
||||||
|
# calibrate T axis
|
||||||
|
print('\nCalibrate temperature')
|
||||||
|
real_trans = np.array([temp for (temp, _) in ref_points.transitions])
|
||||||
|
t_vals = np.array([[melts[0], 1],
|
||||||
|
[melts[1], 1]])
|
||||||
|
calibration_temp = np.linalg.solve(t_vals, real_trans)
|
||||||
|
print('T_real = {:.4f} * T_meas {:+.4f}'.format(*calibration_temp))
|
||||||
|
|
||||||
|
sample_baseline[0] = calibration_temp[0] * sample_baseline[0] + calibration_temp[1]
|
||||||
|
|
||||||
|
print('Convert to capacity')
|
||||||
|
cp = sample_baseline[1] * 60. / rate / sample.weight / 1000.
|
||||||
|
if sample.weight is None:
|
||||||
|
raise ValueError('No sample weight given')
|
||||||
|
|
||||||
|
# plot final results in separate figure
|
||||||
|
fig2, ax2 = plt.subplots()
|
||||||
|
ax2.set_title('{} K/min: Heat flow vs. heat capacity (close to cont.)'.format(rate))
|
||||||
|
ax2.set_xlabel('Temperature / K')
|
||||||
|
|
||||||
|
ax2.plot(sample_baseline[0], sample_baseline[1], label='heat flow')
|
||||||
|
ax2.plot(sample_baseline[0], cp, label='heat capacity')
|
||||||
|
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
outname = os.path.splitext(sample.name)[0] + '_' + str(rate) + 'K-min.dat'
|
||||||
|
header = 'Made with version: {}\n'.format(__version__)
|
||||||
|
header += 'T/K\tCp/J/(gK)\theat flow/mW'
|
||||||
|
|
||||||
|
print()
|
||||||
|
print('Save to', outname)
|
||||||
|
np.savetxt(outname, np.c_[sample_baseline[0], cp, sample_baseline[1]], header=header)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = parser.parse_args()
|
||||||
|
evaluate(args.sample, args.empty, args.reference, show_cooling=args.cooling)
|
292
nmreval/dsc/dsc_calibration_fast_neu.py
Normal file
292
nmreval/dsc/dsc_calibration_fast_neu.py
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
__version__ = '0.1.2'
|
||||||
|
|
||||||
|
import os
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from scipy.integrate import simps
|
||||||
|
|
||||||
|
from nmreval.io.dsc import DSCReader, Cyclohexane, ReferenceValue
|
||||||
|
|
||||||
|
parser = ArgumentParser(description='Calibrate DSC data')
|
||||||
|
parser.add_argument('sample', type=str, help='filename of DSC sample')
|
||||||
|
parser.add_argument('empty', type=str, help='filename of empty pan')
|
||||||
|
parser.add_argument('reference', help='filename of reference', type=str)
|
||||||
|
parser.add_argument('--cooling', help='Plot found cooling rates', action='store_true')
|
||||||
|
|
||||||
|
|
||||||
|
def evaluate(sample: str|Path, empty: str|Path, reference: str|Path,
|
||||||
|
ref_points: ReferenceValue = Cyclohexane, show_cooling: bool = False):
|
||||||
|
|
||||||
|
sample = DSCReader(sample)
|
||||||
|
empty = DSCReader(empty)
|
||||||
|
reference = DSCReader(reference)
|
||||||
|
print(sample)
|
||||||
|
|
||||||
|
if show_cooling:
|
||||||
|
fig, ax = plt.subplots()
|
||||||
|
print('\n')
|
||||||
|
for k, v in sample.cooling.items():
|
||||||
|
print('Plot run {} with cooling rate {} K/min'.format(k, v))
|
||||||
|
c = sample.flow_data(v, mode='c')
|
||||||
|
ax.plot(c[0], c[1], label=str(v)+' K/min')
|
||||||
|
ax.set_xlabel('T / K')
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
run_list = []
|
||||||
|
if len(sample.heating) > 1:
|
||||||
|
run = None
|
||||||
|
print('\nMultiple heat rates found:')
|
||||||
|
for k, v in sample.heating.items():
|
||||||
|
print(' run {}: {} K/min'.format(k, v))
|
||||||
|
while run not in sample.heating:
|
||||||
|
# choose your own adventure!!!
|
||||||
|
value = input('\nPlease select a run (press Enter for all heat rates): ')
|
||||||
|
if value == '':
|
||||||
|
run_list = list(sample.heating.keys())
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
run = int(value)
|
||||||
|
run_list = [run]
|
||||||
|
else:
|
||||||
|
run_list = list(sample.heating.keys())
|
||||||
|
|
||||||
|
for run in run_list:
|
||||||
|
rate = sample.heating[run]
|
||||||
|
|
||||||
|
print('\nProcessing heat rate {} K/min'.format(rate))
|
||||||
|
|
||||||
|
print('Load data of heating data')
|
||||||
|
len_sample = sample.length(run)
|
||||||
|
|
||||||
|
# sanity checks
|
||||||
|
try:
|
||||||
|
reference_data = reference.flow_data(rate)
|
||||||
|
except IndexError:
|
||||||
|
print('ERROR: Reference measurement has no heat rate {} K/min'.format(rate))
|
||||||
|
print('Stop evaluation')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
try:
|
||||||
|
run_baseline = empty.get_run(rate)
|
||||||
|
except ValueError:
|
||||||
|
print('ERROR: Empty measurement has no heat rate {} K/min'.format(rate))
|
||||||
|
print('Stop evaluation')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
len_baseline = empty.length(run_baseline)
|
||||||
|
max_length = None
|
||||||
|
if len_baseline != len_sample:
|
||||||
|
print('WARNING: measurements differ by {} points'.format(abs(len_baseline - len_sample)))
|
||||||
|
max_length = min(len_baseline, len_sample)
|
||||||
|
|
||||||
|
sample_data = sample.flow_data(rate, length=max_length)
|
||||||
|
empty_data = empty.flow_data(rate, length=max_length)
|
||||||
|
|
||||||
|
# plot input data
|
||||||
|
fig1, ax1 = plt.subplots(2, 3, **{'figsize': (10, 6)})
|
||||||
|
ax1[0, 0].set_title('raw data')
|
||||||
|
ax1[0, 0].set_xlabel('T / K')
|
||||||
|
|
||||||
|
ax1[0, 0].plot(sample_data[0], sample_data[1], 'k-', label='Sample')
|
||||||
|
ax1[0, 0].plot(empty_data[0], empty_data[1], 'b-', label='Empty')
|
||||||
|
ax1[0, 0].plot(reference_data[0], reference_data[1], 'r-', label='Reference')
|
||||||
|
ax1[0, 0].legend()
|
||||||
|
|
||||||
|
print('Substract empty data')
|
||||||
|
sample_baseline = sample_data.copy()
|
||||||
|
sample_baseline[1] = sample_data[1] - empty_data[1]
|
||||||
|
|
||||||
|
# plot baseline correction
|
||||||
|
ax1[0, 1].set_title('baseline correction')
|
||||||
|
ax1[0, 1].set_xlabel('T / K')
|
||||||
|
|
||||||
|
ax1[0, 1].plot(sample_data[0], sample_data[1], 'k--', label='Raw')
|
||||||
|
ax1[0, 1].plot(sample_baseline[0], sample_baseline[1], 'k-', label='Baseline corrected')
|
||||||
|
ax1[0, 1].plot(empty_data[0], empty_data[1], 'b-', label='Empty')
|
||||||
|
ax1[0, 1].legend()
|
||||||
|
|
||||||
|
print('Load isothermal data around heat rate')
|
||||||
|
mean_isotherms = []
|
||||||
|
for offset, where, ls in [(-1, 'low', '-'), (1, 'high', '--')]:
|
||||||
|
# read isotherms and baseline correct
|
||||||
|
len_baseline = empty.length(run_baseline+offset)
|
||||||
|
len_sample = sample.length(run+offset)
|
||||||
|
if len_baseline != len_sample:
|
||||||
|
print('WARNING: {} T isotherms differ by {} points'.format(where, abs(len_baseline-len_sample)))
|
||||||
|
|
||||||
|
max_length = min(len_baseline, len_sample)
|
||||||
|
isotherm_sample = sample.isotherm_data(run_baseline+offset, length=max_length)
|
||||||
|
isotherm_empty = empty.isotherm_data(run+offset, length=max_length)
|
||||||
|
|
||||||
|
isotherm_sample[1] -= isotherm_empty[1]
|
||||||
|
|
||||||
|
# get mean isotherm value
|
||||||
|
m = np.polyfit(isotherm_sample[0, 200:-200], isotherm_sample[1, 200:-200], 0)[0]
|
||||||
|
mean_isotherms.append(m)
|
||||||
|
print('Calculated {} heat flow: {} mW'.format(where, m))
|
||||||
|
|
||||||
|
ax1[0, 2].plot(isotherm_sample[0], isotherm_sample[1], 'k--')
|
||||||
|
|
||||||
|
# calculate slope from difference between isotherms
|
||||||
|
slope = (mean_isotherms[1]-mean_isotherms[0]) / (sample_data[2, -1] - empty_data[2, 0])
|
||||||
|
print('Heat flow slope from isotherms: {} per minute'.format(slope*60))
|
||||||
|
|
||||||
|
# calculate mean slope of heat flow at points in the beginning
|
||||||
|
slope_baseline = np.gradient(sample_baseline[1, int(4000/rate):int(9000/rate)],
|
||||||
|
sample_baseline[2, 300]-sample_baseline[2, 299]).mean()
|
||||||
|
print('Heat flow slope from initial heating: {} per minute'.format(slope_baseline*60))
|
||||||
|
|
||||||
|
drift_corrected = sample_baseline[1] - mean_isotherms[0] - (sample_baseline[2]-empty_data[2, 0])*slope
|
||||||
|
drift_from_slope = sample_baseline[1] - mean_isotherms[0] - (sample_baseline[2]-empty_data[2, 0])*slope_baseline
|
||||||
|
|
||||||
|
# plot
|
||||||
|
ax1[0, 2].axhline(mean_isotherms[0], linestyle=':')
|
||||||
|
ax1[0, 2].axhline(mean_isotherms[1], linestyle=':')
|
||||||
|
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], sample_baseline[1], 'k-', label='Baseline corrected')
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], drift_corrected, 'g-', label='Corrected (isotherm)')
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], drift_from_slope, 'b-', label='Corrected (heating)')
|
||||||
|
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], mean_isotherms[0] + (sample_baseline[2]-empty_data[2, 0])*slope, 'g--')
|
||||||
|
ax1[0, 2].plot(sample_baseline[2], mean_isotherms[0] + slope_baseline*(sample_baseline[2]-empty_data[2, 0]),
|
||||||
|
'b--')
|
||||||
|
|
||||||
|
ax1[0, 2].plot(sample_baseline[2, int(4000/rate):int(9000/rate)],
|
||||||
|
sample_baseline[1, int(4000/rate):int(9000/rate)], 'r--')
|
||||||
|
|
||||||
|
ax1[0, 2].set_title('time dependence')
|
||||||
|
ax1[0, 2].set_xlabel('t / s')
|
||||||
|
ax1[0, 2].legend()
|
||||||
|
|
||||||
|
melts = []
|
||||||
|
for i, (trans_temp, enthalpy) in enumerate(ref_points.transitions):
|
||||||
|
print(trans_temp, enthalpy)
|
||||||
|
|
||||||
|
# region around reference peaks
|
||||||
|
# NOTE: limits are hard coded for cyclohexane, other references need other limits
|
||||||
|
low_border = np.argmin(abs(reference_data[0]-(trans_temp-15)))
|
||||||
|
high_border = np.argmin(abs(reference_data[0]-(trans_temp+15)))
|
||||||
|
ref_zoom = reference_data[:, low_border:high_border]
|
||||||
|
x_val = np.array([[ref_zoom[0, 0], 1],
|
||||||
|
[ref_zoom[0, -1], 1]])
|
||||||
|
y_val = np.array([ref_zoom[1, 0],
|
||||||
|
ref_zoom[1, -1]])
|
||||||
|
print('Baseline correct reference of {} transition'.format(trans_temp))
|
||||||
|
sol = np.linalg.solve(x_val, y_val)
|
||||||
|
ref_zoom[1] -= (ref_zoom[0] * sol[0] + sol[1])
|
||||||
|
peak_max = ref_zoom[:, np.argmax(ref_zoom[1])]
|
||||||
|
integration_limit = np.argmin(abs(ref_zoom[0]-peak_max[0]+3)), np.argmin(abs(ref_zoom[0]-peak_max[0]-3))
|
||||||
|
|
||||||
|
# substract baseline around reference peaks
|
||||||
|
x_val = np.array([[ref_zoom[0, integration_limit[0]], 1],
|
||||||
|
[ref_zoom[0, integration_limit[1]], 1]])
|
||||||
|
y_val = np.array([ref_zoom[1, integration_limit[0]],
|
||||||
|
ref_zoom[1, integration_limit[1]]])
|
||||||
|
|
||||||
|
print('Baseline correct reference of {} transition'.format(trans_temp))
|
||||||
|
sol = np.linalg.solve(x_val, y_val)
|
||||||
|
ref_zoom[1] -= (ref_zoom[0] * sol[0] + sol[1])
|
||||||
|
|
||||||
|
# calculate onset slope (use points at position of maximum gradient +/- 100/rate)
|
||||||
|
ref_grad = np.gradient(ref_zoom[1])
|
||||||
|
max_grad = np.argmax(ref_grad)
|
||||||
|
|
||||||
|
x_val = np.array([[ref_zoom[0, max_grad-int(100/rate)], 1],
|
||||||
|
[ref_zoom[0, max_grad+int(100/rate)+1], 1]])
|
||||||
|
y_val = np.array([ref_zoom[1, max_grad-int(100/rate)],
|
||||||
|
ref_zoom[1, max_grad+int(100/rate)+1]])
|
||||||
|
sol = np.linalg.solve(x_val, y_val)
|
||||||
|
onset = sol[0]*ref_zoom[0] + sol[1]
|
||||||
|
|
||||||
|
melts.append(-sol[1]/sol[0])
|
||||||
|
|
||||||
|
# plot
|
||||||
|
ax1[1, i].set_title('reference: {:.2f} K'.format(trans_temp))
|
||||||
|
ax1[1, i].set_xlabel('T / K')
|
||||||
|
|
||||||
|
ax1[1, i].plot(reference_data[0], reference_data[1], 'r-')
|
||||||
|
ax1[1, i].plot(ref_zoom[0, max_grad], ref_zoom[0, max_grad], 'kx')
|
||||||
|
ax1[1, i].plot(ref_zoom[0], onset, 'k--')
|
||||||
|
ax1[1, i].axhline(0, color='k', linestyle='--')
|
||||||
|
|
||||||
|
ax1[1, i].set_xlim(ref_zoom[0, integration_limit[0]], ref_zoom[0, integration_limit[1]])
|
||||||
|
ax1[1, i].set_ylim(-max(ref_zoom[1])/10, max(ref_zoom[1])*1.1)
|
||||||
|
|
||||||
|
print('Onset of transition: {:.2f} K, should be at {:.2f}'.format(melts[-1], trans_temp))
|
||||||
|
if enthalpy is not None:
|
||||||
|
# integrate over low temperature peak to calibrate y axis
|
||||||
|
# NOTE: again, this is only valid for cyclohexane
|
||||||
|
# delta H in J/g: Integrate Peak over time and divide by weight
|
||||||
|
area = 1e-3 * simps(ref_zoom[1, integration_limit[0]:integration_limit[1]],
|
||||||
|
ref_zoom[2, integration_limit[0]:integration_limit[1]],
|
||||||
|
even='avg')
|
||||||
|
calib_y_axis = enthalpy / (area / reference.weight)
|
||||||
|
print("Calibration factor of peak: {}".format(calib_y_axis))
|
||||||
|
|
||||||
|
sample_baseline[1] *= calib_y_axis
|
||||||
|
|
||||||
|
fig1.delaxes(ax1[1, 2])
|
||||||
|
fig1.tight_layout()
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
# give a choice how to compensate for long-time drift
|
||||||
|
mode = None
|
||||||
|
while mode not in ['i', 'h']:
|
||||||
|
mode = input('\nUse [i]sotherms or initial [h]eating for long-time correction? (Default: i) ')
|
||||||
|
if mode == '':
|
||||||
|
mode = 'i'
|
||||||
|
|
||||||
|
if mode == 'h':
|
||||||
|
print('\nCorrect slope from initial heating')
|
||||||
|
sample_baseline[1] = drift_from_slope
|
||||||
|
else:
|
||||||
|
print('\nCorrect slope from isotherm')
|
||||||
|
sample_baseline[1] = drift_corrected
|
||||||
|
|
||||||
|
# calibrate T axis
|
||||||
|
print('\nCalibrate temperature')
|
||||||
|
real_trans = np.array([ref_points.transition1, ref_points.transition2])
|
||||||
|
t_vals = np.array([[melts[0], 1],
|
||||||
|
[melts[1], 1]])
|
||||||
|
calibration_temp = np.linalg.solve(t_vals, real_trans)
|
||||||
|
print('T_real = {:.4f} * T_meas {:+.4f}'.format(*calibration_temp))
|
||||||
|
|
||||||
|
sample_baseline[0] = calibration_temp[0] * sample_baseline[0] + calibration_temp[1]
|
||||||
|
|
||||||
|
print('Convert to capacity')
|
||||||
|
cp = sample_baseline[1] * 60. / rate / sample.weight / 1000.
|
||||||
|
if sample.weight is None:
|
||||||
|
raise ValueError('No sample weight given')
|
||||||
|
|
||||||
|
# plot final results in separate figure
|
||||||
|
fig2, ax2 = plt.subplots()
|
||||||
|
ax2.set_title('{} K/min: Heat flow vs. heat capacity (close to cont.)'.format(rate))
|
||||||
|
ax2.set_xlabel('Temperature / K')
|
||||||
|
|
||||||
|
ax2.plot(sample_baseline[0], sample_baseline[1], label='heat flow')
|
||||||
|
ax2.plot(sample_baseline[0], cp, label='heat capacity')
|
||||||
|
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
outname = os.path.splitext(sample.name)[0] + '_' + str(rate) + 'K-min.dat'
|
||||||
|
header = 'Made with version: {}\n'.format(__version__)
|
||||||
|
header += 'T/K\tCp/J/(gK)\theat flow/mW'
|
||||||
|
|
||||||
|
print()
|
||||||
|
print('Save to', outname)
|
||||||
|
np.savetxt(outname, np.c_[sample_baseline[0], cp, sample_baseline[1]], header=header)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = parser.parse_args()
|
||||||
|
evaluate(args.sample, args.empty, args.reference, show_cooling=args.cooling)
|
7
nmreval/fit/__init__.py
Normal file
7
nmreval/fit/__init__.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
|
EPS = np.finfo(float).eps
|
||||||
|
|
||||||
|
|
||||||
|
class FitException(BaseException):
|
||||||
|
pass
|
161
nmreval/fit/_meta.py
Normal file
161
nmreval/fit/_meta.py
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
from typing import Union, Callable, Any
|
||||||
|
import operator
|
||||||
|
|
||||||
|
from inspect import signature, Parameter
|
||||||
|
|
||||||
|
|
||||||
|
class ModelFactory:
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_from_list(funcs: list, left=None, func_order=None, param_len=None, left_cnt=None):
|
||||||
|
if func_order is None:
|
||||||
|
func_order = []
|
||||||
|
|
||||||
|
if param_len is None:
|
||||||
|
param_len = []
|
||||||
|
|
||||||
|
for func in funcs:
|
||||||
|
if not func['active']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
func_order.append(func['cnt'])
|
||||||
|
param_len.append(len(func['func'].params))
|
||||||
|
|
||||||
|
if func['children']:
|
||||||
|
right, _, _ = ModelFactory.create_from_list(func['children'], left=func['func'], left_cnt=func['pos'],
|
||||||
|
func_order=func_order, param_len=param_len)
|
||||||
|
right_cnt = None
|
||||||
|
else:
|
||||||
|
right = func['func']
|
||||||
|
right_cnt = func['pos']
|
||||||
|
|
||||||
|
if left is None:
|
||||||
|
left = right
|
||||||
|
left_cnt = right_cnt
|
||||||
|
else:
|
||||||
|
left = MultiModel(left, right, func['op'],
|
||||||
|
left_idx=left_cnt, right_idx=right_cnt)
|
||||||
|
|
||||||
|
return left, func_order, param_len
|
||||||
|
|
||||||
|
|
||||||
|
class MultiModel:
|
||||||
|
op_repr = {operator.add: ' + ', operator.mul: ' * ', operator.sub: ' - ', operator.truediv: ' / '}
|
||||||
|
str_op = {'+': operator.add, '*': operator.mul, '-': operator.sub, '/': operator.truediv}
|
||||||
|
int_op = {0: operator.add, 1: operator.mul, 2: operator.sub, 3: operator.truediv}
|
||||||
|
|
||||||
|
def __init__(self, left: Any, right: Any, op: Union[str, Callable, int] = '+', left_idx=0, right_idx=1):
|
||||||
|
self._left = left
|
||||||
|
self._right = right
|
||||||
|
|
||||||
|
self._op = None
|
||||||
|
|
||||||
|
if isinstance(op, str):
|
||||||
|
self._op = MultiModel.str_op.get(op, None)
|
||||||
|
elif isinstance(op, int):
|
||||||
|
self._op = MultiModel.int_op.get(op, None)
|
||||||
|
elif isinstance(op, Callable):
|
||||||
|
self._op = op
|
||||||
|
|
||||||
|
if self._op is None:
|
||||||
|
raise ValueError('Invalid binary operator.')
|
||||||
|
|
||||||
|
self.name = '('
|
||||||
|
self.params = []
|
||||||
|
self.bounds = []
|
||||||
|
self._kwargs_right = {}
|
||||||
|
self._kwargs_left = {}
|
||||||
|
self._fun_kwargs = {}
|
||||||
|
|
||||||
|
# mapping kwargs to kwargs of underlying functions
|
||||||
|
self._ext_int_kw = {}
|
||||||
|
|
||||||
|
self._get_parameter(left, 'l', left_idx)
|
||||||
|
self._param_left = len(left.params)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.name += MultiModel.op_repr[self._op]
|
||||||
|
except KeyError:
|
||||||
|
self.name += str(op)
|
||||||
|
|
||||||
|
self._get_parameter(right, 'r', right_idx)
|
||||||
|
self.name += ')'
|
||||||
|
|
||||||
|
self._param_len = len(self.params)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def _get_parameter(self, func, pos, idx):
|
||||||
|
kw_dict = {'l': self._kwargs_left, 'r': self._kwargs_right}[pos]
|
||||||
|
|
||||||
|
if isinstance(func, MultiModel):
|
||||||
|
strcnt = ''
|
||||||
|
kw_dict.update(func.fun_kwargs)
|
||||||
|
self._fun_kwargs.update({k: v for k, v in kw_dict.items()})
|
||||||
|
self._ext_int_kw.update({k: k for k in kw_dict.keys()})
|
||||||
|
|
||||||
|
else:
|
||||||
|
temp_dic = {k: v.default for k, v in signature(func.func).parameters.items()
|
||||||
|
if v.default is not Parameter.empty}
|
||||||
|
|
||||||
|
for k, v in temp_dic.items():
|
||||||
|
key_ = '%s_%d' % (k, idx)
|
||||||
|
kw_dict[key_] = v
|
||||||
|
self._fun_kwargs[key_] = v
|
||||||
|
self._ext_int_kw[key_] = k
|
||||||
|
|
||||||
|
strcnt = '(%d)' % idx
|
||||||
|
|
||||||
|
self.params += [pp+strcnt for pp in func.params]
|
||||||
|
self.name += func.name + strcnt
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.bounds.extend(func.bounds)
|
||||||
|
except AttributeError:
|
||||||
|
self.bounds.extend([(None, None)]*len(func.params))
|
||||||
|
|
||||||
|
def _left_arguments(self, *args, **kwargs):
|
||||||
|
kw_left = {k_int: kwargs[k_ext] for k_ext, k_int in self._ext_int_kw.items() if k_ext in self._kwargs_left}
|
||||||
|
pl = args[:self._param_left]
|
||||||
|
|
||||||
|
return pl, kw_left
|
||||||
|
|
||||||
|
def _right_arguments(self, *args, **kwargs):
|
||||||
|
kw_right = {k_int: kwargs[k_ext] for k_ext, k_int in self._ext_int_kw.items() if k_ext in self._kwargs_right}
|
||||||
|
pr = args[self._param_left:self._param_len]
|
||||||
|
|
||||||
|
return pr, kw_right
|
||||||
|
|
||||||
|
def func(self, x, *args, **kwargs):
|
||||||
|
pl, kw_left = self._left_arguments(*args, **kwargs)
|
||||||
|
l_func = self._left.func(x, *pl, **kw_left)
|
||||||
|
|
||||||
|
pr, kw_right = self._right_arguments(*args, **kwargs)
|
||||||
|
r_func = self._right.func(x, *pr, **kw_right)
|
||||||
|
|
||||||
|
return self._op(l_func, r_func)
|
||||||
|
|
||||||
|
def left_func(self, x, *args, **kwargs):
|
||||||
|
return self._left.func(x, *args, **kwargs)
|
||||||
|
|
||||||
|
def right_func(self, x, *args, **kwargs):
|
||||||
|
return self._right.func(x, *args, **kwargs)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def fun_kwargs(self):
|
||||||
|
return self._fun_kwargs
|
||||||
|
|
||||||
|
def subs(self, x, *args, **kwargs):
|
||||||
|
""" Iterator over all sub-functions (depth-first and left-to-right) """
|
||||||
|
pl, kw_left = self._left_arguments(*args, **kwargs)
|
||||||
|
if isinstance(self._left, MultiModel):
|
||||||
|
yield from self._left.subs(x, *pl, **kw_left)
|
||||||
|
else:
|
||||||
|
yield self._left.func(x, *pl, **kw_left)
|
||||||
|
|
||||||
|
pr, kw_right = self._right_arguments(*args, **kwargs)
|
||||||
|
if isinstance(self._right, MultiModel):
|
||||||
|
yield from self._right.subs(x, *pr, **kw_right)
|
||||||
|
else:
|
||||||
|
yield self._right.func(x, *pr, **kw_right)
|
149
nmreval/fit/data.py
Normal file
149
nmreval/fit/data.py
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from .model import Model
|
||||||
|
from .parameter import Parameters
|
||||||
|
|
||||||
|
|
||||||
|
class Data(object):
|
||||||
|
def __init__(self, x, y, we=None, idx=None):
|
||||||
|
self.x = np.asarray(x)
|
||||||
|
self.y = np.asarray(y)
|
||||||
|
if self.y.shape[0] != self.x.shape[0]:
|
||||||
|
raise ValueError(f'x and y have different lengths {self.x.shape[0]} and {self.y.shape[0]}')
|
||||||
|
|
||||||
|
self.we = self._calc_weights(we)
|
||||||
|
self.idx = idx
|
||||||
|
self.model = None
|
||||||
|
self.minimizer = None
|
||||||
|
self.parameter = Parameters()
|
||||||
|
self.para_keys = None
|
||||||
|
self.fun_kwargs = {}
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return self.y.shape[0]
|
||||||
|
|
||||||
|
def _calc_weights(self, we):
|
||||||
|
if we is None:
|
||||||
|
return 1.
|
||||||
|
|
||||||
|
if isinstance(we, str):
|
||||||
|
if we == 'y2':
|
||||||
|
we_func = lambda yy: 1. / yy**2
|
||||||
|
elif we.lower() == 'none':
|
||||||
|
we_func = lambda yy: np.ones_like(len(yy))
|
||||||
|
else:
|
||||||
|
we_func = lambda yy: 1. / np.abs(yy)
|
||||||
|
|
||||||
|
if np.iscomplexobj(self.y):
|
||||||
|
weights = we_func(np.r_[self.y.real, self.y.imag])
|
||||||
|
else:
|
||||||
|
weights = we_func(self.y)
|
||||||
|
|
||||||
|
else:
|
||||||
|
we = 1. / np.asarray(we)
|
||||||
|
if np.iscomplexobj(self.y):
|
||||||
|
if np.iscomplexobj(we):
|
||||||
|
weights = np.r_[we.real, we.imag]
|
||||||
|
else:
|
||||||
|
weights = np.tile(we)
|
||||||
|
else:
|
||||||
|
weights = we
|
||||||
|
|
||||||
|
weights[weights == np.inf] = np.finfo(float).max
|
||||||
|
|
||||||
|
return weights
|
||||||
|
|
||||||
|
def set_model(self, func, *args, **kwargs):
|
||||||
|
if isinstance(func, Model):
|
||||||
|
self.model = func
|
||||||
|
else:
|
||||||
|
self.model = Model(func, *args)
|
||||||
|
|
||||||
|
self.fun_kwargs.update(self.model.fun_kwargs)
|
||||||
|
self.fun_kwargs.update(kwargs)
|
||||||
|
self.parameter = Parameters()
|
||||||
|
|
||||||
|
return self.model
|
||||||
|
|
||||||
|
def get_model(self):
|
||||||
|
return self.model
|
||||||
|
|
||||||
|
def set_parameter(self, parameter, var=None, ub=None, lb=None,
|
||||||
|
default_bounds=False, fun_kwargs=None):
|
||||||
|
"""
|
||||||
|
Creates parameter for this data.
|
||||||
|
If no Model is available, it falls back to the model
|
||||||
|
:param parameter: list of parameters
|
||||||
|
:param var: list of boolean or boolean; False fixes parameter at given list index.
|
||||||
|
Single value is broadcast to all parameter
|
||||||
|
:param ub: list of upper boundaries or float; Single value is broadcast to all parameter.
|
||||||
|
None means no bound.
|
||||||
|
:param lb: list of lower bounds or float; Single value is broadcast to all parameter.
|
||||||
|
None means no bound.
|
||||||
|
:param default_bounds: bool; If True, uses default_bounds of a Model if lb or ub are None
|
||||||
|
:param fun_kwargs: dict; key-word arguments for model,
|
||||||
|
:return: Parameters
|
||||||
|
"""
|
||||||
|
model = self.model
|
||||||
|
if model is None:
|
||||||
|
# Data has no unique
|
||||||
|
if self.minimizer is None:
|
||||||
|
model = None
|
||||||
|
else:
|
||||||
|
model = self.minimizer.fit_model
|
||||||
|
self.fun_kwargs.update(model.fun_kwargs)
|
||||||
|
|
||||||
|
if model is None:
|
||||||
|
raise ValueError('No model found, please set model before parameters')
|
||||||
|
|
||||||
|
if default_bounds:
|
||||||
|
if lb is None:
|
||||||
|
lb = model.lb
|
||||||
|
if ub is None:
|
||||||
|
ub = model.ub
|
||||||
|
|
||||||
|
self.para_keys = self.parameter.add_parameter(parameter, var=var, lb=lb, ub=ub)
|
||||||
|
|
||||||
|
if fun_kwargs is not None:
|
||||||
|
self.fun_kwargs.update(fun_kwargs)
|
||||||
|
|
||||||
|
return self.para_keys
|
||||||
|
|
||||||
|
def get_parameter(self, scaled: bool = False):
|
||||||
|
"""
|
||||||
|
Returns list of parameters if set.
|
||||||
|
:param scaled: If True, returns scaled values, otherwise unscaled
|
||||||
|
:return: parameter array
|
||||||
|
"""
|
||||||
|
if self.parameter is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
if scaled:
|
||||||
|
return [p.scaled_value for p in self.minimizer.parameters[self.parameter]]
|
||||||
|
else:
|
||||||
|
return [p.value for p in self.minimizer.parameters[self.parameter]]
|
||||||
|
|
||||||
|
def cost(self, p):
|
||||||
|
"""
|
||||||
|
Cost function :math:`y-f(p, x)`
|
||||||
|
:param p: list of parameters
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
y_pred = self.model.func(p, self.x, **self.fun_kwargs)
|
||||||
|
resid = y_pred - self.y
|
||||||
|
|
||||||
|
if np.iscomplexobj(resid):
|
||||||
|
resid = np.r_[resid.real, resid.imag]
|
||||||
|
|
||||||
|
resid *= self.we
|
||||||
|
|
||||||
|
return resid
|
||||||
|
|
||||||
|
def func(self, p, x):
|
||||||
|
"""
|
||||||
|
Function :math:`f(p, x)`
|
||||||
|
:param x:
|
||||||
|
:param p: list of parameters
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
return self.model.func(p, x, **self.fun_kwargs)
|
489
nmreval/fit/minimizer.py
Normal file
489
nmreval/fit/minimizer.py
Normal file
@ -0,0 +1,489 @@
|
|||||||
|
import warnings
|
||||||
|
from itertools import product
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import scipy.linalg as la
|
||||||
|
from scipy import optimize
|
||||||
|
import scipy.odr as odr
|
||||||
|
|
||||||
|
from .data import Data
|
||||||
|
from .model import Model
|
||||||
|
from . import EPS
|
||||||
|
from .parameter import Parameters
|
||||||
|
from .result import FitResultCreator
|
||||||
|
|
||||||
|
__all__ = ['FitRoutine', 'FitAbortException']
|
||||||
|
|
||||||
|
|
||||||
|
class FitAbortException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class FitRoutine(object):
|
||||||
|
def __init__(self, mode='lsq'):
|
||||||
|
self._fitmethod = mode
|
||||||
|
self.data = []
|
||||||
|
self.fit_model = None
|
||||||
|
self._no_own_model = []
|
||||||
|
self.parameter = Parameters()
|
||||||
|
self.result = []
|
||||||
|
self.linked = []
|
||||||
|
self._abort = False
|
||||||
|
|
||||||
|
def add_data(self, x, y=None, we=None, idx=None):
|
||||||
|
if isinstance(x, Data):
|
||||||
|
d = x
|
||||||
|
|
||||||
|
else:
|
||||||
|
_x = np.asarray(x)
|
||||||
|
if _x.ndim == 2 and _x.shape[1] == 2:
|
||||||
|
d = Data(*x, we=we)
|
||||||
|
|
||||||
|
elif y is None:
|
||||||
|
raise ValueError('First argument must be of type Data, 2d-array, '
|
||||||
|
'or second argument must be given')
|
||||||
|
|
||||||
|
else:
|
||||||
|
d = Data(x, y, we=we, idx=idx)
|
||||||
|
|
||||||
|
if idx is not None:
|
||||||
|
d.idx = idx
|
||||||
|
d.minimizer = self
|
||||||
|
self.data.append(d)
|
||||||
|
self.result.append(None)
|
||||||
|
|
||||||
|
return d
|
||||||
|
|
||||||
|
def remove_data(self, data):
|
||||||
|
try:
|
||||||
|
idx = self.data.index(data)
|
||||||
|
_ = self.data.pop(idx)
|
||||||
|
self.result.pop(idx)
|
||||||
|
|
||||||
|
except ValueError:
|
||||||
|
raise IndexError('Data {} not found'.format(data))
|
||||||
|
|
||||||
|
def set_model(self, func, *args, idx=None, **kwargs):
|
||||||
|
if isinstance(func, Model):
|
||||||
|
model = func
|
||||||
|
else:
|
||||||
|
model = Model(func, *args, **kwargs)
|
||||||
|
|
||||||
|
if idx is not None:
|
||||||
|
for i, data in enumerate(self.data):
|
||||||
|
if data.idx == idx:
|
||||||
|
data.set_model(model)
|
||||||
|
else:
|
||||||
|
self.fit_model = model
|
||||||
|
|
||||||
|
return self.fit_model
|
||||||
|
|
||||||
|
def set_link_parameter(self, parameter: tuple, replacement: tuple):
|
||||||
|
if isinstance(replacement[0], Model):
|
||||||
|
if replacement[1] not in replacement[0].global_parameter:
|
||||||
|
raise KeyError(f'Parameter at pos {replacement[1]} of '
|
||||||
|
f'model {str(replacement[0])} is not global')
|
||||||
|
|
||||||
|
if isinstance(parameter[0], Model):
|
||||||
|
warnings.warn(f'Replaced parameter at pos {parameter[1]} in {str(parameter[0])} '
|
||||||
|
f'becomes global with linkage.')
|
||||||
|
|
||||||
|
self.linked.append((*parameter, *replacement))
|
||||||
|
|
||||||
|
def prepare_links(self):
|
||||||
|
self._no_own_model = []
|
||||||
|
self.parameter = Parameters()
|
||||||
|
_found_models = {}
|
||||||
|
linked_sender = {}
|
||||||
|
|
||||||
|
for v in self.data:
|
||||||
|
linked_sender[v] = set()
|
||||||
|
self.parameter.update(v.parameter.copy())
|
||||||
|
|
||||||
|
# set temporaray model
|
||||||
|
if v.model is None:
|
||||||
|
v.model = self.fit_model
|
||||||
|
self._no_own_model.append(v)
|
||||||
|
|
||||||
|
# register model
|
||||||
|
if v.model not in _found_models:
|
||||||
|
_found_models[v.model] = []
|
||||||
|
m_param = v.model.parameter.copy()
|
||||||
|
self.parameter.update(m_param)
|
||||||
|
|
||||||
|
_found_models[v.model].append(v)
|
||||||
|
|
||||||
|
if v.model not in linked_sender:
|
||||||
|
linked_sender[v.model] = set()
|
||||||
|
|
||||||
|
linked_parameter = {}
|
||||||
|
for par, par_parm, repl, repl_par in self.linked:
|
||||||
|
if isinstance(par, Data):
|
||||||
|
if isinstance(repl, Data):
|
||||||
|
linked_parameter[par.para_keys[par_parm]] = repl.para_keys[repl_par]
|
||||||
|
else:
|
||||||
|
linked_parameter[par.para_keys[par_parm]] = repl.global_parameter[repl_par]
|
||||||
|
|
||||||
|
else:
|
||||||
|
if isinstance(repl, Data):
|
||||||
|
par.global_parameter[par_parm] = repl.para_keys[repl_par]
|
||||||
|
else:
|
||||||
|
par.global_parameter[par_parm] = repl.global_parameter[repl_par]
|
||||||
|
|
||||||
|
linked_sender[repl].add(par)
|
||||||
|
linked_sender[par].add(repl)
|
||||||
|
|
||||||
|
for mm, m_data in _found_models.items():
|
||||||
|
if mm.global_parameter:
|
||||||
|
for dd in m_data:
|
||||||
|
linked_sender[mm].add(dd)
|
||||||
|
linked_sender[dd].add(mm)
|
||||||
|
|
||||||
|
coupled_data = []
|
||||||
|
visited_data = []
|
||||||
|
for s in linked_sender.keys():
|
||||||
|
if s in visited_data:
|
||||||
|
continue
|
||||||
|
sub_graph = []
|
||||||
|
self.find_paths(s, linked_sender, sub_graph, visited_data)
|
||||||
|
if sub_graph:
|
||||||
|
coupled_data.append(sub_graph)
|
||||||
|
|
||||||
|
return coupled_data, linked_parameter
|
||||||
|
|
||||||
|
def find_paths(self, start, graph, coupled_nodes=None, visited_nodes=None):
|
||||||
|
visited_nodes.append(start)
|
||||||
|
if isinstance(start, Data):
|
||||||
|
coupled_nodes.append(start)
|
||||||
|
|
||||||
|
for neighbor in graph[start]:
|
||||||
|
if neighbor in visited_nodes:
|
||||||
|
continue
|
||||||
|
|
||||||
|
self.find_paths(neighbor, graph, coupled_nodes, visited_nodes)
|
||||||
|
|
||||||
|
def abort(self):
|
||||||
|
print('ABORT ???')
|
||||||
|
self._abort = True
|
||||||
|
|
||||||
|
def run(self, mode='lsq'):
|
||||||
|
self._abort = False
|
||||||
|
self.parameter = Parameters()
|
||||||
|
|
||||||
|
fit_groups, linked_parameter = self.prepare_links()
|
||||||
|
|
||||||
|
for data_groups in fit_groups:
|
||||||
|
if len(data_groups) == 1 and not self.linked:
|
||||||
|
data = data_groups[0]
|
||||||
|
# get variable parameter for fitter
|
||||||
|
p0_k, lb_k, ub_k, var_pars_k = self._prep_data(data)
|
||||||
|
|
||||||
|
if mode == 'lsq':
|
||||||
|
self._least_squares_single(data, p0_k, lb_k, ub_k, var_pars_k)
|
||||||
|
|
||||||
|
elif mode == 'nm':
|
||||||
|
self._nm_single(data, p0_k, lb_k, ub_k, var_pars_k)
|
||||||
|
|
||||||
|
elif mode == 'odr':
|
||||||
|
# ODR takes no bounds
|
||||||
|
self._odr_single(data, p0_k, var_pars_k)
|
||||||
|
|
||||||
|
else:
|
||||||
|
data_pars, p0, lb, ub, var_pars = self._prep_global(data_groups, linked_parameter)
|
||||||
|
|
||||||
|
if mode == 'lsq':
|
||||||
|
self._least_squares_global(data_groups, p0, lb, ub, var_pars, data_pars)
|
||||||
|
|
||||||
|
elif mode == 'nm':
|
||||||
|
self._nm_global(data_groups, p0, lb, ub, var_pars, data_pars)
|
||||||
|
|
||||||
|
elif mode == 'odr':
|
||||||
|
self._odr_global(data_groups, p0, var_pars, data_pars)
|
||||||
|
|
||||||
|
self.unprep_run()
|
||||||
|
|
||||||
|
return self.result
|
||||||
|
|
||||||
|
def _prep_data(self, data):
|
||||||
|
if data.get_model() is None:
|
||||||
|
data._model = self.fit_model
|
||||||
|
self._no_own_model.append(data)
|
||||||
|
|
||||||
|
return self._prep_parameter(data.parameter)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _prep_parameter(parameter):
|
||||||
|
vals = []
|
||||||
|
var_pars = []
|
||||||
|
for p_k, v_k in parameter.items():
|
||||||
|
if v_k.var:
|
||||||
|
vals.append([v_k.scaled_value, v_k.lb / v_k.scale, v_k.ub / v_k.scale])
|
||||||
|
var_pars.append(p_k)
|
||||||
|
|
||||||
|
pp, lb, ub = zip(*vals)
|
||||||
|
|
||||||
|
return pp, lb, ub, var_pars
|
||||||
|
|
||||||
|
def _prep_global(self, data_group, linked):
|
||||||
|
p0 = []
|
||||||
|
lb = []
|
||||||
|
ub = []
|
||||||
|
var = []
|
||||||
|
data_pars = []
|
||||||
|
|
||||||
|
# loopyloop over data that belong to one fit (linked or global)
|
||||||
|
for data in data_group:
|
||||||
|
actual_pars = []
|
||||||
|
for i, (p_k, v_k) in enumerate(data.parameter.items()):
|
||||||
|
p_k_used = p_k
|
||||||
|
v_k_used = v_k
|
||||||
|
|
||||||
|
# is parameter replaced by global parameter?
|
||||||
|
if i in data.model.global_parameter:
|
||||||
|
p_k_used = data.model.global_parameter[i]
|
||||||
|
v_k_used = self.parameter[p_k_used]
|
||||||
|
|
||||||
|
# links trump global parameter
|
||||||
|
if p_k_used in linked:
|
||||||
|
p_k_used = linked[p_k_used]
|
||||||
|
v_k_used = self.parameter[p_k_used]
|
||||||
|
|
||||||
|
actual_pars.append(p_k_used)
|
||||||
|
# parameter is variable and was not found before as shared parameter
|
||||||
|
if v_k_used.var and p_k_used not in var:
|
||||||
|
p0.append(v_k_used.scaled_value)
|
||||||
|
lb.append(v_k_used.lb / v_k_used.scale)
|
||||||
|
ub.append(v_k_used.ub / v_k_used.scale)
|
||||||
|
var.append(p_k_used)
|
||||||
|
|
||||||
|
data_pars.append(actual_pars)
|
||||||
|
|
||||||
|
return data_pars, p0, lb, ub, var
|
||||||
|
|
||||||
|
def unprep_run(self):
|
||||||
|
for d in self._no_own_model:
|
||||||
|
d._model = None
|
||||||
|
|
||||||
|
self._no_own_model = []
|
||||||
|
|
||||||
|
# COST FUNCTIONS: f(x) - y (least_square, minimize), and f(x) (ODR)
|
||||||
|
def __cost_scipy(self, p, data, varpars, used_pars):
|
||||||
|
for keys, values in zip(varpars, p):
|
||||||
|
self.parameter[keys].scaled_value = values
|
||||||
|
|
||||||
|
actual_parameters = [self.parameter[keys].value for keys in used_pars]
|
||||||
|
return data.cost(actual_parameters)
|
||||||
|
|
||||||
|
def __cost_odr(self, p, data, varpars, used_pars):
|
||||||
|
for keys, values in zip(varpars, p):
|
||||||
|
self.parameter[keys].scaled_value = values
|
||||||
|
|
||||||
|
actual_parameters = [self.parameter[keys].value for keys in used_pars]
|
||||||
|
|
||||||
|
return data.func(actual_parameters, data.x)
|
||||||
|
|
||||||
|
def __cost_scipy_glob(self, p, data, varpars, used_pars):
|
||||||
|
# replace values
|
||||||
|
for keys, values in zip(varpars, p):
|
||||||
|
self.parameter[keys].scaled_value = values
|
||||||
|
|
||||||
|
r = []
|
||||||
|
# unpack parameter and calculate y values and concatenate all
|
||||||
|
for values, p_idx in zip(data, used_pars):
|
||||||
|
actual_parameters = [self.parameter[keys].value for keys in p_idx]
|
||||||
|
r = np.r_[r, values.cost(actual_parameters)]
|
||||||
|
|
||||||
|
return r
|
||||||
|
|
||||||
|
def __cost_odr_glob(self, p, data, varpars, used_pars):
|
||||||
|
# replace values
|
||||||
|
for keys, values in zip(varpars, p):
|
||||||
|
self.parameter[keys].scaled_value = values
|
||||||
|
|
||||||
|
r = []
|
||||||
|
# unpack parameter and calculate y values and concatenate all
|
||||||
|
for values, p_idx in zip(data, used_pars):
|
||||||
|
actual_parameters = [self.parameter[keys].value for keys in p_idx]
|
||||||
|
r = np.r_[r, values.func(actual_parameters, values.x)]
|
||||||
|
|
||||||
|
return r
|
||||||
|
|
||||||
|
def _least_squares_single(self, data, p0, lb, ub, var):
|
||||||
|
def cost(p):
|
||||||
|
if self._abort:
|
||||||
|
raise FitAbortException(f'Fit aborted by user')
|
||||||
|
|
||||||
|
return self.__cost_scipy(p, data, var, data.para_keys)
|
||||||
|
|
||||||
|
with np.errstate(all='ignore'):
|
||||||
|
res = optimize.least_squares(cost, p0, bounds=(lb, ub), max_nfev=1000 * len(p0))
|
||||||
|
|
||||||
|
err, corr, partial_corr = self._calc_error(res.jac, np.sum(res.fun**2), *res.jac.shape)
|
||||||
|
self.make_results(data, res.x, var, data.para_keys, res.jac.shape,
|
||||||
|
err=err, corr=corr, partial_corr=partial_corr)
|
||||||
|
|
||||||
|
def _least_squares_global(self, data, p0, lb, ub, var, data_pars):
|
||||||
|
def cost(p):
|
||||||
|
if self._abort:
|
||||||
|
raise FitAbortException(f'Fit aborted by user')
|
||||||
|
return self.__cost_scipy_glob(p, data, var, data_pars)
|
||||||
|
|
||||||
|
with np.errstate(all='ignore'):
|
||||||
|
res = optimize.least_squares(cost, p0, bounds=(lb, ub), max_nfev=1000 * len(p0))
|
||||||
|
|
||||||
|
err, corr, partial_corr = self._calc_error(res.jac, np.sum(res.fun**2), *res.jac.shape)
|
||||||
|
for v, var_pars_k in zip(data, data_pars):
|
||||||
|
self.make_results(v, res.x, var, var_pars_k, res.jac.shape,
|
||||||
|
err=err, corr=corr, partial_corr=partial_corr)
|
||||||
|
|
||||||
|
def _nm_single(self, data, p0, lb, ub, var):
|
||||||
|
def cost(p):
|
||||||
|
if self._abort:
|
||||||
|
raise FitAbortException(f'Fit aborted by user')
|
||||||
|
return (self.__cost_scipy(p, data, var, data.para_keys)**2).sum()
|
||||||
|
|
||||||
|
with np.errstate(all='ignore'):
|
||||||
|
res = optimize.minimize(cost, p0, bounds=[(b1, b2) for (b1, b2) in zip(lb, ub)],
|
||||||
|
method='Nelder-Mead', options={'maxiter': 1000 * len(p0)})
|
||||||
|
|
||||||
|
self.make_results(data, res.x, var, data.para_keys, (len(data), len(p0)))
|
||||||
|
|
||||||
|
def _nm_global(self, data, p0, lb, ub, var, data_pars):
|
||||||
|
def cost(p):
|
||||||
|
if self._abort:
|
||||||
|
raise FitAbortException(f'Fit aborted by user')
|
||||||
|
return (self.__cost_scipy_glob(p, data, var, data_pars)**2).sum()
|
||||||
|
|
||||||
|
with np.errstate(all='ignore'):
|
||||||
|
res = optimize.minimize(cost, p0, bounds=[(b1, b2) for (b1, b2) in zip(lb, ub)],
|
||||||
|
method='Nelder-Mead', options={'maxiter': 1000 * len(p0)})
|
||||||
|
|
||||||
|
for v, var_pars_k in zip(data, data_pars):
|
||||||
|
self.make_results(v, res.x, var, var_pars_k, (sum(len(d) for d in data), len(p0)))
|
||||||
|
|
||||||
|
def _odr_single(self, data, p0, var_pars):
|
||||||
|
odr_data = odr.Data(data.x, data.y)
|
||||||
|
|
||||||
|
def func(p, _):
|
||||||
|
if self._abort:
|
||||||
|
raise FitAbortException(f'Fit aborted by user')
|
||||||
|
return self.__cost_odr(p, data, var_pars, data.para_keys)
|
||||||
|
|
||||||
|
odr_model = odr.Model(func)
|
||||||
|
|
||||||
|
o = odr.ODR(odr_data, odr_model, beta0=p0)
|
||||||
|
res = o.run()
|
||||||
|
|
||||||
|
corr = res.cov_beta / (res.sd_beta[:, None] * res.sd_beta[None, :]) * res.res_var
|
||||||
|
try:
|
||||||
|
corr_inv = np.linalg.inv(corr)
|
||||||
|
corr_inv_diag = np.diag(np.sqrt(1 / np.diag(corr_inv)))
|
||||||
|
partial_corr = -1. * np.dot(np.dot(corr_inv_diag, corr_inv), corr_inv_diag) # Partial correlation matrix
|
||||||
|
partial_corr[np.diag_indices_from(partial_corr)] = 1.
|
||||||
|
except np.linalg.LinAlgError:
|
||||||
|
partial_corr = corr
|
||||||
|
|
||||||
|
self.make_results(data, res.beta, var_pars, data.para_keys, (len(data), len(p0)),
|
||||||
|
err=res.sd_beta, corr=corr, partial_corr=partial_corr)
|
||||||
|
|
||||||
|
def _odr_global(self, data, p0, var, data_pars):
|
||||||
|
def func(p, _):
|
||||||
|
if self._abort:
|
||||||
|
raise FitAbortException(f'Fit aborted by user')
|
||||||
|
return self.__cost_odr_glob(p, data, var, data_pars)
|
||||||
|
|
||||||
|
x = []
|
||||||
|
y = []
|
||||||
|
for d in data:
|
||||||
|
x = np.r_[x, d.x]
|
||||||
|
y = np.r_[y, d.y]
|
||||||
|
|
||||||
|
odr_data = odr.Data(x, y)
|
||||||
|
odr_model = odr.Model(func)
|
||||||
|
|
||||||
|
o = odr.ODR(odr_data, odr_model, beta0=p0, ifixb=var)
|
||||||
|
res = o.run()
|
||||||
|
|
||||||
|
corr = res.cov_beta / (res.sd_beta[:, None] * res.sd_beta[None, :]) * res.res_var
|
||||||
|
try:
|
||||||
|
corr_inv = np.linalg.inv(corr)
|
||||||
|
corr_inv_diag = np.diag(np.sqrt(1 / np.diag(corr_inv)))
|
||||||
|
partial_corr = -1. * np.dot(np.dot(corr_inv_diag, corr_inv), corr_inv_diag) # Partial correlation matrix
|
||||||
|
partial_corr[np.diag_indices_from(partial_corr)] = 1.
|
||||||
|
except np.linalg.LinAlgError:
|
||||||
|
partial_corr = corr
|
||||||
|
|
||||||
|
for v, var_pars_k in zip(data, data_pars):
|
||||||
|
self.make_results(v, res.beta, var, var_pars_k, (sum(len(d) for d in data), len(p0)),
|
||||||
|
err=res.sd_beta, corr=corr, partial_corr=partial_corr)
|
||||||
|
|
||||||
|
def make_results(self, data, p, var_pars, used_pars, shape,
|
||||||
|
err=None, corr=None, partial_corr=None):
|
||||||
|
|
||||||
|
if err is None:
|
||||||
|
err = [0] * len(p)
|
||||||
|
|
||||||
|
# update parameter values
|
||||||
|
for keys, p_value, err_value in zip(var_pars, p, err):
|
||||||
|
self.parameter[keys].scaled_value = p_value
|
||||||
|
self.parameter[keys].scaled_error = err_value
|
||||||
|
|
||||||
|
combinations = list(product(var_pars, var_pars))
|
||||||
|
actual_parameters = []
|
||||||
|
corr_idx = []
|
||||||
|
|
||||||
|
for i, p_i in enumerate(used_pars):
|
||||||
|
actual_parameters.append(self.parameter[p_i])
|
||||||
|
for j, p_j in enumerate(used_pars):
|
||||||
|
try:
|
||||||
|
# find the position of the parameter combinations
|
||||||
|
corr_idx.append(combinations.index((p_i, p_j)))
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# reshape the correlation matrices
|
||||||
|
if corr is None:
|
||||||
|
actual_corr = None
|
||||||
|
actual_pcorr = None
|
||||||
|
else:
|
||||||
|
indexes = np.unravel_index(corr_idx, corr.shape)
|
||||||
|
dim_one = int(np.sqrt(len(corr_idx)))
|
||||||
|
actual_corr = corr[indexes].reshape((dim_one, -1))
|
||||||
|
actual_pcorr = partial_corr[indexes].reshape((dim_one, -1))
|
||||||
|
|
||||||
|
idx = self.data.index(data)
|
||||||
|
model = data.get_model()
|
||||||
|
|
||||||
|
self.result[idx] = FitResultCreator.make_with_model(model, data.x, data.y,
|
||||||
|
actual_parameters, data.fun_kwargs, data.idx,
|
||||||
|
*shape, corr=actual_corr, pcorr=actual_pcorr)
|
||||||
|
|
||||||
|
return self.result
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _calc_error(jac, chi, nobs, nvars):
|
||||||
|
# copy of scipy.curve_fit to calculate covariance
|
||||||
|
# noinspection PyTupleAssignmentBalance
|
||||||
|
_, s, vt = la.svd(jac, full_matrices=False)
|
||||||
|
threshold = EPS * max(jac.shape) * s[0]
|
||||||
|
s = s[s > threshold]
|
||||||
|
vt = vt[:s.size]
|
||||||
|
pcov = np.dot(vt.T / s**2, vt) * chi / (nobs - nvars)
|
||||||
|
|
||||||
|
if pcov is None:
|
||||||
|
_err = np.zeros(nvars)
|
||||||
|
corr = np.zeros((nvars, nvars))
|
||||||
|
else:
|
||||||
|
_err = np.sqrt(np.diag(pcov))
|
||||||
|
corr = pcov / (_err[:, None] * _err[None, :])
|
||||||
|
|
||||||
|
corr = corr.astype(np.float64)
|
||||||
|
try:
|
||||||
|
corr_inv = np.linalg.inv(corr)
|
||||||
|
corr_inv_diag = np.diag(np.sqrt(1 / np.diag(corr_inv)))
|
||||||
|
partial_corr = -1. * np.dot(np.dot(corr_inv_diag, corr_inv), corr_inv_diag) # Partial correlation matrix
|
||||||
|
partial_corr[np.diag_indices_from(partial_corr)] = 1.
|
||||||
|
except np.linalg.LinAlgError:
|
||||||
|
partial_corr = corr
|
||||||
|
|
||||||
|
return _err, corr, partial_corr
|
153
nmreval/fit/model.py
Normal file
153
nmreval/fit/model.py
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
import inspect
|
||||||
|
from typing import Sized
|
||||||
|
|
||||||
|
from numpy import inf
|
||||||
|
|
||||||
|
from ._meta import MultiModel
|
||||||
|
from .parameter import Parameters
|
||||||
|
|
||||||
|
|
||||||
|
class Model(object):
|
||||||
|
def __init__(self, model, *args, **kwargs):
|
||||||
|
self.idx = kwargs.pop('idx', None)
|
||||||
|
|
||||||
|
self.is_multi = False
|
||||||
|
if inspect.isclass(model) or isinstance(model, MultiModel):
|
||||||
|
self._init_from_class(model)
|
||||||
|
elif inspect.isfunction(model):
|
||||||
|
self._init_from_function(model)
|
||||||
|
else:
|
||||||
|
raise ValueError(f'No idea how to use datatype {model}.')
|
||||||
|
|
||||||
|
self.lb = [i if i is not None else -inf for i in self.lb]
|
||||||
|
self.ub = [i if i is not None else inf for i in self.ub]
|
||||||
|
|
||||||
|
self.parameter = Parameters()
|
||||||
|
self.global_parameter = {}
|
||||||
|
self.is_complex = None
|
||||||
|
self._complex_part = False
|
||||||
|
|
||||||
|
if 'complex' in kwargs:
|
||||||
|
self.set_complex(kwargs.pop('complex'))
|
||||||
|
|
||||||
|
if args:
|
||||||
|
self.fun_args = args
|
||||||
|
else:
|
||||||
|
self.fun_args = []
|
||||||
|
|
||||||
|
self.fun_kwargs.update(kwargs)
|
||||||
|
|
||||||
|
def _init_from_function(self, func):
|
||||||
|
self.name = str(func)
|
||||||
|
self._int_func = func
|
||||||
|
self._int_iter = func
|
||||||
|
|
||||||
|
self.params = []
|
||||||
|
self.fun_kwargs = {}
|
||||||
|
for k, v in inspect.signature(func).parameters.items():
|
||||||
|
if v.default != inspect.Parameter.empty:
|
||||||
|
self.fun_kwargs[k] = v.default
|
||||||
|
else:
|
||||||
|
self.params.append(k)
|
||||||
|
# first parameter is x
|
||||||
|
self.params.pop(0)
|
||||||
|
|
||||||
|
self.lb = [None] * len(self.params)
|
||||||
|
self.ub = [None] * len(self.params)
|
||||||
|
|
||||||
|
def _init_from_class(self, model):
|
||||||
|
self.name = model.name
|
||||||
|
self.params = model.params
|
||||||
|
self._int_func = model.func
|
||||||
|
if hasattr(model, 'subs'):
|
||||||
|
self._int_iter = model.subs
|
||||||
|
self.is_multi = True
|
||||||
|
else:
|
||||||
|
self._int_iter = model.func
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.lb, self.ub = list(zip(*model.bounds))
|
||||||
|
except AttributeError:
|
||||||
|
self.lb = [None] * len(self.params)
|
||||||
|
self.ub = [None] * len(self.params)
|
||||||
|
|
||||||
|
if isinstance(model, MultiModel):
|
||||||
|
self.fun_kwargs = model.fun_kwargs
|
||||||
|
else:
|
||||||
|
self.fun_kwargs = {k: v.default for k, v in inspect.signature(model.func).parameters.items()
|
||||||
|
if v.default is not inspect.Parameter.empty}
|
||||||
|
|
||||||
|
def set_complex(self, state):
|
||||||
|
if state not in [None, 'complex', 'real', 'imag']:
|
||||||
|
raise ValueError('"complex" argument is not None, "complex", "real", "imag"')
|
||||||
|
|
||||||
|
self.is_complex = state
|
||||||
|
if state in ['real', 'imag']:
|
||||||
|
self._complex_part = state
|
||||||
|
else:
|
||||||
|
self._complex_part = False
|
||||||
|
|
||||||
|
def set_global_parameter(self, idx, p, var=None, lb=None, ub=None, default_bounds=False):
|
||||||
|
if idx is None:
|
||||||
|
self.parameter = Parameters()
|
||||||
|
self.global_parameter = {}
|
||||||
|
return
|
||||||
|
|
||||||
|
if default_bounds:
|
||||||
|
if lb is None:
|
||||||
|
lb = [self.lb[i] for i in idx]
|
||||||
|
if ub is None:
|
||||||
|
ub = [self.lb[i] for i in idx]
|
||||||
|
|
||||||
|
gp = self.parameter.add_parameter(p, var=var, lb=lb, ub=ub)
|
||||||
|
for k, v in zip(idx, gp):
|
||||||
|
self.global_parameter[k] = v
|
||||||
|
|
||||||
|
return gp
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _prep(param_len, val):
|
||||||
|
if isinstance(val, Sized):
|
||||||
|
if len(val) != param_len:
|
||||||
|
raise ValueError('Length mismatch for global parameter')
|
||||||
|
else:
|
||||||
|
return [val] * param_len
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
msg = 'Model: ' + self.name
|
||||||
|
return msg
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.params)
|
||||||
|
|
||||||
|
def func(self, p, x, **kwargs):
|
||||||
|
if not kwargs:
|
||||||
|
kwargs = self.fun_kwargs
|
||||||
|
|
||||||
|
f = self._int_func(x, *p, *self.fun_args, **kwargs)
|
||||||
|
|
||||||
|
if self._complex_part:
|
||||||
|
if self._complex_part == 'real':
|
||||||
|
return f.real
|
||||||
|
else:
|
||||||
|
return f.imag
|
||||||
|
|
||||||
|
return f
|
||||||
|
|
||||||
|
def sub(self, p, x, **kwargs):
|
||||||
|
if not self.is_multi:
|
||||||
|
return [self.func(p, x, **kwargs)]
|
||||||
|
|
||||||
|
else:
|
||||||
|
print('multi model')
|
||||||
|
if not kwargs:
|
||||||
|
kwargs = self.fun_kwargs
|
||||||
|
|
||||||
|
if self._complex_part:
|
||||||
|
if self._complex_part == 'real':
|
||||||
|
return [f.real for f in self._int_iter(x, *p, *self.fun_args, **kwargs)]
|
||||||
|
else:
|
||||||
|
return [f.imag for f in self._int_iter(x, *p, *self.fun_args, **kwargs)]
|
||||||
|
|
||||||
|
return list(self._int_iter(x, *p, *self.fun_args, **kwargs))
|
155
nmreval/fit/parameter.py
Normal file
155
nmreval/fit/parameter.py
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
from numbers import Number
|
||||||
|
from itertools import count
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class Parameters(dict):
|
||||||
|
count = count()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return 'Parameters:\n' + '\n'.join([str(k)+': '+str(v) for k, v in self.items()])
|
||||||
|
|
||||||
|
def __getitem__(self, item):
|
||||||
|
if isinstance(item, (list, tuple, np.ndarray)):
|
||||||
|
values = []
|
||||||
|
for item_i in item:
|
||||||
|
values.append(super().__getitem__(item_i))
|
||||||
|
return values
|
||||||
|
else:
|
||||||
|
return super().__getitem__(item)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _prep_bounds(val, p_len: int) -> list:
|
||||||
|
# helper function to ensure that bounds and variable are of parameter shape
|
||||||
|
if isinstance(val, (Number, bool)) or val is None:
|
||||||
|
return [val] * p_len
|
||||||
|
|
||||||
|
elif len(val) == p_len:
|
||||||
|
return val
|
||||||
|
|
||||||
|
elif len(val) == 1:
|
||||||
|
return [val[0]] * p_len
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise ValueError('Input {} has wrong dimensions'.format(val))
|
||||||
|
|
||||||
|
def add_parameter(self, param, var=None, lb=None, ub=None):
|
||||||
|
if isinstance(param, Number):
|
||||||
|
param = [param]
|
||||||
|
|
||||||
|
p_len = len(param)
|
||||||
|
|
||||||
|
# make list if only single value is given
|
||||||
|
var = self._prep_bounds(var, p_len)
|
||||||
|
lb = self._prep_bounds(lb, p_len)
|
||||||
|
ub = self._prep_bounds(ub, p_len)
|
||||||
|
|
||||||
|
new_keys = []
|
||||||
|
for i in range(p_len):
|
||||||
|
new_idx = next(self.count)
|
||||||
|
new_keys.append(new_idx)
|
||||||
|
|
||||||
|
self[new_idx] = Parameter(param[i], var=var[i], lb=lb[i], ub=ub[i])
|
||||||
|
|
||||||
|
return new_keys
|
||||||
|
|
||||||
|
def copy(self):
|
||||||
|
p = Parameters()
|
||||||
|
for k, v in self.items():
|
||||||
|
p[k] = Parameter(v.value, var=v.var, lb=v.lb, ub=v.ub)
|
||||||
|
|
||||||
|
if len(p) == 0:
|
||||||
|
return p
|
||||||
|
|
||||||
|
max_k = max(p.keys())
|
||||||
|
c = next(p.count)
|
||||||
|
while c < max_k:
|
||||||
|
c = next(p.count)
|
||||||
|
|
||||||
|
return p
|
||||||
|
|
||||||
|
def get_state(self):
|
||||||
|
return {k: v.get_state() for k, v in self.items()}
|
||||||
|
|
||||||
|
|
||||||
|
class Parameter:
|
||||||
|
"""
|
||||||
|
Container for one parameter
|
||||||
|
"""
|
||||||
|
__slots__ = ['name', 'value', 'error', 'init_val', 'var', 'lb', 'ub', 'scale', 'function']
|
||||||
|
|
||||||
|
def __init__(self, value: float, var: bool = True, lb: float = -np.inf, ub: float = np.inf):
|
||||||
|
self.lb = lb if lb is not None else -np.inf
|
||||||
|
self.ub = ub if ub is not None else np.inf
|
||||||
|
|
||||||
|
if self.lb <= value <= self.ub:
|
||||||
|
self.value = value
|
||||||
|
else:
|
||||||
|
raise ValueError('Value of parameter is outside bounds')
|
||||||
|
|
||||||
|
self.init_val = value
|
||||||
|
|
||||||
|
with np.errstate(divide='ignore'):
|
||||||
|
# throws RuntimeWarning for zeros
|
||||||
|
self.scale = 10**(np.floor(np.log10(np.abs(self.value))))
|
||||||
|
|
||||||
|
if self.scale == 0:
|
||||||
|
self.scale = 1.
|
||||||
|
|
||||||
|
self.var = bool(var) if var is not None else True
|
||||||
|
self.error = None if self.var is False else 0.0
|
||||||
|
self.name = ''
|
||||||
|
self.function = ''
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
start = ''
|
||||||
|
if self.name:
|
||||||
|
if self.function:
|
||||||
|
start = f'{self.name} ({self.function}): '
|
||||||
|
else:
|
||||||
|
start = self.name + ': '
|
||||||
|
|
||||||
|
if self.var:
|
||||||
|
return start + f'{self.value:.4g} +/- {self.error:.4g}, init={self.init_val}'
|
||||||
|
else:
|
||||||
|
return start + f'{self.value:} (fixed)'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def scaled_value(self):
|
||||||
|
return self.value / self.scale
|
||||||
|
|
||||||
|
@scaled_value.setter
|
||||||
|
def scaled_value(self, value):
|
||||||
|
self.value = value * self.scale
|
||||||
|
|
||||||
|
@property
|
||||||
|
def scaled_error(self):
|
||||||
|
if self.error is None:
|
||||||
|
return self.error
|
||||||
|
else:
|
||||||
|
return self.error / self.scale
|
||||||
|
|
||||||
|
@scaled_error.setter
|
||||||
|
def scaled_error(self, value):
|
||||||
|
self.error = value * self.scale
|
||||||
|
|
||||||
|
def get_state(self):
|
||||||
|
|
||||||
|
return {slot: getattr(self, slot) for slot in self.__slots__}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def set_state(state: dict):
|
||||||
|
par = Parameter(state.pop('value'))
|
||||||
|
for k, v in state.items():
|
||||||
|
setattr(par, k, v)
|
||||||
|
|
||||||
|
return par
|
||||||
|
|
||||||
|
@property
|
||||||
|
def full_name(self):
|
||||||
|
name = self.name
|
||||||
|
if self.function:
|
||||||
|
name += ' (' + self.function + ')'
|
||||||
|
|
||||||
|
return name
|
339
nmreval/fit/result.py
Normal file
339
nmreval/fit/result.py
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
import pathlib
|
||||||
|
import re
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from scipy.stats import f as fdist
|
||||||
|
from scipy.interpolate import interp1d
|
||||||
|
|
||||||
|
from ..data.points import Points
|
||||||
|
from .parameter import Parameter
|
||||||
|
from ..data.signals import Signal
|
||||||
|
from ..utils.text import convert
|
||||||
|
|
||||||
|
|
||||||
|
class FitResultCreator:
|
||||||
|
@staticmethod
|
||||||
|
def make_from_session(x_orig, y_orig, idx, kwargs) -> (dict, list):
|
||||||
|
params = OrderedDict()
|
||||||
|
|
||||||
|
for key, pbest, err in zip(kwargs['pnames'], kwargs['parameter'], kwargs['error']):
|
||||||
|
params[key] = Parameter(pbest)
|
||||||
|
params[key].error = err
|
||||||
|
|
||||||
|
_x = kwargs['x']
|
||||||
|
_y = kwargs['y']
|
||||||
|
|
||||||
|
if len(_x) != len(x_orig):
|
||||||
|
f = interp1d(_x, _y)
|
||||||
|
rng = (x_orig >= np.min(_x)) * (x_orig <= np.max(_x))
|
||||||
|
resid = f(x_orig[rng]) - y_orig[rng]
|
||||||
|
else:
|
||||||
|
resid = kwargs['y'] - y_orig
|
||||||
|
|
||||||
|
stats = FitResultCreator.calc_statistics(resid, _y)
|
||||||
|
|
||||||
|
return FitResult(kwargs['x'], kwargs['y'], x_orig, y_orig, params, dict(kwargs['choice']), resid, 0, 0,
|
||||||
|
kwargs['name'], stats, idx), []
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def make_with_model(model, x_orig, y_orig, p, fun_kwargs, idx, nobs, nvar, corr, pcorr) -> (dict, list):
|
||||||
|
if np.all(x_orig > 0) and (np.max(x_orig) > 100 * np.min(x_orig)):
|
||||||
|
islog = True
|
||||||
|
else:
|
||||||
|
islog = False
|
||||||
|
|
||||||
|
if len(x_orig) < 51:
|
||||||
|
if islog:
|
||||||
|
_x = np.logspace(np.log10(np.min(x_orig)), np.log10(np.max(x_orig)), num=10*x_orig.size-9)
|
||||||
|
else:
|
||||||
|
_x = np.linspace(np.min(x_orig), np.max(x_orig), num=10*x_orig.size-9)
|
||||||
|
else:
|
||||||
|
_x = x_orig
|
||||||
|
|
||||||
|
try:
|
||||||
|
pnames = model.pnames
|
||||||
|
except AttributeError:
|
||||||
|
pnames = model.params
|
||||||
|
|
||||||
|
parameters = OrderedDict([(k, v) for k, v in zip(pnames, p)])
|
||||||
|
p_final = [p.value for p in parameters.values()]
|
||||||
|
|
||||||
|
part_functions = []
|
||||||
|
|
||||||
|
if model.is_multi:
|
||||||
|
for sub_y in model.sub(p_final, _x, **fun_kwargs):
|
||||||
|
if np.iscomplexobj(sub_y):
|
||||||
|
part_functions.append(Signal(_x, sub_y))
|
||||||
|
else:
|
||||||
|
part_functions.append(Points(_x, sub_y))
|
||||||
|
|
||||||
|
_y = model.func(p_final, _x, **fun_kwargs)
|
||||||
|
resid = model.func(p_final, x_orig, **fun_kwargs) - y_orig
|
||||||
|
|
||||||
|
stats = FitResultCreator.calc_statistics(_y, resid, nobs, nvar)
|
||||||
|
varied = [p.var for p in parameters.values()]
|
||||||
|
|
||||||
|
if corr is None:
|
||||||
|
correlation = np.eye(len(p_final), len(p_final))
|
||||||
|
partial_correlation = np.eye(len(p_final), len(p_final))
|
||||||
|
|
||||||
|
else:
|
||||||
|
if len(corr) < len(p_final):
|
||||||
|
correlation = np.eye(len(p_final), len(p_final))
|
||||||
|
partial_correlation = np.eye(len(p_final), len(p_final))
|
||||||
|
# probably some fixed variables
|
||||||
|
j = 0
|
||||||
|
for i in range(len(corr)):
|
||||||
|
while not varied[j]:
|
||||||
|
j += 1
|
||||||
|
correlation[j, varied] = corr[i]
|
||||||
|
partial_correlation[j, varied] = pcorr[i]
|
||||||
|
j += 1
|
||||||
|
else:
|
||||||
|
correlation = corr
|
||||||
|
partial_correlation = pcorr
|
||||||
|
|
||||||
|
return FitResult(_x, _y, x_orig, y_orig, parameters, fun_kwargs, resid, nobs, nvar, model.name, stats,
|
||||||
|
idx=idx, corr=correlation, pcorr=partial_correlation, islog=islog, iscomplex=model.is_complex), part_functions
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def calc_statistics(y, residual, nobs=None, nvar=None):
|
||||||
|
chi = (residual**2).sum()
|
||||||
|
try:
|
||||||
|
r = 1 - chi/((y-np.mean(y))**2).sum()
|
||||||
|
except RuntimeWarning:
|
||||||
|
r = -9999
|
||||||
|
|
||||||
|
if nobs is None:
|
||||||
|
nobs = 1
|
||||||
|
|
||||||
|
if nvar is None:
|
||||||
|
nvar = 0
|
||||||
|
|
||||||
|
dof = nobs - nvar
|
||||||
|
loglikehood = nobs * np.log(chi / nobs)
|
||||||
|
|
||||||
|
stats = {
|
||||||
|
'chi^2': chi,
|
||||||
|
'R^2': r,
|
||||||
|
'AIC': loglikehood + 2 * nvar,
|
||||||
|
'BIC': loglikehood + np.log(nobs) * nvar
|
||||||
|
}
|
||||||
|
|
||||||
|
if dof != 0:
|
||||||
|
stats['adj. R^2'] = 1 - (nobs-1)/dof * (1-r)
|
||||||
|
stats['red. chi^2'] = chi / dof if dof != 0 else 0
|
||||||
|
|
||||||
|
if dof != 1:
|
||||||
|
stats['AICc'] = stats['AIC'] + 2*(nvar+1)*nvar / (dof-1)
|
||||||
|
|
||||||
|
return stats
|
||||||
|
|
||||||
|
|
||||||
|
class FitResult(Points):
|
||||||
|
|
||||||
|
def __init__(self, x, y, x_data, y_data, params, fun_kwargs, resid, nobs, nvar, name, stats,
|
||||||
|
idx=None, corr=None, pcorr=None, islog=False, iscomplex=None,
|
||||||
|
**kwargs):
|
||||||
|
|
||||||
|
self.parameter, name = self._prepare_names(params, name)
|
||||||
|
|
||||||
|
super().__init__(x=x, y=y, name=name, **kwargs)
|
||||||
|
|
||||||
|
self.residual = resid
|
||||||
|
self.idx = idx
|
||||||
|
self.statistics = stats
|
||||||
|
self.nobs = nobs
|
||||||
|
self.nvar = nvar
|
||||||
|
self.fun_kwargs = fun_kwargs
|
||||||
|
self.correlation = corr
|
||||||
|
self.partial_correlation = pcorr
|
||||||
|
self.islog = islog
|
||||||
|
self.iscomplex = iscomplex
|
||||||
|
self.x_data = x_data
|
||||||
|
self.y_data = y_data
|
||||||
|
self._model_name = name
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _prepare_names(parameter: dict, modelname: str):
|
||||||
|
pattern = re.compile(r'(\\?\w[\\\w .-]*(?:_{[\w\\ .-]})?)(\(\d+\))')
|
||||||
|
|
||||||
|
split_funcs = {g2: g1 for (g1, g2) in pattern.findall(modelname)}
|
||||||
|
|
||||||
|
parameter_dic = {}
|
||||||
|
for pname, pvalue in parameter.items():
|
||||||
|
nice_name = pname
|
||||||
|
nice_func = ''
|
||||||
|
m = pattern.match(pname)
|
||||||
|
if m:
|
||||||
|
func_number = m.group(2)
|
||||||
|
nice_name = m.group(1)
|
||||||
|
if func_number in split_funcs:
|
||||||
|
nice_func = split_funcs[func_number]
|
||||||
|
|
||||||
|
pvalue.name = nice_name
|
||||||
|
pvalue.function = nice_func
|
||||||
|
parameter_dic[pname] = pvalue
|
||||||
|
|
||||||
|
modelname = re.sub(r'\(\d+\)', '', modelname)
|
||||||
|
if modelname[0] == '(' and modelname[-1] == ')':
|
||||||
|
modelname = modelname[1:-1]
|
||||||
|
|
||||||
|
return parameter_dic, modelname
|
||||||
|
|
||||||
|
@property
|
||||||
|
def model_name(self):
|
||||||
|
return self._model_name
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.parameter)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
try:
|
||||||
|
return 'Fit: ' + self.name
|
||||||
|
except AttributeError:
|
||||||
|
return 'FitObject'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def p_final(self):
|
||||||
|
return [pp.value for pp in self.parameter.values()]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dof(self):
|
||||||
|
return self.nobs-self.nvar
|
||||||
|
|
||||||
|
def pprint(self, statistics=True, correlations=True):
|
||||||
|
print('Fit result:')
|
||||||
|
print(' model :', self.name)
|
||||||
|
print(' #data :', self.nobs)
|
||||||
|
print(' #var :', self.nvar)
|
||||||
|
print('\nParameter')
|
||||||
|
print(self._parameter_string())
|
||||||
|
if statistics:
|
||||||
|
print('Statistics')
|
||||||
|
for k, v in self.statistics.items():
|
||||||
|
print(f' {k} : {v:.4f}')
|
||||||
|
|
||||||
|
if correlations and self.correlation is not None:
|
||||||
|
print('\nCorrelation (partial corr.)')
|
||||||
|
print(self._correlation_string())
|
||||||
|
print()
|
||||||
|
|
||||||
|
def _parameter_string(self):
|
||||||
|
ret_val = ''
|
||||||
|
|
||||||
|
for pval in self.parameter.values():
|
||||||
|
ret_val += convert(str(pval), old='tex', new='str') + '\n'
|
||||||
|
|
||||||
|
if self.fun_kwargs:
|
||||||
|
for k, v in self.fun_kwargs.items():
|
||||||
|
ret_val += f' {k}: {v}\n'
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
def _correlation_string(self):
|
||||||
|
ret_val = ''
|
||||||
|
for p_i, p_j, corr_ij, pcorr_ij in self.correlation_list():
|
||||||
|
ret_val += ' {} / {} : {:.4f} ({:.4f})\n'.format(convert(p_i, old='tex', new='str'),
|
||||||
|
convert(p_j, old='tex', new='str'),
|
||||||
|
corr_ij, pcorr_ij)
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
def correlation_list(self, limit=0.1):
|
||||||
|
correlations = []
|
||||||
|
|
||||||
|
if self.correlation is not None:
|
||||||
|
pnames = list(self.parameter.keys())
|
||||||
|
|
||||||
|
corr = np.triu(self.correlation, k=1)
|
||||||
|
|
||||||
|
for i, j in zip(*np.unravel_index(np.argsort(np.abs(corr), axis=None)[::-1],
|
||||||
|
self.correlation.shape)):
|
||||||
|
if i == j:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if abs(corr[i, j]) < limit:
|
||||||
|
break
|
||||||
|
|
||||||
|
correlations.append((pnames[i], pnames[j], self.correlation[i, j], self.partial_correlation[i, j]))
|
||||||
|
|
||||||
|
return correlations
|
||||||
|
|
||||||
|
def savetxt(self, fname, err=True):
|
||||||
|
header = self.name + '\n'
|
||||||
|
for pval in self.parameter.values():
|
||||||
|
header += '{}\t{}\t{}\n'.format(convert(pval.name, old='tex', new='str'), pval.value, pval.error)
|
||||||
|
if self.fun_kwargs:
|
||||||
|
for k, v in self.fun_kwargs.items():
|
||||||
|
header += '{}\t{}\n'.format(convert(k, old='tex', new='str'),
|
||||||
|
convert(str(v), old='tex', new='str'))
|
||||||
|
|
||||||
|
if self.iscomplex == 'complex':
|
||||||
|
np.savetxt(fname, np.c_[self.x, self.y.real, self.y.imag], header=header)
|
||||||
|
else:
|
||||||
|
np.savetxt(fname, np.c_[self.x, self.y], header=header)
|
||||||
|
|
||||||
|
def save_parameter(self, fname: str, label: str = None, overwrite: bool = False):
|
||||||
|
path = pathlib.Path(fname)
|
||||||
|
if not path.is_file():
|
||||||
|
overwrite = True
|
||||||
|
|
||||||
|
writemode = 'w' if overwrite else 'a'
|
||||||
|
|
||||||
|
if label is None:
|
||||||
|
label = self.value
|
||||||
|
|
||||||
|
with path.open(writemode) as f:
|
||||||
|
if overwrite or not path.exists():
|
||||||
|
f.write('# label(1)\t')
|
||||||
|
for i, pname in enumerate(self.parameter.keys()):
|
||||||
|
raw_name = convert(pname, old='tex', new='str')
|
||||||
|
f.write(f'{raw_name}({2*i+2})\t{raw_name}_err({2*i+3})\t')
|
||||||
|
f.write('\n')
|
||||||
|
|
||||||
|
f.write(str(label).replace(' ', '') + '\t')
|
||||||
|
for p in self.parameter.values():
|
||||||
|
if p.error is not None:
|
||||||
|
err = p.error
|
||||||
|
else:
|
||||||
|
err = 0.
|
||||||
|
f.write(f'{p.value:.8e}\t{err:.8e}\t')
|
||||||
|
|
||||||
|
if self.fun_kwargs:
|
||||||
|
f.write('# ')
|
||||||
|
for k, v in self.fun_kwargs.items():
|
||||||
|
f.write(f"{convert(k, old='tex', new='str')}: {convert(str(v), old='tex', new='str')}\t")
|
||||||
|
f.write('\n')
|
||||||
|
|
||||||
|
def f_test(self, chi2: float, dof: float):
|
||||||
|
if 'red. chi^2' not in self.statistics or dof == self.dof:
|
||||||
|
f_value = 1e318
|
||||||
|
else:
|
||||||
|
f_value = (chi2-self.statistics['chi^2']) / (dof-self.dof) / self.statistics['red. chi^2']
|
||||||
|
return f_value, 1-fdist.cdf(f_value, dof-self.dof, self.dof)
|
||||||
|
|
||||||
|
def get_state(self):
|
||||||
|
state = super().get_state()
|
||||||
|
|
||||||
|
for attr in ['idx', 'fun_kwargs', 'nobs', 'nvar',
|
||||||
|
'islog', 'iscomplex', 'x_data', 'y_data']:
|
||||||
|
state[attr] = getattr(self, attr)
|
||||||
|
|
||||||
|
state['name'] = self._model_name
|
||||||
|
state['corr'] = self.correlation
|
||||||
|
state['pcorr'] = self.partial_correlation
|
||||||
|
state['stats'] = self.statistics
|
||||||
|
state['resid'] = self.residual
|
||||||
|
state['params'] = {k: v.get_state() for k, v in self.parameter.items()}
|
||||||
|
|
||||||
|
state['mode'] = 'fit'
|
||||||
|
|
||||||
|
return state
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def set_state(state, **kwargs):
|
||||||
|
state['params'] = {k: Parameter.set_state(v) for k, v in state.pop('params').items()}
|
||||||
|
data = FitResult(**state)
|
||||||
|
|
||||||
|
return data
|
12
nmreval/gui_qt/Qt.py
Normal file
12
nmreval/gui_qt/Qt.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets, QtPrintSupport
|
||||||
|
|
||||||
|
# from PySide2 import QtCore, QtGui, QtWidgets
|
||||||
|
# QtCore.pyqtSignal = QtCore.Signal
|
||||||
|
# QtCore.pyqtProperty = QtCore.Property
|
||||||
|
# QtCore.pyqtSlot = QtCore.Slot
|
||||||
|
|
||||||
|
# import pyqtgraph as pg
|
||||||
|
#
|
||||||
|
# pg.setConfigOption('background', 'w')
|
||||||
|
# pg.setConfigOption('foreground', 'k')
|
17
nmreval/gui_qt/__init__.py
Normal file
17
nmreval/gui_qt/__init__.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from .Qt import QtWidgets
|
||||||
|
from .lib.styles import MyProxyStyle
|
||||||
|
from ..configs import read_configuration
|
||||||
|
|
||||||
|
|
||||||
|
class App(QtWidgets.QApplication):
|
||||||
|
color = 'light'
|
||||||
|
theme = 'normal'
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
configs = read_configuration()
|
||||||
|
App.theme = configs.get('GUI', 'Theme')
|
||||||
|
App.color = configs.get('GUI', 'Color')
|
||||||
|
|
||||||
|
self.setStyle(MyProxyStyle(App.color))
|
0
nmreval/gui_qt/_py/__init__.py
Normal file
0
nmreval/gui_qt/_py/__init__.py
Normal file
323
nmreval/gui_qt/_py/agroptiondialog.py
Normal file
323
nmreval/gui_qt/_py/agroptiondialog.py
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file '_ui/agroptiondialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(513, 466)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(Dialog)
|
||||||
|
self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.tabWidgetPage1 = QtWidgets.QWidget()
|
||||||
|
self.tabWidgetPage1.setObjectName("tabWidgetPage1")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.tabWidgetPage1)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.frame_2 = QtWidgets.QFrame(self.tabWidgetPage1)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame_2.setSizePolicy(sizePolicy)
|
||||||
|
self.frame_2.setFrameShape(QtWidgets.QFrame.Panel)
|
||||||
|
self.frame_2.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.frame_2.setLineWidth(3)
|
||||||
|
self.frame_2.setMidLineWidth(5)
|
||||||
|
self.frame_2.setObjectName("frame_2")
|
||||||
|
self.gridLayout_4 = QtWidgets.QGridLayout(self.frame_2)
|
||||||
|
self.gridLayout_4.setSpacing(3)
|
||||||
|
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||||
|
self.bottomMarginDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.frame_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.bottomMarginDoubleSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.bottomMarginDoubleSpinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.bottomMarginDoubleSpinBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
|
||||||
|
self.bottomMarginDoubleSpinBox.setObjectName("bottomMarginDoubleSpinBox")
|
||||||
|
self.gridLayout_4.addWidget(self.bottomMarginDoubleSpinBox, 5, 2, 1, 1)
|
||||||
|
self.bottomMarginLabel = QtWidgets.QLabel(self.frame_2)
|
||||||
|
self.bottomMarginLabel.setObjectName("bottomMarginLabel")
|
||||||
|
self.gridLayout_4.addWidget(self.bottomMarginLabel, 5, 1, 1, 1)
|
||||||
|
self.rightMarginLabel = QtWidgets.QLabel(self.frame_2)
|
||||||
|
self.rightMarginLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
|
self.rightMarginLabel.setObjectName("rightMarginLabel")
|
||||||
|
self.gridLayout_4.addWidget(self.rightMarginLabel, 2, 3, 1, 1)
|
||||||
|
self.rightMarginDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.frame_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.rightMarginDoubleSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.rightMarginDoubleSpinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.rightMarginDoubleSpinBox.setObjectName("rightMarginDoubleSpinBox")
|
||||||
|
self.gridLayout_4.addWidget(self.rightMarginDoubleSpinBox, 3, 3, 1, 1)
|
||||||
|
self.leftMarginDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.frame_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.leftMarginDoubleSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.leftMarginDoubleSpinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.leftMarginDoubleSpinBox.setObjectName("leftMarginDoubleSpinBox")
|
||||||
|
self.gridLayout_4.addWidget(self.leftMarginDoubleSpinBox, 3, 0, 1, 1)
|
||||||
|
self.leftMarginLabel = QtWidgets.QLabel(self.frame_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.leftMarginLabel.sizePolicy().hasHeightForWidth())
|
||||||
|
self.leftMarginLabel.setSizePolicy(sizePolicy)
|
||||||
|
self.leftMarginLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
|
self.leftMarginLabel.setObjectName("leftMarginLabel")
|
||||||
|
self.gridLayout_4.addWidget(self.leftMarginLabel, 2, 0, 1, 1)
|
||||||
|
self.topMarginLabel = QtWidgets.QLabel(self.frame_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.topMarginLabel.sizePolicy().hasHeightForWidth())
|
||||||
|
self.topMarginLabel.setSizePolicy(sizePolicy)
|
||||||
|
self.topMarginLabel.setObjectName("topMarginLabel")
|
||||||
|
self.gridLayout_4.addWidget(self.topMarginLabel, 0, 1, 1, 1)
|
||||||
|
self.topMarginDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.frame_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.topMarginDoubleSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.topMarginDoubleSpinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.topMarginDoubleSpinBox.setObjectName("topMarginDoubleSpinBox")
|
||||||
|
self.gridLayout_4.addWidget(self.topMarginDoubleSpinBox, 0, 2, 1, 1)
|
||||||
|
self.frame = QtWidgets.QFrame(self.frame_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame.setSizePolicy(sizePolicy)
|
||||||
|
self.frame.setFrameShape(QtWidgets.QFrame.WinPanel)
|
||||||
|
self.frame.setMidLineWidth(0)
|
||||||
|
self.frame.setObjectName("frame")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
|
||||||
|
self.verticalLayout_2.setSpacing(0)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.gridLayout_4.addWidget(self.frame, 1, 1, 4, 2)
|
||||||
|
self.gridLayout_2.addWidget(self.frame_2, 1, 0, 2, 2)
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout_3.addItem(spacerItem)
|
||||||
|
self.heightLabel = QtWidgets.QLabel(self.tabWidgetPage1)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.heightLabel.sizePolicy().hasHeightForWidth())
|
||||||
|
self.heightLabel.setSizePolicy(sizePolicy)
|
||||||
|
self.heightLabel.setObjectName("heightLabel")
|
||||||
|
self.verticalLayout_3.addWidget(self.heightLabel)
|
||||||
|
self.heightDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.tabWidgetPage1)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.heightDoubleSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.heightDoubleSpinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.heightDoubleSpinBox.setObjectName("heightDoubleSpinBox")
|
||||||
|
self.verticalLayout_3.addWidget(self.heightDoubleSpinBox)
|
||||||
|
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout_3.addItem(spacerItem1)
|
||||||
|
self.gridLayout_2.addLayout(self.verticalLayout_3, 1, 2, 2, 1)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem2)
|
||||||
|
self.widthLabel = QtWidgets.QLabel(self.tabWidgetPage1)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.widthLabel.sizePolicy().hasHeightForWidth())
|
||||||
|
self.widthLabel.setSizePolicy(sizePolicy)
|
||||||
|
self.widthLabel.setObjectName("widthLabel")
|
||||||
|
self.horizontalLayout.addWidget(self.widthLabel)
|
||||||
|
self.widthDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.tabWidgetPage1)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.widthDoubleSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.widthDoubleSpinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.widthDoubleSpinBox.setObjectName("widthDoubleSpinBox")
|
||||||
|
self.horizontalLayout.addWidget(self.widthDoubleSpinBox)
|
||||||
|
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem3)
|
||||||
|
self.gridLayout_2.addLayout(self.horizontalLayout, 0, 0, 1, 2)
|
||||||
|
self.tabWidget.addTab(self.tabWidgetPage1, "")
|
||||||
|
self.tab = QtWidgets.QWidget()
|
||||||
|
self.tab.setObjectName("tab")
|
||||||
|
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.tab)
|
||||||
|
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||||
|
self.label_11 = QtWidgets.QLabel(self.tab)
|
||||||
|
self.label_11.setObjectName("label_11")
|
||||||
|
self.verticalLayout_4.addWidget(self.label_11)
|
||||||
|
self.spinBox_2 = QtWidgets.QSpinBox(self.tab)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.spinBox_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.spinBox_2.setSizePolicy(sizePolicy)
|
||||||
|
self.spinBox_2.setMaximum(1000)
|
||||||
|
self.spinBox_2.setProperty("value", 100)
|
||||||
|
self.spinBox_2.setObjectName("spinBox_2")
|
||||||
|
self.verticalLayout_4.addWidget(self.spinBox_2)
|
||||||
|
self.legendLabel = QtWidgets.QLabel(self.tab)
|
||||||
|
self.legendLabel.setObjectName("legendLabel")
|
||||||
|
self.verticalLayout_4.addWidget(self.legendLabel)
|
||||||
|
self.spinBox = QtWidgets.QSpinBox(self.tab)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.spinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.spinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.spinBox.setMaximum(1000)
|
||||||
|
self.spinBox.setProperty("value", 100)
|
||||||
|
self.spinBox.setObjectName("spinBox")
|
||||||
|
self.verticalLayout_4.addWidget(self.spinBox)
|
||||||
|
self.groupBox_4 = QtWidgets.QGroupBox(self.tab)
|
||||||
|
self.groupBox_4.setObjectName("groupBox_4")
|
||||||
|
self.formLayout_2 = QtWidgets.QFormLayout(self.groupBox_4)
|
||||||
|
self.formLayout_2.setObjectName("formLayout_2")
|
||||||
|
self.verticalAxisTickLabel = QtWidgets.QLabel(self.groupBox_4)
|
||||||
|
self.verticalAxisTickLabel.setObjectName("verticalAxisTickLabel")
|
||||||
|
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.verticalAxisTickLabel)
|
||||||
|
self.spinBox_5 = QtWidgets.QSpinBox(self.groupBox_4)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.spinBox_5.sizePolicy().hasHeightForWidth())
|
||||||
|
self.spinBox_5.setSizePolicy(sizePolicy)
|
||||||
|
self.spinBox_5.setMaximum(1000)
|
||||||
|
self.spinBox_5.setProperty("value", 100)
|
||||||
|
self.spinBox_5.setObjectName("spinBox_5")
|
||||||
|
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.spinBox_5)
|
||||||
|
self.verticalAxisLabelSpinBox = QtWidgets.QSpinBox(self.groupBox_4)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.verticalAxisLabelSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.verticalAxisLabelSpinBox.setSizePolicy(sizePolicy)
|
||||||
|
self.verticalAxisLabelSpinBox.setMaximum(1000)
|
||||||
|
self.verticalAxisLabelSpinBox.setProperty("value", 100)
|
||||||
|
self.verticalAxisLabelSpinBox.setObjectName("verticalAxisLabelSpinBox")
|
||||||
|
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.verticalAxisLabelSpinBox)
|
||||||
|
self.verticalAxisLabelLabel = QtWidgets.QLabel(self.groupBox_4)
|
||||||
|
self.verticalAxisLabelLabel.setObjectName("verticalAxisLabelLabel")
|
||||||
|
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.verticalAxisLabelLabel)
|
||||||
|
self.verticalLayout_4.addWidget(self.groupBox_4)
|
||||||
|
self.groupBox_3 = QtWidgets.QGroupBox(self.tab)
|
||||||
|
self.groupBox_3.setObjectName("groupBox_3")
|
||||||
|
self.formLayout = QtWidgets.QFormLayout(self.groupBox_3)
|
||||||
|
self.formLayout.setObjectName("formLayout")
|
||||||
|
self.spinBox_4 = QtWidgets.QSpinBox(self.groupBox_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.spinBox_4.sizePolicy().hasHeightForWidth())
|
||||||
|
self.spinBox_4.setSizePolicy(sizePolicy)
|
||||||
|
self.spinBox_4.setMaximum(1000)
|
||||||
|
self.spinBox_4.setProperty("value", 100)
|
||||||
|
self.spinBox_4.setObjectName("spinBox_4")
|
||||||
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.spinBox_4)
|
||||||
|
self.spinBox_3 = QtWidgets.QSpinBox(self.groupBox_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.spinBox_3.sizePolicy().hasHeightForWidth())
|
||||||
|
self.spinBox_3.setSizePolicy(sizePolicy)
|
||||||
|
self.spinBox_3.setMaximum(1000)
|
||||||
|
self.spinBox_3.setProperty("value", 100)
|
||||||
|
self.spinBox_3.setObjectName("spinBox_3")
|
||||||
|
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.spinBox_3)
|
||||||
|
self.label_10 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_10.setSizePolicy(sizePolicy)
|
||||||
|
self.label_10.setObjectName("label_10")
|
||||||
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_10)
|
||||||
|
self.label_12 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
|
self.label_12.setObjectName("label_12")
|
||||||
|
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_12)
|
||||||
|
self.verticalLayout_4.addWidget(self.groupBox_3)
|
||||||
|
spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout_4.addItem(spacerItem4)
|
||||||
|
self.tabWidget.addTab(self.tab, "")
|
||||||
|
self.tab_2 = QtWidgets.QWidget()
|
||||||
|
self.tab_2.setObjectName("tab_2")
|
||||||
|
self.gridLayout_3 = QtWidgets.QGridLayout(self.tab_2)
|
||||||
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
|
self.spinBox_6 = QtWidgets.QSpinBox(self.tab_2)
|
||||||
|
self.spinBox_6.setMaximum(1000)
|
||||||
|
self.spinBox_6.setProperty("value", 100)
|
||||||
|
self.spinBox_6.setObjectName("spinBox_6")
|
||||||
|
self.gridLayout_3.addWidget(self.spinBox_6, 0, 1, 1, 1)
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.tab_2)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout_3.addWidget(self.label_3, 0, 0, 1, 1)
|
||||||
|
spacerItem5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.gridLayout_3.addItem(spacerItem5, 2, 1, 1, 1)
|
||||||
|
self.doubleSpinBox_7 = QtWidgets.QDoubleSpinBox(self.tab_2)
|
||||||
|
self.doubleSpinBox_7.setDecimals(1)
|
||||||
|
self.doubleSpinBox_7.setMaximum(20.0)
|
||||||
|
self.doubleSpinBox_7.setSingleStep(0.5)
|
||||||
|
self.doubleSpinBox_7.setProperty("value", 1.0)
|
||||||
|
self.doubleSpinBox_7.setObjectName("doubleSpinBox_7")
|
||||||
|
self.gridLayout_3.addWidget(self.doubleSpinBox_7, 1, 1, 1, 1)
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.tab_2)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.gridLayout_3.addWidget(self.label_4, 1, 0, 1, 1)
|
||||||
|
self.tabWidget.addTab(self.tab_2, "")
|
||||||
|
self.verticalLayout.addWidget(self.tabWidget)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Grace settings"))
|
||||||
|
self.bottomMarginDoubleSpinBox.setSuffix(_translate("Dialog", " cm"))
|
||||||
|
self.bottomMarginLabel.setText(_translate("Dialog", "Bottom margin"))
|
||||||
|
self.rightMarginLabel.setText(_translate("Dialog", "Right margin"))
|
||||||
|
self.rightMarginDoubleSpinBox.setSuffix(_translate("Dialog", " cm"))
|
||||||
|
self.leftMarginDoubleSpinBox.setSuffix(_translate("Dialog", " cm"))
|
||||||
|
self.leftMarginLabel.setText(_translate("Dialog", "Left margin"))
|
||||||
|
self.topMarginLabel.setText(_translate("Dialog", "Top margin"))
|
||||||
|
self.topMarginDoubleSpinBox.setSuffix(_translate("Dialog", " cm"))
|
||||||
|
self.heightLabel.setText(_translate("Dialog", "Paper height"))
|
||||||
|
self.heightDoubleSpinBox.setSuffix(_translate("Dialog", " cm"))
|
||||||
|
self.widthLabel.setText(_translate("Dialog", "Paper width"))
|
||||||
|
self.widthDoubleSpinBox.setSuffix(_translate("Dialog", " cm"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), _translate("Dialog", "Dimensions"))
|
||||||
|
self.label_11.setText(_translate("Dialog", "Title"))
|
||||||
|
self.legendLabel.setText(_translate("Dialog", "Legend"))
|
||||||
|
self.groupBox_4.setTitle(_translate("Dialog", "Vertical axis"))
|
||||||
|
self.verticalAxisTickLabel.setText(_translate("Dialog", "tick"))
|
||||||
|
self.verticalAxisLabelLabel.setText(_translate("Dialog", "label"))
|
||||||
|
self.groupBox_3.setTitle(_translate("Dialog", "Horizontal axis"))
|
||||||
|
self.label_10.setText(_translate("Dialog", "tick"))
|
||||||
|
self.label_12.setText(_translate("Dialog", "label"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Dialog", "Fonts"))
|
||||||
|
self.label_3.setText(_translate("Dialog", "Default symbol size"))
|
||||||
|
self.label_4.setText(_translate("Dialog", "Default line size"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Dialog", "Symbol/Line"))
|
74
nmreval/gui_qt/_py/apod_dialog.py
Normal file
74
nmreval/gui_qt/_py/apod_dialog.py
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file '_ui/apod_dialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_ApodEdit(object):
|
||||||
|
def setupUi(self, ApodEdit):
|
||||||
|
ApodEdit.setObjectName("ApodEdit")
|
||||||
|
ApodEdit.resize(784, 484)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(ApodEdit.sizePolicy().hasHeightForWidth())
|
||||||
|
ApodEdit.setSizePolicy(sizePolicy)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(ApodEdit)
|
||||||
|
self.gridLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout.setSpacing(3)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.graphicsView = PlotWidget(ApodEdit)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth())
|
||||||
|
self.graphicsView.setSizePolicy(sizePolicy)
|
||||||
|
self.graphicsView.setObjectName("graphicsView")
|
||||||
|
self.gridLayout.addWidget(self.graphicsView, 2, 0, 1, 1)
|
||||||
|
self.graphicsView_2 = PlotWidget(ApodEdit)
|
||||||
|
self.graphicsView_2.setObjectName("graphicsView_2")
|
||||||
|
self.gridLayout.addWidget(self.graphicsView_2, 2, 1, 1, 1)
|
||||||
|
self.apodcombobox = QtWidgets.QComboBox(ApodEdit)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.apodcombobox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.apodcombobox.setSizePolicy(sizePolicy)
|
||||||
|
self.apodcombobox.setObjectName("apodcombobox")
|
||||||
|
self.gridLayout.addWidget(self.apodcombobox, 0, 0, 1, 1)
|
||||||
|
self.widget_layout = QtWidgets.QHBoxLayout()
|
||||||
|
self.widget_layout.setContentsMargins(-1, 6, -1, -1)
|
||||||
|
self.widget_layout.setSpacing(20)
|
||||||
|
self.widget_layout.setObjectName("widget_layout")
|
||||||
|
self.gridLayout.addLayout(self.widget_layout, 1, 0, 1, 2)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(ApodEdit)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 2)
|
||||||
|
self.eqn_label = QtWidgets.QLabel(ApodEdit)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.eqn_label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.eqn_label.setSizePolicy(sizePolicy)
|
||||||
|
self.eqn_label.setIndent(3)
|
||||||
|
self.eqn_label.setObjectName("eqn_label")
|
||||||
|
self.gridLayout.addWidget(self.eqn_label, 0, 1, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(ApodEdit)
|
||||||
|
self.buttonBox.accepted.connect(ApodEdit.accept)
|
||||||
|
self.buttonBox.rejected.connect(ApodEdit.close)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(ApodEdit)
|
||||||
|
|
||||||
|
def retranslateUi(self, ApodEdit):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
ApodEdit.setWindowTitle(_translate("ApodEdit", "Apodization"))
|
||||||
|
self.eqn_label.setText(_translate("ApodEdit", "TextLabel"))
|
||||||
|
from pyqtgraph import PlotWidget
|
203
nmreval/gui_qt/_py/asciidialog.py
Normal file
203
nmreval/gui_qt/_py/asciidialog.py
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file '_ui/asciidialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_ascii_reader(object):
|
||||||
|
def setupUi(self, ascii_reader):
|
||||||
|
ascii_reader.setObjectName("ascii_reader")
|
||||||
|
ascii_reader.resize(667, 509)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(ascii_reader)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(ascii_reader)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.tabWidgetPage1 = QtWidgets.QWidget()
|
||||||
|
self.tabWidgetPage1.setObjectName("tabWidgetPage1")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.tabWidgetPage1)
|
||||||
|
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.plainTextEdit_2 = QtWidgets.QPlainTextEdit(self.tabWidgetPage1)
|
||||||
|
self.plainTextEdit_2.setEnabled(False)
|
||||||
|
self.plainTextEdit_2.setMaximumSize(QtCore.QSize(16777215, 180))
|
||||||
|
self.plainTextEdit_2.setObjectName("plainTextEdit_2")
|
||||||
|
self.verticalLayout_3.addWidget(self.plainTextEdit_2)
|
||||||
|
self.ascii_table = QtWidgets.QTableWidget(self.tabWidgetPage1)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.ascii_table.sizePolicy().hasHeightForWidth())
|
||||||
|
self.ascii_table.setSizePolicy(sizePolicy)
|
||||||
|
self.ascii_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
||||||
|
self.ascii_table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.ascii_table.setAlternatingRowColors(True)
|
||||||
|
self.ascii_table.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
|
self.ascii_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectColumns)
|
||||||
|
self.ascii_table.setObjectName("ascii_table")
|
||||||
|
self.ascii_table.setColumnCount(0)
|
||||||
|
self.ascii_table.setRowCount(0)
|
||||||
|
self.ascii_table.horizontalHeader().setMinimumSectionSize(1)
|
||||||
|
self.verticalLayout_3.addWidget(self.ascii_table)
|
||||||
|
self.tabWidget.addTab(self.tabWidgetPage1, "")
|
||||||
|
self.tabWidgetPage2 = QtWidgets.QWidget()
|
||||||
|
self.tabWidgetPage2.setObjectName("tabWidgetPage2")
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.tabWidgetPage2)
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.plainTextEdit = QtWidgets.QPlainTextEdit(self.tabWidgetPage2)
|
||||||
|
self.plainTextEdit.setObjectName("plainTextEdit")
|
||||||
|
self.horizontalLayout_3.addWidget(self.plainTextEdit)
|
||||||
|
self.formLayout = QtWidgets.QFormLayout()
|
||||||
|
self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
|
||||||
|
self.formLayout.setContentsMargins(0, -1, -1, -1)
|
||||||
|
self.formLayout.setObjectName("formLayout")
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.tabWidgetPage2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_2.setSizePolicy(sizePolicy)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_2)
|
||||||
|
self.delay_lineedit = QtWidgets.QLineEdit(self.tabWidgetPage2)
|
||||||
|
self.delay_lineedit.setObjectName("delay_lineedit")
|
||||||
|
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.delay_lineedit)
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.tabWidgetPage2)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_3)
|
||||||
|
self.start_lineedit = QtWidgets.QLineEdit(self.tabWidgetPage2)
|
||||||
|
self.start_lineedit.setObjectName("start_lineedit")
|
||||||
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.start_lineedit)
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.tabWidgetPage2)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_4)
|
||||||
|
self.end_lineedit = QtWidgets.QLineEdit(self.tabWidgetPage2)
|
||||||
|
self.end_lineedit.setObjectName("end_lineedit")
|
||||||
|
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.end_lineedit)
|
||||||
|
self.checkBox = QtWidgets.QCheckBox(self.tabWidgetPage2)
|
||||||
|
self.checkBox.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||||
|
self.checkBox.setObjectName("checkBox")
|
||||||
|
self.formLayout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.checkBox)
|
||||||
|
self.checkBox_2 = QtWidgets.QCheckBox(self.tabWidgetPage2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.checkBox_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.checkBox_2.setSizePolicy(sizePolicy)
|
||||||
|
self.checkBox_2.setObjectName("checkBox_2")
|
||||||
|
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.checkBox_2)
|
||||||
|
self.stag_lineEdit = QtWidgets.QLineEdit(self.tabWidgetPage2)
|
||||||
|
self.stag_lineEdit.setEnabled(True)
|
||||||
|
self.stag_lineEdit.setObjectName("stag_lineEdit")
|
||||||
|
self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.stag_lineEdit)
|
||||||
|
self.pushButton = QtWidgets.QPushButton(self.tabWidgetPage2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
|
||||||
|
self.pushButton.setSizePolicy(sizePolicy)
|
||||||
|
icon = QtGui.QIcon.fromTheme("accessories-calculator")
|
||||||
|
self.pushButton.setIcon(icon)
|
||||||
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.pushButton)
|
||||||
|
self.horizontalLayout_3.addLayout(self.formLayout)
|
||||||
|
self.tabWidget.addTab(self.tabWidgetPage2, "")
|
||||||
|
self.verticalLayout.addWidget(self.tabWidget)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.x_label = QtWidgets.QLabel(ascii_reader)
|
||||||
|
self.x_label.setObjectName("x_label")
|
||||||
|
self.horizontalLayout.addWidget(self.x_label)
|
||||||
|
self.x_lineedit = QtWidgets.QLineEdit(ascii_reader)
|
||||||
|
self.x_lineedit.setInputMethodHints(QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers)
|
||||||
|
self.x_lineedit.setObjectName("x_lineedit")
|
||||||
|
self.horizontalLayout.addWidget(self.x_lineedit)
|
||||||
|
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem1)
|
||||||
|
self.y_label = QtWidgets.QLabel(ascii_reader)
|
||||||
|
self.y_label.setObjectName("y_label")
|
||||||
|
self.horizontalLayout.addWidget(self.y_label)
|
||||||
|
self.y_lineedit = QtWidgets.QLineEdit(ascii_reader)
|
||||||
|
self.y_lineedit.setInputMethodHints(QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers)
|
||||||
|
self.y_lineedit.setObjectName("y_lineedit")
|
||||||
|
self.horizontalLayout.addWidget(self.y_lineedit)
|
||||||
|
self.widget = QtWidgets.QWidget(ascii_reader)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.widget)
|
||||||
|
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_4.setSpacing(0)
|
||||||
|
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||||
|
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_4.addItem(spacerItem2)
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label_5.setObjectName("label_5")
|
||||||
|
self.horizontalLayout_4.addWidget(self.label_5)
|
||||||
|
self.lineEdit = QtWidgets.QLineEdit(self.widget)
|
||||||
|
self.lineEdit.setObjectName("lineEdit")
|
||||||
|
self.horizontalLayout_4.addWidget(self.lineEdit)
|
||||||
|
self.horizontalLayout.addWidget(self.widget)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.skippy_checkbox = QtWidgets.QCheckBox(ascii_reader)
|
||||||
|
self.skippy_checkbox.setObjectName("skippy_checkbox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.skippy_checkbox)
|
||||||
|
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem3)
|
||||||
|
self.radioButton = QtWidgets.QRadioButton(ascii_reader)
|
||||||
|
self.radioButton.setChecked(True)
|
||||||
|
self.radioButton.setAutoExclusive(True)
|
||||||
|
self.radioButton.setObjectName("radioButton")
|
||||||
|
self.buttonGroup = QtWidgets.QButtonGroup(ascii_reader)
|
||||||
|
self.buttonGroup.setObjectName("buttonGroup")
|
||||||
|
self.buttonGroup.addButton(self.radioButton)
|
||||||
|
self.horizontalLayout_2.addWidget(self.radioButton)
|
||||||
|
self.radioButton_2 = QtWidgets.QRadioButton(ascii_reader)
|
||||||
|
self.radioButton_2.setAutoExclusive(True)
|
||||||
|
self.radioButton_2.setObjectName("radioButton_2")
|
||||||
|
self.buttonGroup.addButton(self.radioButton_2)
|
||||||
|
self.horizontalLayout_2.addWidget(self.radioButton_2)
|
||||||
|
self.radioButton_3 = QtWidgets.QRadioButton(ascii_reader)
|
||||||
|
self.radioButton_3.setObjectName("radioButton_3")
|
||||||
|
self.buttonGroup.addButton(self.radioButton_3)
|
||||||
|
self.horizontalLayout_2.addWidget(self.radioButton_3)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
|
self.buttonbox = QtWidgets.QDialogButtonBox(ascii_reader)
|
||||||
|
self.buttonbox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonbox.setObjectName("buttonbox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonbox)
|
||||||
|
|
||||||
|
self.retranslateUi(ascii_reader)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
self.buttonbox.rejected.connect(ascii_reader.close)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(ascii_reader)
|
||||||
|
|
||||||
|
def retranslateUi(self, ascii_reader):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
ascii_reader.setWindowTitle(_translate("ascii_reader", "Read text file"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), _translate("ascii_reader", "Data"))
|
||||||
|
self.label_2.setText(_translate("ascii_reader", "Number of delays"))
|
||||||
|
self.label_3.setText(_translate("ascii_reader", "Start value"))
|
||||||
|
self.label_4.setText(_translate("ascii_reader", "End value"))
|
||||||
|
self.checkBox.setText(_translate("ascii_reader", "Logarithmic scale"))
|
||||||
|
self.checkBox_2.setText(_translate("ascii_reader", "Staggered range"))
|
||||||
|
self.pushButton.setText(_translate("ascii_reader", "Calculate delays"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage2), _translate("ascii_reader", "Delays"))
|
||||||
|
self.x_label.setText(_translate("ascii_reader", "x"))
|
||||||
|
self.x_lineedit.setToolTip(_translate("ascii_reader", "<html><head/><body><p>Specify which column is used as x-value.</p></body></html>"))
|
||||||
|
self.y_label.setText(_translate("ascii_reader", "y"))
|
||||||
|
self.y_lineedit.setToolTip(_translate("ascii_reader", "<html><head/><body><p>Specify which columns are read for y-values. (\'Points\': Every number creates a new data set;\'FID\'/\'Spectrum\': Numbers at even positions are used for real parts, at odd positions for imaginary parts.)</p></body></html>"))
|
||||||
|
self.label_5.setText(_translate("ascii_reader", "<html><head/><body><p>Δy</p></body></html>"))
|
||||||
|
self.skippy_checkbox.setToolTip(_translate("ascii_reader", "Use selection for next files. Deletes possible delay values."))
|
||||||
|
self.skippy_checkbox.setText(_translate("ascii_reader", "Skip next dialogues?"))
|
||||||
|
self.radioButton.setText(_translate("ascii_reader", "Points"))
|
||||||
|
self.radioButton_2.setText(_translate("ascii_reader", "FID"))
|
||||||
|
self.radioButton_3.setText(_translate("ascii_reader", "Spectrum"))
|
89
nmreval/gui_qt/_py/axisConfigTemplate.py
Normal file
89
nmreval/gui_qt/_py/axisConfigTemplate.py
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file '_ui/axisConfigTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(186, 154)
|
||||||
|
Form.setMaximumSize(QtCore.QSize(200, 16777215))
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.label = QtWidgets.QLabel(Form)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 7, 0, 1, 2)
|
||||||
|
self.linkCombo = QtWidgets.QComboBox(Form)
|
||||||
|
self.linkCombo.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||||
|
self.linkCombo.setObjectName("linkCombo")
|
||||||
|
self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2)
|
||||||
|
self.autoPercentSpin = QtWidgets.QSpinBox(Form)
|
||||||
|
self.autoPercentSpin.setEnabled(True)
|
||||||
|
self.autoPercentSpin.setMinimum(1)
|
||||||
|
self.autoPercentSpin.setMaximum(100)
|
||||||
|
self.autoPercentSpin.setSingleStep(1)
|
||||||
|
self.autoPercentSpin.setProperty("value", 100)
|
||||||
|
self.autoPercentSpin.setObjectName("autoPercentSpin")
|
||||||
|
self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2)
|
||||||
|
self.autoRadio = QtWidgets.QRadioButton(Form)
|
||||||
|
self.autoRadio.setChecked(True)
|
||||||
|
self.autoRadio.setObjectName("autoRadio")
|
||||||
|
self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2)
|
||||||
|
self.manualRadio = QtWidgets.QRadioButton(Form)
|
||||||
|
self.manualRadio.setObjectName("manualRadio")
|
||||||
|
self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2)
|
||||||
|
self.minText = QtWidgets.QLineEdit(Form)
|
||||||
|
self.minText.setObjectName("minText")
|
||||||
|
self.gridLayout.addWidget(self.minText, 1, 2, 1, 1)
|
||||||
|
self.maxText = QtWidgets.QLineEdit(Form)
|
||||||
|
self.maxText.setObjectName("maxText")
|
||||||
|
self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1)
|
||||||
|
self.invertCheck = QtWidgets.QCheckBox(Form)
|
||||||
|
self.invertCheck.setObjectName("invertCheck")
|
||||||
|
self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4)
|
||||||
|
self.mouseCheck = QtWidgets.QCheckBox(Form)
|
||||||
|
self.mouseCheck.setChecked(True)
|
||||||
|
self.mouseCheck.setObjectName("mouseCheck")
|
||||||
|
self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4)
|
||||||
|
self.visibleOnlyCheck = QtWidgets.QCheckBox(Form)
|
||||||
|
self.visibleOnlyCheck.setObjectName("visibleOnlyCheck")
|
||||||
|
self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2)
|
||||||
|
self.autoPanCheck = QtWidgets.QCheckBox(Form)
|
||||||
|
self.autoPanCheck.setObjectName("autoPanCheck")
|
||||||
|
self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "PyQtGraph"))
|
||||||
|
self.label.setText(_translate("Form", "Link Axis:"))
|
||||||
|
self.linkCombo.setToolTip(_translate("Form", "<html><head/><body><p>Links this axis with another view. When linked, both views will display the same data range.</p></body></html>"))
|
||||||
|
self.autoPercentSpin.setToolTip(_translate("Form", "<html><head/><body><p>Percent of data to be visible when auto-scaling. It may be useful to decrease this value for data with spiky noise.</p></body></html>"))
|
||||||
|
self.autoPercentSpin.setSuffix(_translate("Form", "%"))
|
||||||
|
self.autoRadio.setToolTip(_translate("Form", "<html><head/><body><p>Automatically resize this axis whenever the displayed data is changed.</p></body></html>"))
|
||||||
|
self.autoRadio.setText(_translate("Form", "Auto"))
|
||||||
|
self.manualRadio.setToolTip(_translate("Form", "<html><head/><body><p>Set the range for this axis manually. This disables automatic scaling. </p></body></html>"))
|
||||||
|
self.manualRadio.setText(_translate("Form", "Manual"))
|
||||||
|
self.minText.setToolTip(_translate("Form", "<html><head/><body><p>Minimum value to display for this axis.</p></body></html>"))
|
||||||
|
self.minText.setText(_translate("Form", "0"))
|
||||||
|
self.maxText.setToolTip(_translate("Form", "<html><head/><body><p>Maximum value to display for this axis.</p></body></html>"))
|
||||||
|
self.maxText.setText(_translate("Form", "0"))
|
||||||
|
self.invertCheck.setToolTip(_translate("Form", "<html><head/><body><p>Inverts the display of this axis. (+y points downward instead of upward)</p></body></html>"))
|
||||||
|
self.invertCheck.setText(_translate("Form", "Invert Axis"))
|
||||||
|
self.mouseCheck.setToolTip(_translate("Form", "<html><head/><body><p>Enables mouse interaction (panning, scaling) for this axis.</p></body></html>"))
|
||||||
|
self.mouseCheck.setText(_translate("Form", "Mouse Enabled"))
|
||||||
|
self.visibleOnlyCheck.setToolTip(_translate("Form", "<html><head/><body><p>When checked, the axis will only auto-scale to data that is visible along the orthogonal axis.</p></body></html>"))
|
||||||
|
self.visibleOnlyCheck.setText(_translate("Form", "Visible Data Only"))
|
||||||
|
self.autoPanCheck.setToolTip(_translate("Form", "<html><head/><body><p>When checked, the axis will automatically pan to center on the current data, but the scale along this axis will not change.</p></body></html>"))
|
||||||
|
self.autoPanCheck.setText(_translate("Form", "Auto Pan Only"))
|
64
nmreval/gui_qt/_py/baseline_dialog.py
Normal file
64
nmreval/gui_qt/_py/baseline_dialog.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file '_ui/baseline_dialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_SignalEdit(object):
|
||||||
|
def setupUi(self, SignalEdit):
|
||||||
|
SignalEdit.setObjectName("SignalEdit")
|
||||||
|
SignalEdit.resize(919, 595)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(SignalEdit.sizePolicy().hasHeightForWidth())
|
||||||
|
SignalEdit.setSizePolicy(sizePolicy)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(SignalEdit)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.groupBox = QtWidgets.QWidget(SignalEdit)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.groupBox.setSizePolicy(sizePolicy)
|
||||||
|
self.groupBox.setObjectName("groupBox")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.listWidget = QtWidgets.QListWidget(self.groupBox)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.verticalLayout.addWidget(self.listWidget)
|
||||||
|
self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(SignalEdit)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 3)
|
||||||
|
self.graphicsView = PlotWidget(SignalEdit)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth())
|
||||||
|
self.graphicsView.setSizePolicy(sizePolicy)
|
||||||
|
self.graphicsView.setObjectName("graphicsView")
|
||||||
|
self.gridLayout.addWidget(self.graphicsView, 0, 2, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(SignalEdit)
|
||||||
|
self.buttonBox.accepted.connect(SignalEdit.accept)
|
||||||
|
self.buttonBox.rejected.connect(SignalEdit.close)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(SignalEdit)
|
||||||
|
|
||||||
|
def retranslateUi(self, SignalEdit):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
SignalEdit.setWindowTitle(_translate("SignalEdit", "Dialog"))
|
||||||
|
from pyqtgraph import PlotWidget
|
606
nmreval/gui_qt/_py/basewindow.py
Normal file
606
nmreval/gui_qt/_py/basewindow.py
Normal file
@ -0,0 +1,606 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/basewindow.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_BaseWindow(object):
|
||||||
|
def setupUi(self, BaseWindow):
|
||||||
|
BaseWindow.setObjectName("BaseWindow")
|
||||||
|
BaseWindow.resize(1388, 735)
|
||||||
|
icon = QtGui.QIcon()
|
||||||
|
icon.addPixmap(QtGui.QPixmap(":/logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
BaseWindow.setWindowIcon(icon)
|
||||||
|
BaseWindow.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks|QtWidgets.QMainWindow.AnimatedDocks|QtWidgets.QMainWindow.ForceTabbedDocks|QtWidgets.QMainWindow.VerticalTabs)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(BaseWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.splitter = QtWidgets.QSplitter(self.centralwidget)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(self.splitter)
|
||||||
|
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.West)
|
||||||
|
self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)
|
||||||
|
self.tabWidget.setElideMode(QtCore.Qt.ElideRight)
|
||||||
|
self.tabWidget.setTabsClosable(True)
|
||||||
|
self.tabWidget.setMovable(False)
|
||||||
|
self.tabWidget.setTabBarAutoHide(True)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.datawidget = DataWidget()
|
||||||
|
self.datawidget.setObjectName("datawidget")
|
||||||
|
self.tabWidget.addTab(self.datawidget, "")
|
||||||
|
self.valuewidget = ValueEditWidget()
|
||||||
|
self.valuewidget.setObjectName("valuewidget")
|
||||||
|
icon1 = QtGui.QIcon()
|
||||||
|
icon1.addPixmap(QtGui.QPixmap(":/value_dock"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.tabWidget.addTab(self.valuewidget, icon1, "")
|
||||||
|
self.fit_dialog = QFitDialog()
|
||||||
|
self.fit_dialog.setObjectName("fit_dialog")
|
||||||
|
icon2 = QtGui.QIcon()
|
||||||
|
icon2.addPixmap(QtGui.QPixmap(":/fit_dock"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.tabWidget.addTab(self.fit_dialog, icon2, "")
|
||||||
|
self.editsignalwidget = EditSignalWidget()
|
||||||
|
self.editsignalwidget.setObjectName("editsignalwidget")
|
||||||
|
icon3 = QtGui.QIcon()
|
||||||
|
icon3.addPixmap(QtGui.QPixmap(":/signal_dock"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.tabWidget.addTab(self.editsignalwidget, icon3, "")
|
||||||
|
self.ptsselectwidget = PointSelectWidget()
|
||||||
|
self.ptsselectwidget.setObjectName("ptsselectwidget")
|
||||||
|
icon4 = QtGui.QIcon()
|
||||||
|
icon4.addPixmap(QtGui.QPixmap(":/peakpick_dock"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.tabWidget.addTab(self.ptsselectwidget, icon4, "")
|
||||||
|
self.t1tauwidget = QT1Widget()
|
||||||
|
self.t1tauwidget.setObjectName("t1tauwidget")
|
||||||
|
icon5 = QtGui.QIcon()
|
||||||
|
icon5.addPixmap(QtGui.QPixmap(":/eval_t1_dock"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.tabWidget.addTab(self.t1tauwidget, icon5, "")
|
||||||
|
self.area = QtWidgets.QMdiArea(self.splitter)
|
||||||
|
self.area.setObjectName("area")
|
||||||
|
self.verticalLayout.addWidget(self.splitter)
|
||||||
|
BaseWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.menubar = QtWidgets.QMenuBar(BaseWindow)
|
||||||
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 1388, 30))
|
||||||
|
self.menubar.setObjectName("menubar")
|
||||||
|
self.menuFile = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuFile.setObjectName("menuFile")
|
||||||
|
self.menuSave = QtWidgets.QMenu(self.menuFile)
|
||||||
|
icon6 = QtGui.QIcon()
|
||||||
|
icon6.addPixmap(QtGui.QPixmap(":/Daleks.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.menuSave.setIcon(icon6)
|
||||||
|
self.menuSave.setSeparatorsCollapsible(True)
|
||||||
|
self.menuSave.setObjectName("menuSave")
|
||||||
|
self.menuData = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuData.setObjectName("menuData")
|
||||||
|
self.menuHelp = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuHelp.setObjectName("menuHelp")
|
||||||
|
self.menuExtra = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuExtra.setObjectName("menuExtra")
|
||||||
|
self.menuNormalize = QtWidgets.QMenu(self.menuExtra)
|
||||||
|
icon7 = QtGui.QIcon()
|
||||||
|
icon7.addPixmap(QtGui.QPixmap(":/normal.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.menuNormalize.setIcon(icon7)
|
||||||
|
self.menuNormalize.setObjectName("menuNormalize")
|
||||||
|
self.menuFit = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuFit.setObjectName("menuFit")
|
||||||
|
self.menuMethod = QtWidgets.QMenu(self.menuFit)
|
||||||
|
self.menuMethod.setObjectName("menuMethod")
|
||||||
|
self.menuLimits = QtWidgets.QMenu(self.menuFit)
|
||||||
|
self.menuLimits.setObjectName("menuLimits")
|
||||||
|
self.menuOptions = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuOptions.setObjectName("menuOptions")
|
||||||
|
self.menuWindow = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuWindow.setObjectName("menuWindow")
|
||||||
|
self.menuView = QtWidgets.QMenu(self.menuWindow)
|
||||||
|
self.menuView.setObjectName("menuView")
|
||||||
|
self.menuNMR = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuNMR.setObjectName("menuNMR")
|
||||||
|
self.menuBDS = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuBDS.setObjectName("menuBDS")
|
||||||
|
self.menuSpectrum = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuSpectrum.setObjectName("menuSpectrum")
|
||||||
|
self.menuStuff = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuStuff.setTitle("")
|
||||||
|
self.menuStuff.setObjectName("menuStuff")
|
||||||
|
BaseWindow.setMenuBar(self.menubar)
|
||||||
|
self.toolBar = QtWidgets.QToolBar(BaseWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.toolBar.sizePolicy().hasHeightForWidth())
|
||||||
|
self.toolBar.setSizePolicy(sizePolicy)
|
||||||
|
self.toolBar.setAllowedAreas(QtCore.Qt.AllToolBarAreas)
|
||||||
|
self.toolBar.setIconSize(QtCore.QSize(24, 24))
|
||||||
|
self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
|
||||||
|
self.toolBar.setObjectName("toolBar")
|
||||||
|
BaseWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
|
||||||
|
self.toolbar_edit = QtWidgets.QToolBar(BaseWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.toolbar_edit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.toolbar_edit.setSizePolicy(sizePolicy)
|
||||||
|
self.toolbar_edit.setIconSize(QtCore.QSize(24, 24))
|
||||||
|
self.toolbar_edit.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
|
||||||
|
self.toolbar_edit.setObjectName("toolbar_edit")
|
||||||
|
BaseWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar_edit)
|
||||||
|
self.statusBar = QtWidgets.QStatusBar(BaseWindow)
|
||||||
|
self.statusBar.setObjectName("statusBar")
|
||||||
|
BaseWindow.setStatusBar(self.statusBar)
|
||||||
|
self.toolBar_nmr = QtWidgets.QToolBar(BaseWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.toolBar_nmr.sizePolicy().hasHeightForWidth())
|
||||||
|
self.toolBar_nmr.setSizePolicy(sizePolicy)
|
||||||
|
self.toolBar_nmr.setIconSize(QtCore.QSize(24, 24))
|
||||||
|
self.toolBar_nmr.setObjectName("toolBar_nmr")
|
||||||
|
BaseWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_nmr)
|
||||||
|
self.toolBar_fit = QtWidgets.QToolBar(BaseWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.toolBar_fit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.toolBar_fit.setSizePolicy(sizePolicy)
|
||||||
|
self.toolBar_fit.setIconSize(QtCore.QSize(24, 24))
|
||||||
|
self.toolBar_fit.setObjectName("toolBar_fit")
|
||||||
|
BaseWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_fit)
|
||||||
|
self.toolBar_spectrum = QtWidgets.QToolBar(BaseWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.toolBar_spectrum.sizePolicy().hasHeightForWidth())
|
||||||
|
self.toolBar_spectrum.setSizePolicy(sizePolicy)
|
||||||
|
self.toolBar_spectrum.setIconSize(QtCore.QSize(24, 24))
|
||||||
|
self.toolBar_spectrum.setObjectName("toolBar_spectrum")
|
||||||
|
BaseWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_spectrum)
|
||||||
|
self.toolBar_data = QtWidgets.QToolBar(BaseWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.toolBar_data.sizePolicy().hasHeightForWidth())
|
||||||
|
self.toolBar_data.setSizePolicy(sizePolicy)
|
||||||
|
self.toolBar_data.setIconSize(QtCore.QSize(24, 24))
|
||||||
|
self.toolBar_data.setObjectName("toolBar_data")
|
||||||
|
BaseWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_data)
|
||||||
|
self.action_close = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("window-close")
|
||||||
|
self.action_close.setIcon(icon)
|
||||||
|
self.action_close.setObjectName("action_close")
|
||||||
|
self.actionExportGraphic = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionExportGraphic.setObjectName("actionExportGraphic")
|
||||||
|
self.action_open = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_open.setObjectName("action_open")
|
||||||
|
self.actionExportData = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionExportData.setObjectName("actionExportData")
|
||||||
|
self.action_calc = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_calc.setObjectName("action_calc")
|
||||||
|
self.action_delete_sets = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("edit-delete")
|
||||||
|
self.action_delete_sets.setIcon(icon)
|
||||||
|
self.action_delete_sets.setObjectName("action_delete_sets")
|
||||||
|
self.action_save_fit_parameter = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_save_fit_parameter.setObjectName("action_save_fit_parameter")
|
||||||
|
self.action_sort_pts = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_sort_pts.setObjectName("action_sort_pts")
|
||||||
|
self.action_reset = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("edit-clear")
|
||||||
|
self.action_reset.setIcon(icon)
|
||||||
|
self.action_reset.setObjectName("action_reset")
|
||||||
|
self.actionDocumentation = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("help-about")
|
||||||
|
self.actionDocumentation.setIcon(icon)
|
||||||
|
self.actionDocumentation.setObjectName("actionDocumentation")
|
||||||
|
self.action_FitWidget = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_FitWidget.setObjectName("action_FitWidget")
|
||||||
|
self.action_norm_max = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_norm_max.setObjectName("action_norm_max")
|
||||||
|
self.action_norm_first = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_norm_first.setObjectName("action_norm_first")
|
||||||
|
self.action_norm_area = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_norm_area.setObjectName("action_norm_area")
|
||||||
|
self.action_norm_max_abs = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_norm_max_abs.setObjectName("action_norm_max_abs")
|
||||||
|
self.action_norm_last = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_norm_last.setObjectName("action_norm_last")
|
||||||
|
self.actionSave = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionSave.setObjectName("actionSave")
|
||||||
|
self.actiontoolbar_display = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actiontoolbar_display.setCheckable(True)
|
||||||
|
self.actiontoolbar_display.setObjectName("actiontoolbar_display")
|
||||||
|
self.actionEdit_toolbars = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionEdit_toolbars.setCheckable(True)
|
||||||
|
self.actionEdit_toolbars.setObjectName("actionEdit_toolbars")
|
||||||
|
self.actionAddlines = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionAddlines.setObjectName("actionAddlines")
|
||||||
|
self.actionColors = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionColors.setObjectName("actionColors")
|
||||||
|
self.actionConcatenate_sets = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionConcatenate_sets.setObjectName("actionConcatenate_sets")
|
||||||
|
self.actionShift = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionShift.setObjectName("actionShift")
|
||||||
|
self.actionShow_log = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("dialog-information")
|
||||||
|
self.actionShow_log.setIcon(icon)
|
||||||
|
self.actionShow_log.setObjectName("actionShow_log")
|
||||||
|
self.action_create_fit_function = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_create_fit_function.setObjectName("action_create_fit_function")
|
||||||
|
self.actionGrace_preferences = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionGrace_preferences.setObjectName("actionGrace_preferences")
|
||||||
|
self.actionSave_session = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionSave_session.setObjectName("actionSave_session")
|
||||||
|
self.actionMouse_behaviour = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionMouse_behaviour.setCheckable(True)
|
||||||
|
self.actionMouse_behaviour.setObjectName("actionMouse_behaviour")
|
||||||
|
self.actionConfiguration = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionConfiguration.setObjectName("actionConfiguration")
|
||||||
|
self.actionRefresh = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("view-refresh")
|
||||||
|
self.actionRefresh.setIcon(icon)
|
||||||
|
self.actionRefresh.setObjectName("actionRefresh")
|
||||||
|
self.actionInterpolation = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionInterpolation.setObjectName("actionInterpolation")
|
||||||
|
self.actionRunning_values = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionRunning_values.setObjectName("actionRunning_values")
|
||||||
|
self.actionFit_parameter_saving = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionFit_parameter_saving.setObjectName("actionFit_parameter_saving")
|
||||||
|
self.actionShow_fit_parameter = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionShow_fit_parameter.setObjectName("actionShow_fit_parameter")
|
||||||
|
self.actionSkip_points = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionSkip_points.setObjectName("actionSkip_points")
|
||||||
|
self.actionGuide_lines = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionGuide_lines.setObjectName("actionGuide_lines")
|
||||||
|
self.actionMaximize = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionMaximize.setCheckable(True)
|
||||||
|
self.actionMaximize.setVisible(False)
|
||||||
|
self.actionMaximize.setObjectName("actionMaximize")
|
||||||
|
self.actionTile = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionTile.setObjectName("actionTile")
|
||||||
|
self.actionMinimize = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionMinimize.setCheckable(True)
|
||||||
|
self.actionMinimize.setVisible(False)
|
||||||
|
self.actionMinimize.setObjectName("actionMinimize")
|
||||||
|
self.actionNew_window = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionNew_window.setObjectName("actionNew_window")
|
||||||
|
self.actionDelete_window = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("edit-delete")
|
||||||
|
self.actionDelete_window.setIcon(icon)
|
||||||
|
self.actionDelete_window.setObjectName("actionDelete_window")
|
||||||
|
self.actionCascade_windows = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionCascade_windows.setObjectName("actionCascade_windows")
|
||||||
|
self.actionNext_window = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionNext_window.setObjectName("actionNext_window")
|
||||||
|
self.actionPrevious = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionPrevious.setObjectName("actionPrevious")
|
||||||
|
self.t1action = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.t1action.setObjectName("t1action")
|
||||||
|
self.t1tau = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.t1tau.setObjectName("t1tau")
|
||||||
|
self.action_coup_calc = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_coup_calc.setObjectName("action_coup_calc")
|
||||||
|
self.action_calc_eps_derivative = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_calc_eps_derivative.setObjectName("action_calc_eps_derivative")
|
||||||
|
self.actionOpen_FC = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionOpen_FC.setObjectName("actionOpen_FC")
|
||||||
|
self.action_mean_t1 = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_mean_t1.setObjectName("action_mean_t1")
|
||||||
|
self.actionFilon = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionFilon.setObjectName("actionFilon")
|
||||||
|
self.action_new_set = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_new_set.setObjectName("action_new_set")
|
||||||
|
self.action_magnitude = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_magnitude.setObjectName("action_magnitude")
|
||||||
|
self.actionCenterMax = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionCenterMax.setObjectName("actionCenterMax")
|
||||||
|
self.action_depake = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_depake.setObjectName("action_depake")
|
||||||
|
self.action_edit = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_edit.setObjectName("action_edit")
|
||||||
|
self.actionPick_position = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionPick_position.setObjectName("actionPick_position")
|
||||||
|
self.actionIntegrate = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionIntegrate.setObjectName("actionIntegrate")
|
||||||
|
self.actionDerivation = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionDerivation.setObjectName("actionDerivation")
|
||||||
|
self.actionIntegration = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionIntegration.setObjectName("actionIntegration")
|
||||||
|
self.action_cut = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_cut.setObjectName("action_cut")
|
||||||
|
self.actionMove_between_plots = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionMove_between_plots.setObjectName("actionMove_between_plots")
|
||||||
|
self.actionBaseline = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionBaseline.setObjectName("actionBaseline")
|
||||||
|
self.actionCalculateT1 = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionCalculateT1.setObjectName("actionCalculateT1")
|
||||||
|
self.actionChange_datatypes = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionChange_datatypes.setObjectName("actionChange_datatypes")
|
||||||
|
self.actionPrint = QtWidgets.QAction(BaseWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme("document-print")
|
||||||
|
self.actionPrint.setIcon(icon)
|
||||||
|
self.actionPrint.setObjectName("actionPrint")
|
||||||
|
self.action_lm_fit = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_lm_fit.setCheckable(True)
|
||||||
|
self.action_lm_fit.setChecked(True)
|
||||||
|
self.action_lm_fit.setObjectName("action_lm_fit")
|
||||||
|
self.action_nm_fit = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_nm_fit.setCheckable(True)
|
||||||
|
self.action_nm_fit.setObjectName("action_nm_fit")
|
||||||
|
self.action_odr_fit = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_odr_fit.setCheckable(True)
|
||||||
|
self.action_odr_fit.setObjectName("action_odr_fit")
|
||||||
|
self.action_no_range = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_no_range.setCheckable(True)
|
||||||
|
self.action_no_range.setChecked(False)
|
||||||
|
self.action_no_range.setObjectName("action_no_range")
|
||||||
|
self.action_x_range = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_x_range.setCheckable(True)
|
||||||
|
self.action_x_range.setChecked(True)
|
||||||
|
self.action_x_range.setObjectName("action_x_range")
|
||||||
|
self.action_custom_range = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.action_custom_range.setCheckable(True)
|
||||||
|
self.action_custom_range.setObjectName("action_custom_range")
|
||||||
|
self.actionSnake = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionSnake.setObjectName("actionSnake")
|
||||||
|
self.actionFunction_editor = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionFunction_editor.setObjectName("actionFunction_editor")
|
||||||
|
self.actionLife = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionLife.setObjectName("actionLife")
|
||||||
|
self.actionTetris = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionTetris.setObjectName("actionTetris")
|
||||||
|
self.actionUpdate = QtWidgets.QAction(BaseWindow)
|
||||||
|
self.actionUpdate.setObjectName("actionUpdate")
|
||||||
|
self.menuSave.addAction(self.actionSave)
|
||||||
|
self.menuSave.addAction(self.actionExportGraphic)
|
||||||
|
self.menuSave.addAction(self.action_save_fit_parameter)
|
||||||
|
self.menuFile.addAction(self.action_open)
|
||||||
|
self.menuFile.addAction(self.actionOpen_FC)
|
||||||
|
self.menuFile.addAction(self.menuSave.menuAction())
|
||||||
|
self.menuFile.addSeparator()
|
||||||
|
self.menuFile.addAction(self.actionPrint)
|
||||||
|
self.menuFile.addAction(self.action_reset)
|
||||||
|
self.menuFile.addSeparator()
|
||||||
|
self.menuFile.addAction(self.action_close)
|
||||||
|
self.menuFile.addSeparator()
|
||||||
|
self.menuData.addAction(self.action_new_set)
|
||||||
|
self.menuData.addAction(self.action_delete_sets)
|
||||||
|
self.menuData.addAction(self.actionMove_between_plots)
|
||||||
|
self.menuData.addAction(self.actionConcatenate_sets)
|
||||||
|
self.menuData.addAction(self.actionAddlines)
|
||||||
|
self.menuData.addSeparator()
|
||||||
|
self.menuData.addAction(self.action_sort_pts)
|
||||||
|
self.menuData.addAction(self.actionSkip_points)
|
||||||
|
self.menuData.addSeparator()
|
||||||
|
self.menuData.addAction(self.action_cut)
|
||||||
|
self.menuData.addSeparator()
|
||||||
|
self.menuData.addAction(self.actionChange_datatypes)
|
||||||
|
self.menuHelp.addAction(self.actionDocumentation)
|
||||||
|
self.menuHelp.addAction(self.actionUpdate)
|
||||||
|
self.menuNormalize.addAction(self.action_norm_max)
|
||||||
|
self.menuNormalize.addAction(self.action_norm_max_abs)
|
||||||
|
self.menuNormalize.addSeparator()
|
||||||
|
self.menuNormalize.addAction(self.action_norm_first)
|
||||||
|
self.menuNormalize.addAction(self.action_norm_last)
|
||||||
|
self.menuNormalize.addSeparator()
|
||||||
|
self.menuNormalize.addAction(self.action_norm_area)
|
||||||
|
self.menuExtra.addAction(self.action_mean_t1)
|
||||||
|
self.menuExtra.addSeparator()
|
||||||
|
self.menuExtra.addAction(self.actionFilon)
|
||||||
|
self.menuExtra.addAction(self.actionDerivation)
|
||||||
|
self.menuExtra.addAction(self.actionIntegration)
|
||||||
|
self.menuExtra.addSeparator()
|
||||||
|
self.menuExtra.addAction(self.menuNormalize.menuAction())
|
||||||
|
self.menuExtra.addAction(self.actionInterpolation)
|
||||||
|
self.menuExtra.addAction(self.actionRunning_values)
|
||||||
|
self.menuExtra.addAction(self.actionShift)
|
||||||
|
self.menuExtra.addSeparator()
|
||||||
|
self.menuExtra.addAction(self.action_calc)
|
||||||
|
self.menuMethod.addAction(self.action_lm_fit)
|
||||||
|
self.menuMethod.addAction(self.action_nm_fit)
|
||||||
|
self.menuMethod.addAction(self.action_odr_fit)
|
||||||
|
self.menuLimits.addAction(self.action_no_range)
|
||||||
|
self.menuLimits.addAction(self.action_x_range)
|
||||||
|
self.menuLimits.addAction(self.action_custom_range)
|
||||||
|
self.menuFit.addAction(self.action_FitWidget)
|
||||||
|
self.menuFit.addSeparator()
|
||||||
|
self.menuFit.addAction(self.action_create_fit_function)
|
||||||
|
self.menuFit.addAction(self.actionFunction_editor)
|
||||||
|
self.menuFit.addSeparator()
|
||||||
|
self.menuFit.addAction(self.actionShow_fit_parameter)
|
||||||
|
self.menuFit.addAction(self.menuMethod.menuAction())
|
||||||
|
self.menuFit.addAction(self.menuLimits.menuAction())
|
||||||
|
self.menuOptions.addAction(self.actionMouse_behaviour)
|
||||||
|
self.menuOptions.addSeparator()
|
||||||
|
self.menuOptions.addAction(self.actionGrace_preferences)
|
||||||
|
self.menuOptions.addAction(self.actionConfiguration)
|
||||||
|
self.menuView.addAction(self.actionTile)
|
||||||
|
self.menuView.addAction(self.actionCascade_windows)
|
||||||
|
self.menuWindow.addAction(self.actionNew_window)
|
||||||
|
self.menuWindow.addAction(self.actionDelete_window)
|
||||||
|
self.menuWindow.addSeparator()
|
||||||
|
self.menuWindow.addAction(self.actionNext_window)
|
||||||
|
self.menuWindow.addAction(self.actionPrevious)
|
||||||
|
self.menuWindow.addAction(self.actionMaximize)
|
||||||
|
self.menuWindow.addAction(self.actionMinimize)
|
||||||
|
self.menuWindow.addAction(self.menuView.menuAction())
|
||||||
|
self.menuWindow.addSeparator()
|
||||||
|
self.menuWindow.addAction(self.actionRefresh)
|
||||||
|
self.menuNMR.addAction(self.t1action)
|
||||||
|
self.menuNMR.addAction(self.actionCalculateT1)
|
||||||
|
self.menuNMR.addAction(self.action_coup_calc)
|
||||||
|
self.menuBDS.addAction(self.action_calc_eps_derivative)
|
||||||
|
self.menuSpectrum.addAction(self.action_magnitude)
|
||||||
|
self.menuSpectrum.addAction(self.actionCenterMax)
|
||||||
|
self.menuSpectrum.addAction(self.action_depake)
|
||||||
|
self.menuSpectrum.addSeparator()
|
||||||
|
self.menuSpectrum.addAction(self.action_edit)
|
||||||
|
self.menuSpectrum.addAction(self.actionBaseline)
|
||||||
|
self.menuSpectrum.addAction(self.actionPick_position)
|
||||||
|
self.menuStuff.addAction(self.actionSnake)
|
||||||
|
self.menuStuff.addAction(self.actionLife)
|
||||||
|
self.menuStuff.addAction(self.actionTetris)
|
||||||
|
self.menubar.addAction(self.menuFile.menuAction())
|
||||||
|
self.menubar.addAction(self.menuWindow.menuAction())
|
||||||
|
self.menubar.addAction(self.menuData.menuAction())
|
||||||
|
self.menubar.addAction(self.menuExtra.menuAction())
|
||||||
|
self.menubar.addAction(self.menuSpectrum.menuAction())
|
||||||
|
self.menubar.addAction(self.menuFit.menuAction())
|
||||||
|
self.menubar.addAction(self.menuNMR.menuAction())
|
||||||
|
self.menubar.addAction(self.menuBDS.menuAction())
|
||||||
|
self.menubar.addAction(self.menuOptions.menuAction())
|
||||||
|
self.menubar.addAction(self.menuHelp.menuAction())
|
||||||
|
self.menubar.addAction(self.menuStuff.menuAction())
|
||||||
|
self.toolBar.addAction(self.action_open)
|
||||||
|
self.toolBar.addAction(self.actionSave)
|
||||||
|
self.toolBar.addSeparator()
|
||||||
|
self.toolBar.addAction(self.actionMouse_behaviour)
|
||||||
|
self.toolbar_edit.addAction(self.action_calc)
|
||||||
|
self.toolbar_edit.addAction(self.action_mean_t1)
|
||||||
|
self.toolbar_edit.addAction(self.actionShift)
|
||||||
|
self.toolBar_nmr.addAction(self.t1action)
|
||||||
|
self.toolBar_nmr.addAction(self.actionCalculateT1)
|
||||||
|
self.toolBar_fit.addAction(self.action_FitWidget)
|
||||||
|
self.toolBar_spectrum.addAction(self.action_edit)
|
||||||
|
self.toolBar_spectrum.addAction(self.actionPick_position)
|
||||||
|
self.toolBar_data.addAction(self.actionConcatenate_sets)
|
||||||
|
self.toolBar_data.addAction(self.action_sort_pts)
|
||||||
|
|
||||||
|
self.retranslateUi(BaseWindow)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
self.action_close.triggered.connect(BaseWindow.close)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(BaseWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, BaseWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
BaseWindow.setWindowTitle(_translate("BaseWindow", "Mr. Godot told me to tell you he won\'t come this evening but surely tomorrow."))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.datawidget), _translate("BaseWindow", "Data"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.valuewidget), _translate("BaseWindow", "Values"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.fit_dialog), _translate("BaseWindow", "Fit"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.editsignalwidget), _translate("BaseWindow", "Signals"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.ptsselectwidget), _translate("BaseWindow", "Pick points"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.t1tauwidget), _translate("BaseWindow", "SLR"))
|
||||||
|
self.menuFile.setTitle(_translate("BaseWindow", "&File"))
|
||||||
|
self.menuSave.setTitle(_translate("BaseWindow", "&Save..."))
|
||||||
|
self.menuData.setTitle(_translate("BaseWindow", "&Data"))
|
||||||
|
self.menuHelp.setTitle(_translate("BaseWindow", "&Help"))
|
||||||
|
self.menuExtra.setTitle(_translate("BaseWindow", "Math"))
|
||||||
|
self.menuNormalize.setTitle(_translate("BaseWindow", "&Normalize"))
|
||||||
|
self.menuFit.setTitle(_translate("BaseWindow", "F&it"))
|
||||||
|
self.menuMethod.setTitle(_translate("BaseWindow", "Method"))
|
||||||
|
self.menuLimits.setTitle(_translate("BaseWindow", "Limits"))
|
||||||
|
self.menuOptions.setTitle(_translate("BaseWindow", "Options"))
|
||||||
|
self.menuWindow.setTitle(_translate("BaseWindow", "Plots"))
|
||||||
|
self.menuView.setTitle(_translate("BaseWindow", "View"))
|
||||||
|
self.menuNMR.setTitle(_translate("BaseWindow", "NMR"))
|
||||||
|
self.menuBDS.setTitle(_translate("BaseWindow", "BDS"))
|
||||||
|
self.menuSpectrum.setTitle(_translate("BaseWindow", "Spectrum"))
|
||||||
|
self.toolBar.setWindowTitle(_translate("BaseWindow", "Main"))
|
||||||
|
self.toolbar_edit.setWindowTitle(_translate("BaseWindow", "Edit"))
|
||||||
|
self.toolBar_nmr.setWindowTitle(_translate("BaseWindow", "NMR"))
|
||||||
|
self.toolBar_fit.setWindowTitle(_translate("BaseWindow", "Fit"))
|
||||||
|
self.toolBar_spectrum.setWindowTitle(_translate("BaseWindow", "Spectrum"))
|
||||||
|
self.toolBar_data.setWindowTitle(_translate("BaseWindow", "toolBar_2"))
|
||||||
|
self.action_close.setText(_translate("BaseWindow", "&Quit"))
|
||||||
|
self.action_close.setShortcut(_translate("BaseWindow", "Ctrl+Q"))
|
||||||
|
self.actionExportGraphic.setText(_translate("BaseWindow", "Export graphic..."))
|
||||||
|
self.actionExportGraphic.setShortcut(_translate("BaseWindow", "Ctrl+Shift+S"))
|
||||||
|
self.action_open.setText(_translate("BaseWindow", "&Open..."))
|
||||||
|
self.action_open.setShortcut(_translate("BaseWindow", "Ctrl+O"))
|
||||||
|
self.actionExportData.setText(_translate("BaseWindow", "Export data..."))
|
||||||
|
self.actionExportData.setShortcut(_translate("BaseWindow", "Ctrl+Shift+S"))
|
||||||
|
self.action_calc.setText(_translate("BaseWindow", "&Evaluate expression..."))
|
||||||
|
self.action_delete_sets.setText(_translate("BaseWindow", "&Delete Set"))
|
||||||
|
self.action_delete_sets.setShortcut(_translate("BaseWindow", "Ctrl+Del"))
|
||||||
|
self.action_save_fit_parameter.setText(_translate("BaseWindow", "Save fit ¶meter..."))
|
||||||
|
self.action_sort_pts.setText(_translate("BaseWindow", "Sort &points"))
|
||||||
|
self.action_reset.setText(_translate("BaseWindow", "&Reset"))
|
||||||
|
self.action_reset.setShortcut(_translate("BaseWindow", "Ctrl+R"))
|
||||||
|
self.actionDocumentation.setText(_translate("BaseWindow", "&Documentation"))
|
||||||
|
self.actionDocumentation.setShortcut(_translate("BaseWindow", "F1"))
|
||||||
|
self.action_FitWidget.setText(_translate("BaseWindow", "Open &Fit"))
|
||||||
|
self.action_FitWidget.setShortcut(_translate("BaseWindow", "Ctrl+F"))
|
||||||
|
self.action_norm_max.setText(_translate("BaseWindow", "&Max"))
|
||||||
|
self.action_norm_first.setText(_translate("BaseWindow", "&First point"))
|
||||||
|
self.action_norm_area.setText(_translate("BaseWindow", "&Area"))
|
||||||
|
self.action_norm_max_abs.setText(_translate("BaseWindow", "Ma&x(Abs)"))
|
||||||
|
self.action_norm_last.setText(_translate("BaseWindow", "&Last point"))
|
||||||
|
self.actionSave.setText(_translate("BaseWindow", "S&ave..."))
|
||||||
|
self.actionSave.setShortcut(_translate("BaseWindow", "Ctrl+S"))
|
||||||
|
self.actiontoolbar_display.setText(_translate("BaseWindow", "&Views"))
|
||||||
|
self.actionEdit_toolbars.setText(_translate("BaseWindow", "&Edit"))
|
||||||
|
self.actionAddlines.setText(_translate("BaseWindow", "Set by function..."))
|
||||||
|
self.actionColors.setText(_translate("BaseWindow", "&Reset color"))
|
||||||
|
self.actionConcatenate_sets.setText(_translate("BaseWindow", "Join sets"))
|
||||||
|
self.actionShift.setText(_translate("BaseWindow", "&Shift/scale..."))
|
||||||
|
self.actionShow_log.setText(_translate("BaseWindow", "&Show log..."))
|
||||||
|
self.action_create_fit_function.setText(_translate("BaseWindow", "&Create fit function..."))
|
||||||
|
self.actionGrace_preferences.setText(_translate("BaseWindow", "&Grace preferences..."))
|
||||||
|
self.actionSave_session.setText(_translate("BaseWindow", "Update session"))
|
||||||
|
self.actionMouse_behaviour.setText(_translate("BaseWindow", "Mouse behaviour"))
|
||||||
|
self.actionMouse_behaviour.setToolTip(_translate("BaseWindow", "Switch between zoom and pan in graph."))
|
||||||
|
self.actionConfiguration.setText(_translate("BaseWindow", "Configuration..."))
|
||||||
|
self.actionRefresh.setText(_translate("BaseWindow", "Refresh"))
|
||||||
|
self.actionRefresh.setShortcut(_translate("BaseWindow", "F5"))
|
||||||
|
self.actionInterpolation.setText(_translate("BaseWindow", "Interpolation..."))
|
||||||
|
self.actionRunning_values.setText(_translate("BaseWindow", "Smoothing..."))
|
||||||
|
self.actionFit_parameter_saving.setText(_translate("BaseWindow", "Fit parameter saving..."))
|
||||||
|
self.actionShow_fit_parameter.setText(_translate("BaseWindow", "Parameter..."))
|
||||||
|
self.actionSkip_points.setText(_translate("BaseWindow", "Skip points..."))
|
||||||
|
self.actionGuide_lines.setText(_translate("BaseWindow", "Draw lines..."))
|
||||||
|
self.actionMaximize.setText(_translate("BaseWindow", "Maximize"))
|
||||||
|
self.actionTile.setText(_translate("BaseWindow", "Tile windows"))
|
||||||
|
self.actionMinimize.setText(_translate("BaseWindow", "Minimize"))
|
||||||
|
self.actionNew_window.setText(_translate("BaseWindow", "New plot"))
|
||||||
|
self.actionDelete_window.setText(_translate("BaseWindow", "Delete plot"))
|
||||||
|
self.actionCascade_windows.setText(_translate("BaseWindow", "Cascade windows"))
|
||||||
|
self.actionNext_window.setText(_translate("BaseWindow", "Next"))
|
||||||
|
self.actionNext_window.setShortcut(_translate("BaseWindow", "Alt+Right"))
|
||||||
|
self.actionPrevious.setText(_translate("BaseWindow", "Previous"))
|
||||||
|
self.actionPrevious.setShortcut(_translate("BaseWindow", "Alt+Left"))
|
||||||
|
self.t1action.setText(_translate("BaseWindow", "Evaluate T1 minimum..."))
|
||||||
|
self.t1tau.setText(_translate("BaseWindow", "Calculate T1..."))
|
||||||
|
self.action_coup_calc.setText(_translate("BaseWindow", "Coupling values..."))
|
||||||
|
self.action_calc_eps_derivative.setText(_translate("BaseWindow", "Calculate derivative loss"))
|
||||||
|
self.actionOpen_FC.setText(_translate("BaseWindow", "Read FC data..."))
|
||||||
|
self.action_mean_t1.setText(_translate("BaseWindow", "Convert mean values..."))
|
||||||
|
self.actionFilon.setText(_translate("BaseWindow", "Log FT..."))
|
||||||
|
self.action_new_set.setText(_translate("BaseWindow", "New set"))
|
||||||
|
self.action_magnitude.setText(_translate("BaseWindow", "Calculate magnitude"))
|
||||||
|
self.actionCenterMax.setText(_translate("BaseWindow", "Center on max"))
|
||||||
|
self.action_depake.setText(_translate("BaseWindow", "De-paked spectrum"))
|
||||||
|
self.action_edit.setText(_translate("BaseWindow", "Edit signals..."))
|
||||||
|
self.actionPick_position.setText(_translate("BaseWindow", "Pick points..."))
|
||||||
|
self.actionIntegrate.setText(_translate("BaseWindow", "Integrate"))
|
||||||
|
self.actionDerivation.setText(_translate("BaseWindow", "Differentiation..."))
|
||||||
|
self.actionIntegration.setText(_translate("BaseWindow", "Integration..."))
|
||||||
|
self.action_cut.setText(_translate("BaseWindow", "Cut to visible range"))
|
||||||
|
self.actionMove_between_plots.setText(_translate("BaseWindow", "Move sets..."))
|
||||||
|
self.actionBaseline.setText(_translate("BaseWindow", "Baseline..."))
|
||||||
|
self.actionCalculateT1.setText(_translate("BaseWindow", "Calculate relaxation..."))
|
||||||
|
self.actionChange_datatypes.setText(_translate("BaseWindow", "Change datatypes..."))
|
||||||
|
self.actionPrint.setText(_translate("BaseWindow", "Print..."))
|
||||||
|
self.actionPrint.setShortcut(_translate("BaseWindow", "Ctrl+P"))
|
||||||
|
self.action_lm_fit.setText(_translate("BaseWindow", "Default stuff"))
|
||||||
|
self.action_nm_fit.setText(_translate("BaseWindow", "Nelder-Mead"))
|
||||||
|
self.action_odr_fit.setText(_translate("BaseWindow", "ODR"))
|
||||||
|
self.action_no_range.setText(_translate("BaseWindow", "None"))
|
||||||
|
self.action_x_range.setText(_translate("BaseWindow", "Visible x range"))
|
||||||
|
self.action_custom_range.setText(_translate("BaseWindow", "Custom"))
|
||||||
|
self.actionSnake.setText(_translate("BaseWindow", "Worms"))
|
||||||
|
self.actionFunction_editor.setText(_translate("BaseWindow", "Function editor..."))
|
||||||
|
self.actionLife.setText(_translate("BaseWindow", "Life..."))
|
||||||
|
self.actionTetris.setText(_translate("BaseWindow", "Not Tetris"))
|
||||||
|
self.actionUpdate.setText(_translate("BaseWindow", "Look for updates"))
|
||||||
|
from ..data.datawidget.datawidget import DataWidget
|
||||||
|
from ..data.point_select import PointSelectWidget
|
||||||
|
from ..data.signaledit.editsignalwidget import EditSignalWidget
|
||||||
|
from ..data.valueeditwidget import ValueEditWidget
|
||||||
|
from ..fit.fitwindow import QFitDialog
|
||||||
|
from ..nmr.t1widget import QT1Widget
|
76
nmreval/gui_qt/_py/bdsdialog.py
Normal file
76
nmreval/gui_qt/_py/bdsdialog.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/bdsdialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(400, 319)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.listWidget = QtWidgets.QListWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.gridLayout.addWidget(self.listWidget, 1, 0, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label.setSizePolicy(sizePolicy)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_2.setSizePolicy(sizePolicy)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.eps_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.eps_checkBox.setChecked(True)
|
||||||
|
self.eps_checkBox.setObjectName("eps_checkBox")
|
||||||
|
self.verticalLayout.addWidget(self.eps_checkBox)
|
||||||
|
self.modul_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.modul_checkBox.setObjectName("modul_checkBox")
|
||||||
|
self.verticalLayout.addWidget(self.modul_checkBox)
|
||||||
|
self.cond_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.cond_checkBox.setObjectName("cond_checkBox")
|
||||||
|
self.verticalLayout.addWidget(self.cond_checkBox)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout.addItem(spacerItem)
|
||||||
|
self.gridLayout.addLayout(self.verticalLayout, 1, 1, 1, 1)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Read BDS data"))
|
||||||
|
self.label.setText(_translate("Dialog", "Found temperatures"))
|
||||||
|
self.label_2.setText(_translate("Dialog", "Read as:"))
|
||||||
|
self.eps_checkBox.setText(_translate("Dialog", "Permittivity ε"))
|
||||||
|
self.modul_checkBox.setText(_translate("Dialog", "Modulus 1/ε"))
|
||||||
|
self.cond_checkBox.setText(_translate("Dialog", "Conductivity iεω"))
|
84
nmreval/gui_qt/_py/color_palette.py
Normal file
84
nmreval/gui_qt/_py/color_palette.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/color_palette.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(390, 409)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.append_palette_button = QtWidgets.QPushButton(Dialog)
|
||||||
|
self.append_palette_button.setObjectName("append_palette_button")
|
||||||
|
self.gridLayout.addWidget(self.append_palette_button, 2, 0, 1, 1)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.gridLayout.addItem(spacerItem, 4, 0, 1, 1)
|
||||||
|
self.palette_combobox = QtWidgets.QComboBox(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.palette_combobox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.palette_combobox.setSizePolicy(sizePolicy)
|
||||||
|
self.palette_combobox.setObjectName("palette_combobox")
|
||||||
|
self.gridLayout.addWidget(self.palette_combobox, 0, 0, 1, 1)
|
||||||
|
self.add_color_button = QtWidgets.QPushButton(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.add_color_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.add_color_button.setSizePolicy(sizePolicy)
|
||||||
|
self.add_color_button.setObjectName("add_color_button")
|
||||||
|
self.gridLayout.addWidget(self.add_color_button, 6, 0, 1, 1)
|
||||||
|
self.color_combobox = ColorListEditor(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.color_combobox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.color_combobox.setSizePolicy(sizePolicy)
|
||||||
|
self.color_combobox.setObjectName("color_combobox")
|
||||||
|
self.gridLayout.addWidget(self.color_combobox, 5, 0, 1, 1)
|
||||||
|
self.save_button = QtWidgets.QPushButton(Dialog)
|
||||||
|
self.save_button.setObjectName("save_button")
|
||||||
|
self.gridLayout.addWidget(self.save_button, 9, 1, 1, 1)
|
||||||
|
self.add_palette_button = QtWidgets.QPushButton(Dialog)
|
||||||
|
self.add_palette_button.setObjectName("add_palette_button")
|
||||||
|
self.gridLayout.addWidget(self.add_palette_button, 1, 0, 1, 1)
|
||||||
|
self.new_name_edit = QtWidgets.QLineEdit(Dialog)
|
||||||
|
self.new_name_edit.setObjectName("new_name_edit")
|
||||||
|
self.gridLayout.addWidget(self.new_name_edit, 9, 2, 1, 1)
|
||||||
|
self.colorlist = QtWidgets.QListWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.colorlist.sizePolicy().hasHeightForWidth())
|
||||||
|
self.colorlist.setSizePolicy(sizePolicy)
|
||||||
|
self.colorlist.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
|
||||||
|
self.colorlist.setObjectName("colorlist")
|
||||||
|
self.gridLayout.addWidget(self.colorlist, 0, 1, 9, 2)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 10, 0, 1, 3)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Color Palette"))
|
||||||
|
self.append_palette_button.setText(_translate("Dialog", "Append"))
|
||||||
|
self.add_color_button.setText(_translate("Dialog", "Add color"))
|
||||||
|
self.save_button.setText(_translate("Dialog", "Save as new list"))
|
||||||
|
self.add_palette_button.setText(_translate("Dialog", "Load"))
|
||||||
|
from ..lib.delegates import ColorListEditor
|
57
nmreval/gui_qt/_py/coupling_calculator.py
Normal file
57
nmreval/gui_qt/_py/coupling_calculator.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/coupling_calculator.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_coupling_calc_dialog(object):
|
||||||
|
def setupUi(self, coupling_calc_dialog):
|
||||||
|
coupling_calc_dialog.setObjectName("coupling_calc_dialog")
|
||||||
|
coupling_calc_dialog.resize(400, 280)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(coupling_calc_dialog)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.comboBox = QtWidgets.QComboBox(coupling_calc_dialog)
|
||||||
|
self.comboBox.setObjectName("comboBox")
|
||||||
|
self.verticalLayout.addWidget(self.comboBox)
|
||||||
|
self.label_2 = QtWidgets.QLabel(coupling_calc_dialog)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.verticalLayout.addWidget(self.label_2)
|
||||||
|
self.verticalFrame = QtWidgets.QFrame(coupling_calc_dialog)
|
||||||
|
self.verticalFrame.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.verticalFrame.setObjectName("verticalFrame")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalFrame)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.verticalLayout.addWidget(self.verticalFrame)
|
||||||
|
self.label = QtWidgets.QLabel(coupling_calc_dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label.setSizePolicy(sizePolicy)
|
||||||
|
self.label.setStyleSheet("font-weight: bold")
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.verticalLayout.addWidget(self.label)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout.addItem(spacerItem)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(coupling_calc_dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
|
self.retranslateUi(coupling_calc_dialog)
|
||||||
|
self.buttonBox.accepted.connect(coupling_calc_dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(coupling_calc_dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(coupling_calc_dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, coupling_calc_dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
coupling_calc_dialog.setWindowTitle(_translate("coupling_calc_dialog", "Calculate BPP coupling constants"))
|
||||||
|
self.label_2.setText(_translate("coupling_calc_dialog", "TextLabel"))
|
||||||
|
self.label.setText(_translate("coupling_calc_dialog", "TextLabel"))
|
46
nmreval/gui_qt/_py/coupling_t1_from_tau.py
Normal file
46
nmreval/gui_qt/_py/coupling_t1_from_tau.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/coupling_t1_from_tau.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_couplingForm(object):
|
||||||
|
def setupUi(self, couplingForm):
|
||||||
|
couplingForm.setObjectName("couplingForm")
|
||||||
|
couplingForm.resize(400, 300)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(couplingForm)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.label = QtWidgets.QLabel(couplingForm)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout.addWidget(self.label)
|
||||||
|
self.lineEdit = LineEdit(couplingForm)
|
||||||
|
self.lineEdit.setObjectName("lineEdit")
|
||||||
|
self.horizontalLayout.addWidget(self.lineEdit)
|
||||||
|
self.radioButton_2 = QtWidgets.QRadioButton(couplingForm)
|
||||||
|
self.radioButton_2.setChecked(True)
|
||||||
|
self.radioButton_2.setObjectName("radioButton_2")
|
||||||
|
self.buttonGroup = QtWidgets.QButtonGroup(couplingForm)
|
||||||
|
self.buttonGroup.setObjectName("buttonGroup")
|
||||||
|
self.buttonGroup.addButton(self.radioButton_2)
|
||||||
|
self.horizontalLayout.addWidget(self.radioButton_2)
|
||||||
|
self.radioButton = QtWidgets.QRadioButton(couplingForm)
|
||||||
|
self.radioButton.setObjectName("radioButton")
|
||||||
|
self.buttonGroup.addButton(self.radioButton)
|
||||||
|
self.horizontalLayout.addWidget(self.radioButton)
|
||||||
|
|
||||||
|
self.retranslateUi(couplingForm)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(couplingForm)
|
||||||
|
|
||||||
|
def retranslateUi(self, couplingForm):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
couplingForm.setWindowTitle(_translate("couplingForm", "Form"))
|
||||||
|
self.label.setText(_translate("couplingForm", "parameter_name"))
|
||||||
|
self.radioButton_2.setText(_translate("couplingForm", "Value"))
|
||||||
|
self.radioButton.setText(_translate("couplingForm", "Index"))
|
||||||
|
from nmrevalgui.lib.forms import LineEdit
|
64
nmreval/gui_qt/_py/datawidget.py
Normal file
64
nmreval/gui_qt/_py/datawidget.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/datawidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_DataWidget(object):
|
||||||
|
def setupUi(self, DataWidget):
|
||||||
|
DataWidget.setObjectName("DataWidget")
|
||||||
|
DataWidget.resize(307, 847)
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(DataWidget)
|
||||||
|
self.verticalLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_2.setSpacing(3)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.verticalLayout_2.addLayout(self.verticalLayout)
|
||||||
|
self.propwidget = ExpandableWidget(DataWidget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.propwidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.propwidget.setSizePolicy(sizePolicy)
|
||||||
|
self.propwidget.setObjectName("propwidget")
|
||||||
|
self.verticalLayout_2.addWidget(self.propwidget)
|
||||||
|
self.frame = QtWidgets.QFrame(DataWidget)
|
||||||
|
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.frame.setObjectName("frame")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setSpacing(0)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.graph_toolButton = QtWidgets.QToolButton(self.frame)
|
||||||
|
self.graph_toolButton.setObjectName("graph_toolButton")
|
||||||
|
self.horizontalLayout.addWidget(self.graph_toolButton)
|
||||||
|
self.empty_toolButton = QtWidgets.QToolButton(self.frame)
|
||||||
|
self.empty_toolButton.setObjectName("empty_toolButton")
|
||||||
|
self.horizontalLayout.addWidget(self.empty_toolButton)
|
||||||
|
self.func_toolButton = QtWidgets.QToolButton(self.frame)
|
||||||
|
self.func_toolButton.setText("")
|
||||||
|
self.func_toolButton.setObjectName("func_toolButton")
|
||||||
|
self.horizontalLayout.addWidget(self.func_toolButton)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.verticalLayout_2.addWidget(self.frame)
|
||||||
|
|
||||||
|
self.retranslateUi(DataWidget)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(DataWidget)
|
||||||
|
|
||||||
|
def retranslateUi(self, DataWidget):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
DataWidget.setWindowTitle(_translate("DataWidget", "Data"))
|
||||||
|
self.graph_toolButton.setToolTip(_translate("DataWidget", "New graph"))
|
||||||
|
self.graph_toolButton.setText(_translate("DataWidget", "New graph"))
|
||||||
|
self.empty_toolButton.setToolTip(_translate("DataWidget", "New set"))
|
||||||
|
self.empty_toolButton.setText(_translate("DataWidget", "Empty set"))
|
||||||
|
from ..lib.expandablewidget import ExpandableWidget
|
213
nmreval/gui_qt/_py/dscfile_dialog.py
Normal file
213
nmreval/gui_qt/_py/dscfile_dialog.py
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/dscfile_dialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.9.2
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(962, 662)
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(Dialog)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Save)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout_2.addWidget(self.buttonBox, 1, 1, 1, 1)
|
||||||
|
self.gridLayout_4 = QtWidgets.QGridLayout()
|
||||||
|
self.gridLayout_4.setContentsMargins(-1, 0, 0, -1)
|
||||||
|
self.gridLayout_4.setSpacing(3)
|
||||||
|
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||||
|
self.cp_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.cp_checkBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.cp_checkBox.setSizePolicy(sizePolicy)
|
||||||
|
self.cp_checkBox.setChecked(True)
|
||||||
|
self.cp_checkBox.setObjectName("cp_checkBox")
|
||||||
|
self.gridLayout_4.addWidget(self.cp_checkBox, 11, 0, 1, 4)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setSpacing(3)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.loadempty_button = QtWidgets.QPushButton(Dialog)
|
||||||
|
self.loadempty_button.setObjectName("loadempty_button")
|
||||||
|
self.horizontalLayout_2.addWidget(self.loadempty_button)
|
||||||
|
self.delempty_button = QtWidgets.QPushButton(Dialog)
|
||||||
|
self.delempty_button.setObjectName("delempty_button")
|
||||||
|
self.horizontalLayout_2.addWidget(self.delempty_button)
|
||||||
|
self.gridLayout_4.addLayout(self.horizontalLayout_2, 5, 0, 1, 4)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.gridLayout_4.addItem(spacerItem, 12, 0, 1, 1)
|
||||||
|
self.isotherm_radioButton = QtWidgets.QRadioButton(Dialog)
|
||||||
|
self.isotherm_radioButton.setChecked(True)
|
||||||
|
self.isotherm_radioButton.setObjectName("isotherm_radioButton")
|
||||||
|
self.buttonGroup = QtWidgets.QButtonGroup(Dialog)
|
||||||
|
self.buttonGroup.setObjectName("buttonGroup")
|
||||||
|
self.buttonGroup.addButton(self.isotherm_radioButton)
|
||||||
|
self.gridLayout_4.addWidget(self.isotherm_radioButton, 6, 1, 1, 1)
|
||||||
|
self.label_4 = QtWidgets.QLabel(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_4.setSizePolicy(sizePolicy)
|
||||||
|
self.label_4.setStyleSheet("font-weight: bold")
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.gridLayout_4.addWidget(self.label_4, 0, 0, 1, 4)
|
||||||
|
self.reference_tableWidget = QtWidgets.QTableWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.reference_tableWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.reference_tableWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.reference_tableWidget.setMinimumSize(QtCore.QSize(0, 0))
|
||||||
|
self.reference_tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
|
self.reference_tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
|
self.reference_tableWidget.setColumnCount(2)
|
||||||
|
self.reference_tableWidget.setObjectName("reference_tableWidget")
|
||||||
|
self.reference_tableWidget.setRowCount(0)
|
||||||
|
self.reference_tableWidget.horizontalHeader().setVisible(False)
|
||||||
|
self.reference_tableWidget.horizontalHeader().setStretchLastSection(True)
|
||||||
|
self.reference_tableWidget.verticalHeader().setVisible(False)
|
||||||
|
self.gridLayout_4.addWidget(self.reference_tableWidget, 9, 0, 1, 4)
|
||||||
|
self.step_listWidget = QtWidgets.QListWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.step_listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.step_listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.step_listWidget.setMinimumSize(QtCore.QSize(0, 0))
|
||||||
|
self.step_listWidget.setObjectName("step_listWidget")
|
||||||
|
self.gridLayout_4.addWidget(self.step_listWidget, 1, 0, 1, 4)
|
||||||
|
self.label = QtWidgets.QLabel(Dialog)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout_4.addWidget(self.label, 6, 0, 1, 1)
|
||||||
|
self.slope_radioButton = QtWidgets.QRadioButton(Dialog)
|
||||||
|
self.slope_radioButton.setObjectName("slope_radioButton")
|
||||||
|
self.buttonGroup.addButton(self.slope_radioButton)
|
||||||
|
self.gridLayout_4.addWidget(self.slope_radioButton, 6, 2, 1, 1)
|
||||||
|
self.empty_label = QtWidgets.QLabel(Dialog)
|
||||||
|
self.empty_label.setObjectName("empty_label")
|
||||||
|
self.gridLayout_4.addWidget(self.empty_label, 4, 0, 1, 4)
|
||||||
|
self.label_3 = QtWidgets.QLabel(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_3.setSizePolicy(sizePolicy)
|
||||||
|
self.label_3.setStyleSheet("font-weight: bold")
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout_4.addWidget(self.label_3, 8, 0, 1, 4)
|
||||||
|
self.label_2 = QtWidgets.QLabel(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_2.setSizePolicy(sizePolicy)
|
||||||
|
self.label_2.setStyleSheet("font-weight: bold")
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout_4.addWidget(self.label_2, 3, 0, 1, 4)
|
||||||
|
self.line = QtWidgets.QFrame(Dialog)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.gridLayout_4.addWidget(self.line, 7, 0, 1, 4)
|
||||||
|
self.none_radioButton = QtWidgets.QRadioButton(Dialog)
|
||||||
|
self.none_radioButton.setObjectName("none_radioButton")
|
||||||
|
self.buttonGroup.addButton(self.none_radioButton)
|
||||||
|
self.gridLayout_4.addWidget(self.none_radioButton, 6, 3, 1, 1)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.ref_add_pushButton = QtWidgets.QPushButton(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.ref_add_pushButton.sizePolicy().hasHeightForWidth())
|
||||||
|
self.ref_add_pushButton.setSizePolicy(sizePolicy)
|
||||||
|
self.ref_add_pushButton.setObjectName("ref_add_pushButton")
|
||||||
|
self.horizontalLayout.addWidget(self.ref_add_pushButton)
|
||||||
|
self.ref_remove_pushButton = QtWidgets.QPushButton(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.ref_remove_pushButton.sizePolicy().hasHeightForWidth())
|
||||||
|
self.ref_remove_pushButton.setSizePolicy(sizePolicy)
|
||||||
|
self.ref_remove_pushButton.setObjectName("ref_remove_pushButton")
|
||||||
|
self.horizontalLayout.addWidget(self.ref_remove_pushButton)
|
||||||
|
self.gridLayout_4.addLayout(self.horizontalLayout, 10, 0, 1, 4)
|
||||||
|
self.line_2 = QtWidgets.QFrame(Dialog)
|
||||||
|
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.gridLayout_4.addWidget(self.line_2, 2, 0, 1, 4)
|
||||||
|
self.gridLayout_2.addLayout(self.gridLayout_4, 0, 0, 1, 1)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout()
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.raw_graph = PlotWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.raw_graph.sizePolicy().hasHeightForWidth())
|
||||||
|
self.raw_graph.setSizePolicy(sizePolicy)
|
||||||
|
self.raw_graph.setMinimumSize(QtCore.QSize(300, 200))
|
||||||
|
self.raw_graph.setObjectName("raw_graph")
|
||||||
|
self.gridLayout.addWidget(self.raw_graph, 0, 0, 1, 1)
|
||||||
|
self.calib_graph = PlotWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.calib_graph.sizePolicy().hasHeightForWidth())
|
||||||
|
self.calib_graph.setSizePolicy(sizePolicy)
|
||||||
|
self.calib_graph.setMinimumSize(QtCore.QSize(300, 200))
|
||||||
|
self.calib_graph.setObjectName("calib_graph")
|
||||||
|
self.gridLayout.addWidget(self.calib_graph, 1, 0, 1, 1)
|
||||||
|
self.baseline_graph = PlotWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.baseline_graph.sizePolicy().hasHeightForWidth())
|
||||||
|
self.baseline_graph.setSizePolicy(sizePolicy)
|
||||||
|
self.baseline_graph.setMinimumSize(QtCore.QSize(300, 200))
|
||||||
|
self.baseline_graph.setObjectName("baseline_graph")
|
||||||
|
self.gridLayout.addWidget(self.baseline_graph, 0, 1, 1, 1)
|
||||||
|
self.end_graph = PlotWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.end_graph.sizePolicy().hasHeightForWidth())
|
||||||
|
self.end_graph.setSizePolicy(sizePolicy)
|
||||||
|
self.end_graph.setMinimumSize(QtCore.QSize(0, 0))
|
||||||
|
self.end_graph.setObjectName("end_graph")
|
||||||
|
self.gridLayout.addWidget(self.end_graph, 1, 1, 1, 1)
|
||||||
|
self.gridLayout_2.addLayout(self.gridLayout, 0, 1, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Read DSC file"))
|
||||||
|
self.cp_checkBox.setText(_translate("Dialog", "Convert to heat capacity"))
|
||||||
|
self.loadempty_button.setText(_translate("Dialog", "Load empty"))
|
||||||
|
self.delempty_button.setText(_translate("Dialog", "Remove empty"))
|
||||||
|
self.isotherm_radioButton.setText(_translate("Dialog", "Isotherms"))
|
||||||
|
self.label_4.setText(_translate("Dialog", "Detected steps"))
|
||||||
|
self.label.setText(_translate("Dialog", "Slope"))
|
||||||
|
self.slope_radioButton.setText(_translate("Dialog", "Initial slope"))
|
||||||
|
self.empty_label.setText(_translate("Dialog", "Empty measurement"))
|
||||||
|
self.label_3.setText(_translate("Dialog", "Calibration"))
|
||||||
|
self.label_2.setText(_translate("Dialog", "Baseline"))
|
||||||
|
self.none_radioButton.setText(_translate("Dialog", "None"))
|
||||||
|
self.ref_add_pushButton.setText(_translate("Dialog", "Add reference"))
|
||||||
|
self.ref_remove_pushButton.setText(_translate("Dialog", "Remove reference"))
|
||||||
|
|
||||||
|
from pyqtgraph import PlotWidget
|
182
nmreval/gui_qt/_py/editsignalwidget.py
Normal file
182
nmreval/gui_qt/_py/editsignalwidget.py
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/editsignalwidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(328, 732)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.groupBox_4 = QtWidgets.QGroupBox(Form)
|
||||||
|
self.groupBox_4.setObjectName("groupBox_4")
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.groupBox_4)
|
||||||
|
self.horizontalLayout_3.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.baselinebutton = QtWidgets.QPushButton(self.groupBox_4)
|
||||||
|
self.baselinebutton.setObjectName("baselinebutton")
|
||||||
|
self.horizontalLayout_3.addWidget(self.baselinebutton)
|
||||||
|
self.verticalLayout.addWidget(self.groupBox_4)
|
||||||
|
self.groupBox = QtWidgets.QGroupBox(Form)
|
||||||
|
self.groupBox.setObjectName("groupBox")
|
||||||
|
self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox)
|
||||||
|
self.gridLayout_3.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
|
self.leftshiftbutton = QtWidgets.QPushButton(self.groupBox)
|
||||||
|
self.leftshiftbutton.setObjectName("leftshiftbutton")
|
||||||
|
self.gridLayout_3.addWidget(self.leftshiftbutton, 1, 0, 1, 2)
|
||||||
|
self.comboBox = QtWidgets.QComboBox(self.groupBox)
|
||||||
|
self.comboBox.setObjectName("comboBox")
|
||||||
|
self.comboBox.addItem("")
|
||||||
|
self.comboBox.addItem("")
|
||||||
|
self.gridLayout_3.addWidget(self.comboBox, 0, 0, 1, 1)
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_2.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.verticalLayout_2.setSpacing(0)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.lsspinBox = QtWidgets.QSpinBox(self.groupBox)
|
||||||
|
self.lsspinBox.setMaximum(9999)
|
||||||
|
self.lsspinBox.setObjectName("lsspinBox")
|
||||||
|
self.verticalLayout_2.addWidget(self.lsspinBox)
|
||||||
|
self.lineEdit = QtWidgets.QLineEdit(self.groupBox)
|
||||||
|
self.lineEdit.setObjectName("lineEdit")
|
||||||
|
self.verticalLayout_2.addWidget(self.lineEdit)
|
||||||
|
self.gridLayout_3.addLayout(self.verticalLayout_2, 0, 1, 1, 1)
|
||||||
|
self.verticalLayout.addWidget(self.groupBox)
|
||||||
|
self.groupBox_6 = QtWidgets.QGroupBox(Form)
|
||||||
|
self.groupBox_6.setFlat(False)
|
||||||
|
self.groupBox_6.setObjectName("groupBox_6")
|
||||||
|
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.groupBox_6)
|
||||||
|
self.horizontalLayout_4.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||||
|
self.zfbutton = QtWidgets.QPushButton(self.groupBox_6)
|
||||||
|
self.zfbutton.setObjectName("zfbutton")
|
||||||
|
self.horizontalLayout_4.addWidget(self.zfbutton)
|
||||||
|
self.verticalLayout.addWidget(self.groupBox_6)
|
||||||
|
self.groupBox_2 = QtWidgets.QGroupBox(Form)
|
||||||
|
self.groupBox_2.setFlat(False)
|
||||||
|
self.groupBox_2.setObjectName("groupBox_2")
|
||||||
|
self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_2)
|
||||||
|
self.gridLayout_4.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout_4.setVerticalSpacing(0)
|
||||||
|
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||||
|
self.ph1slider = QtWidgets.QDoubleSpinBox(self.groupBox_2)
|
||||||
|
self.ph1slider.setMinimum(-360.0)
|
||||||
|
self.ph1slider.setMaximum(360.0)
|
||||||
|
self.ph1slider.setObjectName("ph1slider")
|
||||||
|
self.gridLayout_4.addWidget(self.ph1slider, 5, 1, 1, 1)
|
||||||
|
self.label_6 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.gridLayout_4.addWidget(self.label_6, 4, 0, 3, 1)
|
||||||
|
self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_2)
|
||||||
|
self.pushButton_2.setObjectName("pushButton_2")
|
||||||
|
self.gridLayout_4.addWidget(self.pushButton_2, 8, 0, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.groupBox_2)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout_4.addWidget(self.label, 1, 0, 3, 1)
|
||||||
|
self.pivot_lineedit = QtWidgets.QLineEdit(self.groupBox_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.pivot_lineedit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.pivot_lineedit.setSizePolicy(sizePolicy)
|
||||||
|
self.pivot_lineedit.setInputMethodHints(QtCore.Qt.ImhDigitsOnly)
|
||||||
|
self.pivot_lineedit.setObjectName("pivot_lineedit")
|
||||||
|
self.gridLayout_4.addWidget(self.pivot_lineedit, 7, 1, 1, 1)
|
||||||
|
self.ph0slider = QtWidgets.QDoubleSpinBox(self.groupBox_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.ph0slider.sizePolicy().hasHeightForWidth())
|
||||||
|
self.ph0slider.setSizePolicy(sizePolicy)
|
||||||
|
self.ph0slider.setMinimum(-180.0)
|
||||||
|
self.ph0slider.setMaximum(180.0)
|
||||||
|
self.ph0slider.setObjectName("ph0slider")
|
||||||
|
self.gridLayout_4.addWidget(self.ph0slider, 2, 1, 1, 1)
|
||||||
|
self.label_8 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
|
self.label_8.setObjectName("label_8")
|
||||||
|
self.gridLayout_4.addWidget(self.label_8, 7, 0, 1, 1)
|
||||||
|
self.phasebutton = QtWidgets.QPushButton(self.groupBox_2)
|
||||||
|
self.phasebutton.setObjectName("phasebutton")
|
||||||
|
self.gridLayout_4.addWidget(self.phasebutton, 8, 1, 1, 1)
|
||||||
|
self.verticalLayout.addWidget(self.groupBox_2)
|
||||||
|
self.groupBox_3 = QtWidgets.QGroupBox(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.groupBox_3.sizePolicy().hasHeightForWidth())
|
||||||
|
self.groupBox_3.setSizePolicy(sizePolicy)
|
||||||
|
self.groupBox_3.setObjectName("groupBox_3")
|
||||||
|
self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.groupBox_3)
|
||||||
|
self.verticalLayout_7.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_7.setObjectName("verticalLayout_7")
|
||||||
|
self.apodcombobox = QtWidgets.QComboBox(self.groupBox_3)
|
||||||
|
self.apodcombobox.setObjectName("apodcombobox")
|
||||||
|
self.verticalLayout_7.addWidget(self.apodcombobox)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
|
self.label_2.setIndent(3)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.verticalLayout_7.addWidget(self.label_2)
|
||||||
|
self.verticalLayout_8 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_8.setSpacing(0)
|
||||||
|
self.verticalLayout_8.setObjectName("verticalLayout_8")
|
||||||
|
self.verticalLayout_7.addLayout(self.verticalLayout_8)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.pushButton = QtWidgets.QPushButton(self.groupBox_3)
|
||||||
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.horizontalLayout.addWidget(self.pushButton)
|
||||||
|
self.apodbutton = QtWidgets.QPushButton(self.groupBox_3)
|
||||||
|
self.apodbutton.setObjectName("apodbutton")
|
||||||
|
self.horizontalLayout.addWidget(self.apodbutton)
|
||||||
|
self.verticalLayout_7.addLayout(self.horizontalLayout)
|
||||||
|
self.verticalLayout.addWidget(self.groupBox_3)
|
||||||
|
self.groupBox_5 = QtWidgets.QGroupBox(Form)
|
||||||
|
self.groupBox_5.setObjectName("groupBox_5")
|
||||||
|
self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.groupBox_5)
|
||||||
|
self.horizontalLayout_5.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||||
|
self.fourierutton = QtWidgets.QPushButton(self.groupBox_5)
|
||||||
|
self.fourierutton.setObjectName("fourierutton")
|
||||||
|
self.horizontalLayout_5.addWidget(self.fourierutton)
|
||||||
|
self.verticalLayout.addWidget(self.groupBox_5)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout.addItem(spacerItem)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.groupBox_4.setTitle(_translate("Form", "Baseline correction"))
|
||||||
|
self.baselinebutton.setText(_translate("Form", "Apply"))
|
||||||
|
self.groupBox.setTitle(_translate("Form", "Left shift"))
|
||||||
|
self.leftshiftbutton.setText(_translate("Form", "Apply"))
|
||||||
|
self.comboBox.setItemText(0, _translate("Form", "Points"))
|
||||||
|
self.comboBox.setItemText(1, _translate("Form", "Seconds"))
|
||||||
|
self.groupBox_6.setTitle(_translate("Form", "Zerofilling"))
|
||||||
|
self.zfbutton.setText(_translate("Form", "Apply"))
|
||||||
|
self.groupBox_2.setTitle(_translate("Form", "Phase correction"))
|
||||||
|
self.label_6.setText(_translate("Form", "Phase 1"))
|
||||||
|
self.pushButton_2.setText(_translate("Form", "Preview"))
|
||||||
|
self.label.setText(_translate("Form", "Phase 0"))
|
||||||
|
self.pivot_lineedit.setText(_translate("Form", "0"))
|
||||||
|
self.label_8.setText(_translate("Form", "Pivot"))
|
||||||
|
self.phasebutton.setText(_translate("Form", "Apply"))
|
||||||
|
self.groupBox_3.setTitle(_translate("Form", "Apodization"))
|
||||||
|
self.label_2.setText(_translate("Form", "TextLabel"))
|
||||||
|
self.pushButton.setText(_translate("Form", "Preview"))
|
||||||
|
self.apodbutton.setText(_translate("Form", "Apply"))
|
||||||
|
self.groupBox_5.setTitle(_translate("Form", "FFT"))
|
||||||
|
self.fourierutton.setText(_translate("Form", "Apply"))
|
240
nmreval/gui_qt/_py/eval_expr_dialog.py
Normal file
240
nmreval/gui_qt/_py/eval_expr_dialog.py
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/eval_expr_dialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_CalcDialog(object):
|
||||||
|
def setupUi(self, CalcDialog):
|
||||||
|
CalcDialog.setObjectName("CalcDialog")
|
||||||
|
CalcDialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||||
|
CalcDialog.resize(804, 627)
|
||||||
|
self.verticalLayout_5 = QtWidgets.QVBoxLayout(CalcDialog)
|
||||||
|
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||||
|
self.splitter_2 = QtWidgets.QSplitter(CalcDialog)
|
||||||
|
self.splitter_2.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.splitter_2.setObjectName("splitter_2")
|
||||||
|
self.verticalLayoutWidget = QtWidgets.QWidget(self.splitter_2)
|
||||||
|
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.stackedWidget = QtWidgets.QStackedWidget(self.verticalLayoutWidget)
|
||||||
|
self.stackedWidget.setObjectName("stackedWidget")
|
||||||
|
self.page = QtWidgets.QWidget()
|
||||||
|
self.page.setObjectName("page")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.page)
|
||||||
|
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_2.setSpacing(0)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.page)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.verticalLayout_2.addWidget(self.label_2)
|
||||||
|
self.listWidget = QtWidgets.QListWidget(self.page)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.listWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.verticalLayout_2.addWidget(self.listWidget)
|
||||||
|
self.overwrite_checkbox = QtWidgets.QCheckBox(self.page)
|
||||||
|
self.overwrite_checkbox.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||||
|
self.overwrite_checkbox.setObjectName("overwrite_checkbox")
|
||||||
|
self.verticalLayout_2.addWidget(self.overwrite_checkbox)
|
||||||
|
self.stackedWidget.addWidget(self.page)
|
||||||
|
self.page_2 = QtWidgets.QWidget()
|
||||||
|
self.page_2.setObjectName("page_2")
|
||||||
|
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.page_2)
|
||||||
|
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||||
|
self.groupBox_2 = QtWidgets.QGroupBox(self.page_2)
|
||||||
|
self.groupBox_2.setObjectName("groupBox_2")
|
||||||
|
self.formLayout_3 = QtWidgets.QFormLayout(self.groupBox_2)
|
||||||
|
self.formLayout_3.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.formLayout_3.setHorizontalSpacing(3)
|
||||||
|
self.formLayout_3.setObjectName("formLayout_3")
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_3)
|
||||||
|
self.label_lineEdit = QtWidgets.QLineEdit(self.groupBox_2)
|
||||||
|
self.label_lineEdit.setObjectName("label_lineEdit")
|
||||||
|
self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.label_lineEdit)
|
||||||
|
self.label_9 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
|
self.label_9.setObjectName("label_9")
|
||||||
|
self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_9)
|
||||||
|
self.value_lineEdit = QtWidgets.QLineEdit(self.groupBox_2)
|
||||||
|
self.value_lineEdit.setObjectName("value_lineEdit")
|
||||||
|
self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.value_lineEdit)
|
||||||
|
self.label_6 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_6)
|
||||||
|
self.dtype_comboBox = QtWidgets.QComboBox(self.groupBox_2)
|
||||||
|
self.dtype_comboBox.setObjectName("dtype_comboBox")
|
||||||
|
self.dtype_comboBox.addItem("")
|
||||||
|
self.dtype_comboBox.addItem("")
|
||||||
|
self.dtype_comboBox.addItem("")
|
||||||
|
self.dtype_comboBox.addItem("")
|
||||||
|
self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.dtype_comboBox)
|
||||||
|
self.verticalLayout_4.addWidget(self.groupBox_2)
|
||||||
|
self.groupBox = QtWidgets.QGroupBox(self.page_2)
|
||||||
|
self.groupBox.setObjectName("groupBox")
|
||||||
|
self.formLayout_2 = QtWidgets.QFormLayout(self.groupBox)
|
||||||
|
self.formLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.formLayout_2.setSpacing(3)
|
||||||
|
self.formLayout_2.setObjectName("formLayout_2")
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.groupBox)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_4)
|
||||||
|
self.symcolor_comboBox = ColorListEditor(self.groupBox)
|
||||||
|
self.symcolor_comboBox.setObjectName("symcolor_comboBox")
|
||||||
|
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.symcolor_comboBox)
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.groupBox)
|
||||||
|
self.label_5.setObjectName("label_5")
|
||||||
|
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_5)
|
||||||
|
self.symbol_spinBox = QtWidgets.QSpinBox(self.groupBox)
|
||||||
|
self.symbol_spinBox.setProperty("value", 10)
|
||||||
|
self.symbol_spinBox.setObjectName("symbol_spinBox")
|
||||||
|
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.symbol_spinBox)
|
||||||
|
self.symbol_comboBox = SymbolStyleEditor(self.groupBox)
|
||||||
|
self.symbol_comboBox.setObjectName("symbol_comboBox")
|
||||||
|
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.symbol_comboBox)
|
||||||
|
self.label_10 = QtWidgets.QLabel(self.groupBox)
|
||||||
|
self.label_10.setObjectName("label_10")
|
||||||
|
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_10)
|
||||||
|
self.verticalLayout_4.addWidget(self.groupBox)
|
||||||
|
self.groupBox_3 = QtWidgets.QGroupBox(self.page_2)
|
||||||
|
self.groupBox_3.setObjectName("groupBox_3")
|
||||||
|
self.formLayout = QtWidgets.QFormLayout(self.groupBox_3)
|
||||||
|
self.formLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.formLayout.setSpacing(3)
|
||||||
|
self.formLayout.setObjectName("formLayout")
|
||||||
|
self.label_7 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
|
self.label_7.setObjectName("label_7")
|
||||||
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_7)
|
||||||
|
self.linecolor_comboBox = ColorListEditor(self.groupBox_3)
|
||||||
|
self.linecolor_comboBox.setObjectName("linecolor_comboBox")
|
||||||
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.linecolor_comboBox)
|
||||||
|
self.label_8 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
|
self.label_8.setObjectName("label_8")
|
||||||
|
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_8)
|
||||||
|
self.line_doubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupBox_3)
|
||||||
|
self.line_doubleSpinBox.setProperty("value", 1.0)
|
||||||
|
self.line_doubleSpinBox.setObjectName("line_doubleSpinBox")
|
||||||
|
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.line_doubleSpinBox)
|
||||||
|
self.linestyle_comboBox = LineStyleEditor(self.groupBox_3)
|
||||||
|
self.linestyle_comboBox.setObjectName("linestyle_comboBox")
|
||||||
|
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.linestyle_comboBox)
|
||||||
|
self.label_11 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
|
self.label_11.setObjectName("label_11")
|
||||||
|
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_11)
|
||||||
|
self.verticalLayout_4.addWidget(self.groupBox_3)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout_4.addItem(spacerItem)
|
||||||
|
self.graph_comboBox = QtWidgets.QComboBox(self.page_2)
|
||||||
|
self.graph_comboBox.setObjectName("graph_comboBox")
|
||||||
|
self.verticalLayout_4.addWidget(self.graph_comboBox)
|
||||||
|
self.groupBox.raise_()
|
||||||
|
self.groupBox_2.raise_()
|
||||||
|
self.groupBox_3.raise_()
|
||||||
|
self.graph_comboBox.raise_()
|
||||||
|
self.stackedWidget.addWidget(self.page_2)
|
||||||
|
self.page_3 = QtWidgets.QWidget()
|
||||||
|
self.page_3.setObjectName("page_3")
|
||||||
|
self.stackedWidget.addWidget(self.page_3)
|
||||||
|
self.verticalLayout.addWidget(self.stackedWidget)
|
||||||
|
self.splitter = QtWidgets.QSplitter(self.splitter_2)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Vertical)
|
||||||
|
self.splitter.setChildrenCollapsible(False)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.verticalLayoutWidget_2 = QtWidgets.QWidget(self.splitter)
|
||||||
|
self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2")
|
||||||
|
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2)
|
||||||
|
self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_6.setObjectName("verticalLayout_6")
|
||||||
|
self.namespace_widget = QNamespaceWidget(self.verticalLayoutWidget_2)
|
||||||
|
self.namespace_widget.setObjectName("namespace_widget")
|
||||||
|
self.verticalLayout_6.addWidget(self.namespace_widget)
|
||||||
|
self.verticalLayoutWidget_3 = QtWidgets.QWidget(self.splitter)
|
||||||
|
self.verticalLayoutWidget_3.setObjectName("verticalLayoutWidget_3")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_3)
|
||||||
|
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.line_2 = QtWidgets.QFrame(self.verticalLayoutWidget_3)
|
||||||
|
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.verticalLayout_3.addWidget(self.line_2)
|
||||||
|
self.label = QtWidgets.QLabel(self.verticalLayoutWidget_3)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
self.label.setFont(font)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.verticalLayout_3.addWidget(self.label)
|
||||||
|
self.calc_edit = QtWidgets.QPlainTextEdit(self.verticalLayoutWidget_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.calc_edit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.calc_edit.setSizePolicy(sizePolicy)
|
||||||
|
self.calc_edit.setObjectName("calc_edit")
|
||||||
|
self.verticalLayout_3.addWidget(self.calc_edit)
|
||||||
|
self.verticalLayout_5.addWidget(self.splitter_2)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(CalcDialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout_5.addWidget(self.buttonBox)
|
||||||
|
self.label_3.setBuddy(self.label_lineEdit)
|
||||||
|
self.label_9.setBuddy(self.value_lineEdit)
|
||||||
|
self.label_6.setBuddy(self.dtype_comboBox)
|
||||||
|
self.label_4.setBuddy(self.symcolor_comboBox)
|
||||||
|
self.label_5.setBuddy(self.symbol_spinBox)
|
||||||
|
self.label_7.setBuddy(self.linecolor_comboBox)
|
||||||
|
self.label_8.setBuddy(self.line_doubleSpinBox)
|
||||||
|
|
||||||
|
self.retranslateUi(CalcDialog)
|
||||||
|
self.stackedWidget.setCurrentIndex(2)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(CalcDialog)
|
||||||
|
CalcDialog.setTabOrder(self.calc_edit, self.listWidget)
|
||||||
|
CalcDialog.setTabOrder(self.listWidget, self.overwrite_checkbox)
|
||||||
|
CalcDialog.setTabOrder(self.overwrite_checkbox, self.label_lineEdit)
|
||||||
|
CalcDialog.setTabOrder(self.label_lineEdit, self.value_lineEdit)
|
||||||
|
CalcDialog.setTabOrder(self.value_lineEdit, self.dtype_comboBox)
|
||||||
|
CalcDialog.setTabOrder(self.dtype_comboBox, self.symcolor_comboBox)
|
||||||
|
CalcDialog.setTabOrder(self.symcolor_comboBox, self.symbol_spinBox)
|
||||||
|
CalcDialog.setTabOrder(self.symbol_spinBox, self.linecolor_comboBox)
|
||||||
|
CalcDialog.setTabOrder(self.linecolor_comboBox, self.line_doubleSpinBox)
|
||||||
|
|
||||||
|
def retranslateUi(self, CalcDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
CalcDialog.setWindowTitle(_translate("CalcDialog", "Evaluate stuff"))
|
||||||
|
self.label_2.setText(_translate("CalcDialog", "Select sets for evaluation"))
|
||||||
|
self.overwrite_checkbox.setText(_translate("CalcDialog", "Overwrite values"))
|
||||||
|
self.groupBox_2.setTitle(_translate("CalcDialog", "GroupBox"))
|
||||||
|
self.label_3.setText(_translate("CalcDialog", "Label"))
|
||||||
|
self.label_9.setText(_translate("CalcDialog", "Value"))
|
||||||
|
self.label_6.setText(_translate("CalcDialog", "Datatype"))
|
||||||
|
self.dtype_comboBox.setItemText(0, _translate("CalcDialog", "Points"))
|
||||||
|
self.dtype_comboBox.setItemText(1, _translate("CalcDialog", "Timesignal"))
|
||||||
|
self.dtype_comboBox.setItemText(2, _translate("CalcDialog", "Spectrum"))
|
||||||
|
self.dtype_comboBox.setItemText(3, _translate("CalcDialog", "BDS"))
|
||||||
|
self.groupBox.setTitle(_translate("CalcDialog", "Symbol"))
|
||||||
|
self.label_4.setText(_translate("CalcDialog", "Color"))
|
||||||
|
self.label_5.setText(_translate("CalcDialog", "Size"))
|
||||||
|
self.label_10.setText(_translate("CalcDialog", "Style"))
|
||||||
|
self.groupBox_3.setTitle(_translate("CalcDialog", "Line"))
|
||||||
|
self.label_7.setText(_translate("CalcDialog", "Color"))
|
||||||
|
self.label_8.setText(_translate("CalcDialog", "Width"))
|
||||||
|
self.label_11.setText(_translate("CalcDialog", "Style"))
|
||||||
|
self.label.setText(_translate("CalcDialog", "Expressions are evaluated line by line and change previous values"))
|
||||||
|
from ..lib.delegates import ColorListEditor, LineStyleEditor, SymbolStyleEditor
|
||||||
|
from ..lib.namespace import QNamespaceWidget
|
217
nmreval/gui_qt/_py/evalexpression.py
Normal file
217
nmreval/gui_qt/_py/evalexpression.py
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/evalexpression.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_CalcDialog(object):
|
||||||
|
def setupUi(self, CalcDialog):
|
||||||
|
CalcDialog.setObjectName("CalcDialog")
|
||||||
|
CalcDialog.resize(895, 547)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(CalcDialog)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_2.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(CalcDialog)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.tab = QtWidgets.QWidget()
|
||||||
|
self.tab.setObjectName("tab")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.tab)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setSpacing(0)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.horizontalLayout_2.setSpacing(0)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.textEdit = QtWidgets.QTextEdit(self.tab)
|
||||||
|
self.textEdit.setEnabled(True)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.textEdit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.textEdit.setSizePolicy(sizePolicy)
|
||||||
|
self.textEdit.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.textEdit.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.textEdit.setAutoFormatting(QtWidgets.QTextEdit.AutoNone)
|
||||||
|
self.textEdit.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
|
||||||
|
self.textEdit.setObjectName("textEdit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.textEdit)
|
||||||
|
self.textEdit_3 = QtWidgets.QTextEdit(self.tab)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.textEdit_3.sizePolicy().hasHeightForWidth())
|
||||||
|
self.textEdit_3.setSizePolicy(sizePolicy)
|
||||||
|
self.textEdit_3.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.textEdit_3.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.textEdit_3.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
|
||||||
|
self.textEdit_3.setObjectName("textEdit_3")
|
||||||
|
self.horizontalLayout_2.addWidget(self.textEdit_3)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
|
self.tabWidget.addTab(self.tab, "")
|
||||||
|
self.tab_2 = QtWidgets.QWidget()
|
||||||
|
self.tab_2.setObjectName("tab_2")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.tab_2)
|
||||||
|
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_3.setSpacing(0)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_3.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.horizontalLayout_3.setSpacing(0)
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.textEdit_2 = QtWidgets.QTextEdit(self.tab_2)
|
||||||
|
self.textEdit_2.setEnabled(True)
|
||||||
|
self.textEdit_2.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.textEdit_2.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.textEdit_2.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
|
||||||
|
self.textEdit_2.setObjectName("textEdit_2")
|
||||||
|
self.horizontalLayout_3.addWidget(self.textEdit_2)
|
||||||
|
self.textEdit_4 = QtWidgets.QTextEdit(self.tab_2)
|
||||||
|
self.textEdit_4.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.textEdit_4.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.textEdit_4.setReadOnly(True)
|
||||||
|
self.textEdit_4.setObjectName("textEdit_4")
|
||||||
|
self.horizontalLayout_3.addWidget(self.textEdit_4)
|
||||||
|
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
|
||||||
|
self.tabWidget.addTab(self.tab_2, "")
|
||||||
|
self.tab_3 = QtWidgets.QWidget()
|
||||||
|
self.tab_3.setObjectName("tab_3")
|
||||||
|
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.tab_3)
|
||||||
|
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_4.setSpacing(0)
|
||||||
|
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||||
|
self.treeWidget = QtWidgets.QTreeWidget(self.tab_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.treeWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.treeWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.treeWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.treeWidget.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.treeWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.treeWidget.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
|
||||||
|
self.treeWidget.setObjectName("treeWidget")
|
||||||
|
self.treeWidget.header().setVisible(False)
|
||||||
|
self.verticalLayout_4.addWidget(self.treeWidget)
|
||||||
|
self.tabWidget.addTab(self.tab_3, "")
|
||||||
|
self.verticalLayout_2.addWidget(self.tabWidget)
|
||||||
|
self.label = QtWidgets.QLabel(CalcDialog)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
self.label.setFont(font)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.verticalLayout_2.addWidget(self.label)
|
||||||
|
self.calc_edit = QtWidgets.QPlainTextEdit(CalcDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.calc_edit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.calc_edit.setSizePolicy(sizePolicy)
|
||||||
|
self.calc_edit.setObjectName("calc_edit")
|
||||||
|
self.verticalLayout_2.addWidget(self.calc_edit)
|
||||||
|
self.gridLayout.addLayout(self.verticalLayout_2, 0, 3, 1, 1)
|
||||||
|
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_5.setSpacing(0)
|
||||||
|
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||||
|
self.label_2 = QtWidgets.QLabel(CalcDialog)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.verticalLayout_5.addWidget(self.label_2)
|
||||||
|
self.listWidget = QtWidgets.QListWidget(CalcDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.listWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.verticalLayout_5.addWidget(self.listWidget)
|
||||||
|
self.overwrite_checkbox = QtWidgets.QCheckBox(CalcDialog)
|
||||||
|
self.overwrite_checkbox.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||||
|
self.overwrite_checkbox.setObjectName("overwrite_checkbox")
|
||||||
|
self.verticalLayout_5.addWidget(self.overwrite_checkbox)
|
||||||
|
self.gridLayout.addLayout(self.verticalLayout_5, 0, 1, 1, 1)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(CalcDialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 1, 3, 1, 1)
|
||||||
|
self.line = QtWidgets.QFrame(CalcDialog)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.VLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.gridLayout.addWidget(self.line, 0, 2, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(CalcDialog)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
self.buttonBox.accepted.connect(CalcDialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(CalcDialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(CalcDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, CalcDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
CalcDialog.setWindowTitle(_translate("CalcDialog", "Evaluate stuff"))
|
||||||
|
self.textEdit.setHtml(_translate("CalcDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
|
"</style></head><body style=\" font-family:\'Noto Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">- X, y, and Δy values </p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">- Values of dataset on position <span style=\" font-style:italic;\">i</span> in list</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> (<span style=\" font-style:italic;\">s[i].x</span> and <span style=\" font-style:italic;\">x</span> return the same values)</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">- Numpy functions</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">- If available, fit parameters</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> (see namespace for available parameters)</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">- Fit functions:</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> (meaning of p and extra arguments </p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> depend on function)</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">- Constants:</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> (nuclei are accessed by <span style=\" font-style:italic;\">const[\'gamma\'][\'1H\']</span>)</p></body></html>"))
|
||||||
|
self.textEdit_3.setHtml(_translate("CalcDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
|
"</style></head><body style=\" font-family:\'Noto Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">x y y_err</span></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">s[i].x s[i+2].y</span> <span style=\" font-style:italic;\">s[i-1].y_err</span></p>\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-style:italic;\"><br /></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">np.function</span></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">fit[\'NAME\']</span></p>\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-style:italic;\"><br /></p>\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">Name.func(p, x, *args) </span></p>\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-style:italic;\"><br /></p>\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">const[\'NAME\']</span></p></body></html>"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("CalcDialog", "Parameter"))
|
||||||
|
self.textEdit_2.setHtml(_translate("CalcDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
|
"</style></head><body style=\" font-family:\'Noto Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Substract neighbouring datasets: </p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Normalize on fit value M<span style=\" vertical-align:sub;\">∞</span>:</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Logscale x:</p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Division by exponential decay:</p>\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||||
|
self.textEdit_4.setHtml(_translate("CalcDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
|
"</style></head><body style=\" font-family:\'Noto Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">y = y-s[i+1].y</span></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">y = y/fit[\'M_infty\']</span></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">x = np.log10(x)</span></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">y = y/np.exp(-x/10)</span></p>\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">y = y/Exponential_Decay.func([0, 1, 10, 1], x)</span></p></body></html>"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("CalcDialog", "Example"))
|
||||||
|
self.treeWidget.headerItem().setText(0, _translate("CalcDialog", "Namespace"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("CalcDialog", "Namespace"))
|
||||||
|
self.label.setText(_translate("CalcDialog", "Expressions are evaluated line by line and change previous values"))
|
||||||
|
self.label_2.setText(_translate("CalcDialog", "<html><head/><body><p>Select sets for evaluation<br>(no selection = all visible):</p></body></html>"))
|
||||||
|
self.overwrite_checkbox.setText(_translate("CalcDialog", "Overwrite values?"))
|
52
nmreval/gui_qt/_py/expandablewidget.py
Normal file
52
nmreval/gui_qt/_py/expandablewidget.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/expandablewidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_ExpandableForm(object):
|
||||||
|
def setupUi(self, ExpandableForm):
|
||||||
|
ExpandableForm.setObjectName("ExpandableForm")
|
||||||
|
ExpandableForm.resize(400, 300)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(ExpandableForm)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setSpacing(0)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setSpacing(0)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.toolButton = QtWidgets.QToolButton(ExpandableForm)
|
||||||
|
self.toolButton.setStyleSheet("border: 0")
|
||||||
|
self.toolButton.setText("")
|
||||||
|
self.toolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.toolButton.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.toolButton.setObjectName("toolButton")
|
||||||
|
self.horizontalLayout.addWidget(self.toolButton)
|
||||||
|
self.label = QtWidgets.QLabel(ExpandableForm)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label.setSizePolicy(sizePolicy)
|
||||||
|
self.label.setText("")
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout.addWidget(self.label)
|
||||||
|
self.line = QtWidgets.QFrame(ExpandableForm)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.horizontalLayout.addWidget(self.line)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
|
||||||
|
self.retranslateUi(ExpandableForm)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(ExpandableForm)
|
||||||
|
|
||||||
|
def retranslateUi(self, ExpandableForm):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
ExpandableForm.setWindowTitle(_translate("ExpandableForm", "Form"))
|
65
nmreval/gui_qt/_py/exportConfigTemplate.py
Normal file
65
nmreval/gui_qt/_py/exportConfigTemplate.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/exportConfigTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(241, 367)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.label = QtWidgets.QLabel(Form)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
|
||||||
|
self.itemTree = QtWidgets.QTreeWidget(Form)
|
||||||
|
self.itemTree.setObjectName("itemTree")
|
||||||
|
self.itemTree.headerItem().setText(0, "1")
|
||||||
|
self.itemTree.header().setVisible(False)
|
||||||
|
self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
|
||||||
|
self.label_2 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
|
||||||
|
self.formatList = QtWidgets.QListWidget(Form)
|
||||||
|
self.formatList.setObjectName("formatList")
|
||||||
|
self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
|
||||||
|
self.exportBtn = QtWidgets.QPushButton(Form)
|
||||||
|
self.exportBtn.setObjectName("exportBtn")
|
||||||
|
self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
|
||||||
|
self.closeBtn = QtWidgets.QPushButton(Form)
|
||||||
|
self.closeBtn.setObjectName("closeBtn")
|
||||||
|
self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
|
||||||
|
self.paramTree = ParameterTree(Form)
|
||||||
|
self.paramTree.setColumnCount(2)
|
||||||
|
self.paramTree.setObjectName("paramTree")
|
||||||
|
self.paramTree.headerItem().setText(0, "1")
|
||||||
|
self.paramTree.header().setVisible(False)
|
||||||
|
self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
|
||||||
|
self.label_3 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
|
||||||
|
self.copyBtn = QtWidgets.QPushButton(Form)
|
||||||
|
self.copyBtn.setObjectName("copyBtn")
|
||||||
|
self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Export"))
|
||||||
|
self.label.setText(_translate("Form", "Item to export:"))
|
||||||
|
self.label_2.setText(_translate("Form", "Export format"))
|
||||||
|
self.exportBtn.setText(_translate("Form", "Export"))
|
||||||
|
self.closeBtn.setText(_translate("Form", "Close"))
|
||||||
|
self.label_3.setText(_translate("Form", "Export options"))
|
||||||
|
self.copyBtn.setText(_translate("Form", "Copy"))
|
||||||
|
from ..parametertree import ParameterTree
|
196
nmreval/gui_qt/_py/fcreader.py
Normal file
196
nmreval/gui_qt/_py/fcreader.py
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fcreader.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FCEval_dialog(object):
|
||||||
|
def setupUi(self, FCEval_dialog):
|
||||||
|
FCEval_dialog.setObjectName("FCEval_dialog")
|
||||||
|
FCEval_dialog.resize(457, 697)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(FCEval_dialog)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.input_box = QtWidgets.QGroupBox(FCEval_dialog)
|
||||||
|
self.input_box.setObjectName("input_box")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.input_box)
|
||||||
|
self.gridLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout_2.setSpacing(3)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.file_pushbutton = QtWidgets.QPushButton(self.input_box)
|
||||||
|
self.file_pushbutton.setChecked(False)
|
||||||
|
self.file_pushbutton.setObjectName("file_pushbutton")
|
||||||
|
self.gridLayout_2.addWidget(self.file_pushbutton, 0, 0, 1, 1)
|
||||||
|
self.dir_pushbutton = QtWidgets.QPushButton(self.input_box)
|
||||||
|
self.dir_pushbutton.setObjectName("dir_pushbutton")
|
||||||
|
self.gridLayout_2.addWidget(self.dir_pushbutton, 0, 1, 1, 1)
|
||||||
|
self.listWidget = QtWidgets.QListWidget(self.input_box)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.listWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
self.listWidget.setTextElideMode(QtCore.Qt.ElideLeft)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.gridLayout_2.addWidget(self.listWidget, 1, 0, 1, 3)
|
||||||
|
self.overwrite_cb = QtWidgets.QCheckBox(self.input_box)
|
||||||
|
self.overwrite_cb.setObjectName("overwrite_cb")
|
||||||
|
self.gridLayout_2.addWidget(self.overwrite_cb, 0, 2, 1, 1)
|
||||||
|
self.verticalLayout.addWidget(self.input_box)
|
||||||
|
self.region_box = QtWidgets.QGroupBox(FCEval_dialog)
|
||||||
|
self.region_box.setCheckable(True)
|
||||||
|
self.region_box.setObjectName("region_box")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.region_box)
|
||||||
|
self.horizontalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.start_lineedit = QtWidgets.QLineEdit(self.region_box)
|
||||||
|
self.start_lineedit.setObjectName("start_lineedit")
|
||||||
|
self.horizontalLayout.addWidget(self.start_lineedit)
|
||||||
|
self.stop_lineedit = QtWidgets.QLineEdit(self.region_box)
|
||||||
|
self.stop_lineedit.setObjectName("stop_lineedit")
|
||||||
|
self.horizontalLayout.addWidget(self.stop_lineedit)
|
||||||
|
self.verticalLayout.addWidget(self.region_box)
|
||||||
|
self.fit_box = QtWidgets.QGroupBox(FCEval_dialog)
|
||||||
|
self.fit_box.setObjectName("fit_box")
|
||||||
|
self.gridLayout_3 = QtWidgets.QGridLayout(self.fit_box)
|
||||||
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
|
self.label_12 = QtWidgets.QLabel(self.fit_box)
|
||||||
|
self.label_12.setObjectName("label_12")
|
||||||
|
self.gridLayout_3.addWidget(self.label_12, 0, 0, 1, 1)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.gridLayout_3.addItem(spacerItem, 0, 1, 1, 1)
|
||||||
|
self.kww_checkbox = QtWidgets.QCheckBox(self.fit_box)
|
||||||
|
self.kww_checkbox.setChecked(True)
|
||||||
|
self.kww_checkbox.setObjectName("kww_checkbox")
|
||||||
|
self.gridLayout_3.addWidget(self.kww_checkbox, 0, 2, 1, 1)
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_3.setSpacing(2)
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.fit_box)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_3)
|
||||||
|
self.t1_cb = QtWidgets.QCheckBox(self.fit_box)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.t1_cb.sizePolicy().hasHeightForWidth())
|
||||||
|
self.t1_cb.setSizePolicy(sizePolicy)
|
||||||
|
self.t1_cb.setText("")
|
||||||
|
self.t1_cb.setChecked(True)
|
||||||
|
self.t1_cb.setObjectName("t1_cb")
|
||||||
|
self.horizontalLayout_3.addWidget(self.t1_cb)
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.fit_box)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_4)
|
||||||
|
self.beta_cb = QtWidgets.QCheckBox(self.fit_box)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.beta_cb.sizePolicy().hasHeightForWidth())
|
||||||
|
self.beta_cb.setSizePolicy(sizePolicy)
|
||||||
|
self.beta_cb.setChecked(True)
|
||||||
|
self.beta_cb.setObjectName("beta_cb")
|
||||||
|
self.horizontalLayout_3.addWidget(self.beta_cb)
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.fit_box)
|
||||||
|
self.label_5.setObjectName("label_5")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_5)
|
||||||
|
self.m0_cb = QtWidgets.QCheckBox(self.fit_box)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.m0_cb.sizePolicy().hasHeightForWidth())
|
||||||
|
self.m0_cb.setSizePolicy(sizePolicy)
|
||||||
|
self.m0_cb.setText("")
|
||||||
|
self.m0_cb.setObjectName("m0_cb")
|
||||||
|
self.horizontalLayout_3.addWidget(self.m0_cb)
|
||||||
|
self.label_6 = QtWidgets.QLabel(self.fit_box)
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_6)
|
||||||
|
self.off_cb = QtWidgets.QCheckBox(self.fit_box)
|
||||||
|
self.off_cb.setObjectName("off_cb")
|
||||||
|
self.horizontalLayout_3.addWidget(self.off_cb)
|
||||||
|
self.gridLayout_3.addLayout(self.horizontalLayout_3, 1, 0, 1, 3)
|
||||||
|
self.verticalLayout.addWidget(self.fit_box)
|
||||||
|
self.out_box = QtWidgets.QGroupBox(FCEval_dialog)
|
||||||
|
self.out_box.setObjectName("out_box")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.out_box)
|
||||||
|
self.gridLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.savebutton = QtWidgets.QPushButton(self.out_box)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.savebutton.sizePolicy().hasHeightForWidth())
|
||||||
|
self.savebutton.setSizePolicy(sizePolicy)
|
||||||
|
self.savebutton.setObjectName("savebutton")
|
||||||
|
self.gridLayout.addWidget(self.savebutton, 0, 1, 1, 1)
|
||||||
|
self.line = QtWidgets.QFrame(self.out_box)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.gridLayout.addWidget(self.line, 2, 0, 1, 2)
|
||||||
|
self.graph_comboBox = QtWidgets.QComboBox(self.out_box)
|
||||||
|
self.graph_comboBox.setObjectName("graph_comboBox")
|
||||||
|
self.gridLayout.addWidget(self.graph_comboBox, 3, 1, 1, 1)
|
||||||
|
self.graph_checkbox = QtWidgets.QCheckBox(self.out_box)
|
||||||
|
self.graph_checkbox.setChecked(True)
|
||||||
|
self.graph_checkbox.setObjectName("graph_checkbox")
|
||||||
|
self.gridLayout.addWidget(self.graph_checkbox, 3, 0, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.out_box)
|
||||||
|
self.label.setMaximumSize(QtCore.QSize(16777215, 16777215))
|
||||||
|
self.label.setText("")
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 1, 0, 1, 2)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.out_box)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)
|
||||||
|
self.verticalLayout.addWidget(self.out_box)
|
||||||
|
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout.addItem(spacerItem1)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(FCEval_dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
self.label_12.setBuddy(self.kww_checkbox)
|
||||||
|
self.label_4.setBuddy(self.t1_cb)
|
||||||
|
self.label_5.setBuddy(self.beta_cb)
|
||||||
|
self.label_6.setBuddy(self.m0_cb)
|
||||||
|
|
||||||
|
self.retranslateUi(FCEval_dialog)
|
||||||
|
self.buttonBox.accepted.connect(FCEval_dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(FCEval_dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FCEval_dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, FCEval_dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FCEval_dialog.setWindowTitle(_translate("FCEval_dialog", "FC evaluation"))
|
||||||
|
self.input_box.setTitle(_translate("FCEval_dialog", "Input"))
|
||||||
|
self.file_pushbutton.setText(_translate("FCEval_dialog", "Add HDF files..."))
|
||||||
|
self.dir_pushbutton.setText(_translate("FCEval_dialog", "Add directory..."))
|
||||||
|
self.overwrite_cb.setText(_translate("FCEval_dialog", "Overwrite prev. data"))
|
||||||
|
self.region_box.setTitle(_translate("FCEval_dialog", "Evaluate region (empty values default to start/end)"))
|
||||||
|
self.start_lineedit.setPlaceholderText(_translate("FCEval_dialog", "start pos in µs"))
|
||||||
|
self.stop_lineedit.setPlaceholderText(_translate("FCEval_dialog", "end pos in µs"))
|
||||||
|
self.fit_box.setTitle(_translate("FCEval_dialog", "Fit equation"))
|
||||||
|
self.label_12.setText(_translate("FCEval_dialog", "y = M<sub>0</sub> exp[-(x/T<sub>1</sub>)<sup>β</sup>] + Off"))
|
||||||
|
self.kww_checkbox.setToolTip(_translate("FCEval_dialog", "Check to fit a stretched exponential instead of exponential function."))
|
||||||
|
self.kww_checkbox.setText(_translate("FCEval_dialog", "Stretched exponential"))
|
||||||
|
self.label_3.setText(_translate("FCEval_dialog", "Plot:"))
|
||||||
|
self.label_4.setText(_translate("FCEval_dialog", "T<sub>1</sub>"))
|
||||||
|
self.label_5.setText(_translate("FCEval_dialog", "β"))
|
||||||
|
self.label_6.setText(_translate("FCEval_dialog", "M<sub>0</sub>"))
|
||||||
|
self.off_cb.setText(_translate("FCEval_dialog", "Offset"))
|
||||||
|
self.out_box.setTitle(_translate("FCEval_dialog", "Output"))
|
||||||
|
self.savebutton.setText(_translate("FCEval_dialog", "Change directory..."))
|
||||||
|
self.graph_checkbox.setText(_translate("FCEval_dialog", "New graph"))
|
||||||
|
self.label_2.setText(_translate("FCEval_dialog", "Save location"))
|
181
nmreval/gui_qt/_py/filedialog.py
Normal file
181
nmreval/gui_qt/_py/filedialog.py
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/filedialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_QFileDialog(object):
|
||||||
|
def setupUi(self, QFileDialog):
|
||||||
|
QFileDialog.setObjectName("QFileDialog")
|
||||||
|
QFileDialog.resize(521, 316)
|
||||||
|
QFileDialog.setSizeGripEnabled(True)
|
||||||
|
self.gridlayout = QtWidgets.QGridLayout(QFileDialog)
|
||||||
|
self.gridlayout.setObjectName("gridlayout")
|
||||||
|
self.lookInLabel = QtWidgets.QLabel(QFileDialog)
|
||||||
|
self.lookInLabel.setObjectName("lookInLabel")
|
||||||
|
self.gridlayout.addWidget(self.lookInLabel, 0, 0, 1, 1)
|
||||||
|
self.hboxlayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.hboxlayout.setObjectName("hboxlayout")
|
||||||
|
self.lookInCombo = QFileDialogComboBox(QFileDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(1)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.lookInCombo.sizePolicy().hasHeightForWidth())
|
||||||
|
self.lookInCombo.setSizePolicy(sizePolicy)
|
||||||
|
self.lookInCombo.setMinimumSize(QtCore.QSize(50, 0))
|
||||||
|
self.lookInCombo.setObjectName("lookInCombo")
|
||||||
|
self.hboxlayout.addWidget(self.lookInCombo)
|
||||||
|
self.backButton = QtWidgets.QToolButton(QFileDialog)
|
||||||
|
self.backButton.setObjectName("backButton")
|
||||||
|
self.hboxlayout.addWidget(self.backButton)
|
||||||
|
self.forwardButton = QtWidgets.QToolButton(QFileDialog)
|
||||||
|
self.forwardButton.setObjectName("forwardButton")
|
||||||
|
self.hboxlayout.addWidget(self.forwardButton)
|
||||||
|
self.toParentButton = QtWidgets.QToolButton(QFileDialog)
|
||||||
|
self.toParentButton.setObjectName("toParentButton")
|
||||||
|
self.hboxlayout.addWidget(self.toParentButton)
|
||||||
|
self.newFolderButton = QtWidgets.QToolButton(QFileDialog)
|
||||||
|
self.newFolderButton.setObjectName("newFolderButton")
|
||||||
|
self.hboxlayout.addWidget(self.newFolderButton)
|
||||||
|
self.listModeButton = QtWidgets.QToolButton(QFileDialog)
|
||||||
|
self.listModeButton.setObjectName("listModeButton")
|
||||||
|
self.hboxlayout.addWidget(self.listModeButton)
|
||||||
|
self.detailModeButton = QtWidgets.QToolButton(QFileDialog)
|
||||||
|
self.detailModeButton.setObjectName("detailModeButton")
|
||||||
|
self.hboxlayout.addWidget(self.detailModeButton)
|
||||||
|
self.gridlayout.addLayout(self.hboxlayout, 0, 1, 1, 2)
|
||||||
|
self.splitter = QtWidgets.QSplitter(QFileDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.splitter.sizePolicy().hasHeightForWidth())
|
||||||
|
self.splitter.setSizePolicy(sizePolicy)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.splitter.setChildrenCollapsible(False)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.sidebar = QSidebar(self.splitter)
|
||||||
|
self.sidebar.setObjectName("sidebar")
|
||||||
|
self.frame = QtWidgets.QFrame(self.splitter)
|
||||||
|
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame.setObjectName("frame")
|
||||||
|
self.vboxlayout = QtWidgets.QVBoxLayout(self.frame)
|
||||||
|
self.vboxlayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.vboxlayout.setSpacing(0)
|
||||||
|
self.vboxlayout.setObjectName("vboxlayout")
|
||||||
|
self.stackedWidget = QtWidgets.QStackedWidget(self.frame)
|
||||||
|
self.stackedWidget.setObjectName("stackedWidget")
|
||||||
|
self.page = QtWidgets.QWidget()
|
||||||
|
self.page.setObjectName("page")
|
||||||
|
self.vboxlayout1 = QtWidgets.QVBoxLayout(self.page)
|
||||||
|
self.vboxlayout1.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.vboxlayout1.setSpacing(0)
|
||||||
|
self.vboxlayout1.setObjectName("vboxlayout1")
|
||||||
|
self.listView = QFileDialogListView(self.page)
|
||||||
|
self.listView.setObjectName("listView")
|
||||||
|
self.vboxlayout1.addWidget(self.listView)
|
||||||
|
self.stackedWidget.addWidget(self.page)
|
||||||
|
self.page_2 = QtWidgets.QWidget()
|
||||||
|
self.page_2.setObjectName("page_2")
|
||||||
|
self.vboxlayout2 = QtWidgets.QVBoxLayout(self.page_2)
|
||||||
|
self.vboxlayout2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.vboxlayout2.setSpacing(0)
|
||||||
|
self.vboxlayout2.setObjectName("vboxlayout2")
|
||||||
|
self.treeView = QFileDialogTreeView(self.page_2)
|
||||||
|
self.treeView.setObjectName("treeView")
|
||||||
|
self.vboxlayout2.addWidget(self.treeView)
|
||||||
|
self.stackedWidget.addWidget(self.page_2)
|
||||||
|
self.vboxlayout.addWidget(self.stackedWidget)
|
||||||
|
self.gridlayout.addWidget(self.splitter, 1, 0, 1, 3)
|
||||||
|
self.fileNameLabel = QtWidgets.QLabel(QFileDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fileNameLabel.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fileNameLabel.setSizePolicy(sizePolicy)
|
||||||
|
self.fileNameLabel.setMinimumSize(QtCore.QSize(0, 0))
|
||||||
|
self.fileNameLabel.setObjectName("fileNameLabel")
|
||||||
|
self.gridlayout.addWidget(self.fileNameLabel, 2, 0, 1, 1)
|
||||||
|
self.fileNameEdit = QFileDialogLineEdit(QFileDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(1)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fileNameEdit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fileNameEdit.setSizePolicy(sizePolicy)
|
||||||
|
self.fileNameEdit.setObjectName("fileNameEdit")
|
||||||
|
self.gridlayout.addWidget(self.fileNameEdit, 2, 1, 1, 1)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(QFileDialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Vertical)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridlayout.addWidget(self.buttonBox, 2, 2, 2, 1)
|
||||||
|
self.fileTypeLabel = QtWidgets.QLabel(QFileDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fileTypeLabel.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fileTypeLabel.setSizePolicy(sizePolicy)
|
||||||
|
self.fileTypeLabel.setObjectName("fileTypeLabel")
|
||||||
|
self.gridlayout.addWidget(self.fileTypeLabel, 3, 0, 1, 1)
|
||||||
|
self.fileTypeCombo = QtWidgets.QComboBox(QFileDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fileTypeCombo.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fileTypeCombo.setSizePolicy(sizePolicy)
|
||||||
|
self.fileTypeCombo.setObjectName("fileTypeCombo")
|
||||||
|
self.gridlayout.addWidget(self.fileTypeCombo, 3, 1, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(QFileDialog)
|
||||||
|
self.stackedWidget.setCurrentIndex(0)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(QFileDialog)
|
||||||
|
QFileDialog.setTabOrder(self.lookInCombo, self.backButton)
|
||||||
|
QFileDialog.setTabOrder(self.backButton, self.forwardButton)
|
||||||
|
QFileDialog.setTabOrder(self.forwardButton, self.toParentButton)
|
||||||
|
QFileDialog.setTabOrder(self.toParentButton, self.newFolderButton)
|
||||||
|
QFileDialog.setTabOrder(self.newFolderButton, self.listModeButton)
|
||||||
|
QFileDialog.setTabOrder(self.listModeButton, self.detailModeButton)
|
||||||
|
QFileDialog.setTabOrder(self.detailModeButton, self.sidebar)
|
||||||
|
QFileDialog.setTabOrder(self.sidebar, self.treeView)
|
||||||
|
QFileDialog.setTabOrder(self.treeView, self.listView)
|
||||||
|
QFileDialog.setTabOrder(self.listView, self.fileNameEdit)
|
||||||
|
QFileDialog.setTabOrder(self.fileNameEdit, self.buttonBox)
|
||||||
|
QFileDialog.setTabOrder(self.buttonBox, self.fileTypeCombo)
|
||||||
|
|
||||||
|
def retranslateUi(self, QFileDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
self.lookInLabel.setText(_translate("QFileDialog", "Look in:"))
|
||||||
|
self.backButton.setToolTip(_translate("QFileDialog", "Back"))
|
||||||
|
self.backButton.setAccessibleName(_translate("QFileDialog", "Back"))
|
||||||
|
self.backButton.setAccessibleDescription(_translate("QFileDialog", "Go back"))
|
||||||
|
self.backButton.setShortcut(_translate("QFileDialog", "Alt+Left"))
|
||||||
|
self.forwardButton.setToolTip(_translate("QFileDialog", "Forward"))
|
||||||
|
self.forwardButton.setAccessibleName(_translate("QFileDialog", "Forward"))
|
||||||
|
self.forwardButton.setAccessibleDescription(_translate("QFileDialog", "Go forward"))
|
||||||
|
self.forwardButton.setShortcut(_translate("QFileDialog", "Alt+Right"))
|
||||||
|
self.toParentButton.setToolTip(_translate("QFileDialog", "Parent Directory"))
|
||||||
|
self.toParentButton.setAccessibleName(_translate("QFileDialog", "Parent Directory"))
|
||||||
|
self.toParentButton.setAccessibleDescription(_translate("QFileDialog", "Go to the parent directory"))
|
||||||
|
self.toParentButton.setShortcut(_translate("QFileDialog", "Alt+Up"))
|
||||||
|
self.newFolderButton.setToolTip(_translate("QFileDialog", "Create New Folder"))
|
||||||
|
self.newFolderButton.setAccessibleName(_translate("QFileDialog", "Create New Folder"))
|
||||||
|
self.newFolderButton.setAccessibleDescription(_translate("QFileDialog", "Create a New Folder"))
|
||||||
|
self.listModeButton.setToolTip(_translate("QFileDialog", "List View"))
|
||||||
|
self.listModeButton.setAccessibleName(_translate("QFileDialog", "List View"))
|
||||||
|
self.listModeButton.setAccessibleDescription(_translate("QFileDialog", "Change to list view mode"))
|
||||||
|
self.detailModeButton.setToolTip(_translate("QFileDialog", "Detail View"))
|
||||||
|
self.detailModeButton.setAccessibleName(_translate("QFileDialog", "Detail View"))
|
||||||
|
self.detailModeButton.setAccessibleDescription(_translate("QFileDialog", "Change to detail view mode"))
|
||||||
|
self.sidebar.setAccessibleName(_translate("QFileDialog", "Sidebar"))
|
||||||
|
self.sidebar.setAccessibleDescription(_translate("QFileDialog", "List of places and bookmarks"))
|
||||||
|
self.listView.setAccessibleName(_translate("QFileDialog", "Files"))
|
||||||
|
self.treeView.setAccessibleName(_translate("QFileDialog", "Files"))
|
||||||
|
self.fileTypeLabel.setText(_translate("QFileDialog", "Files of type:"))
|
||||||
|
from private.qfiledialog_p import QFileDialogComboBox, QFileDialogLineEdit, QFileDialogListView, QFileDialogTreeView
|
||||||
|
from private.qsidebar_p import QSidebar
|
189
nmreval/gui_qt/_py/fitcreationdialog.py
Normal file
189
nmreval/gui_qt/_py/fitcreationdialog.py
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitcreationdialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(614, 776)
|
||||||
|
self.verticalLayout_5 = QtWidgets.QVBoxLayout(Dialog)
|
||||||
|
self.verticalLayout_5.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_5.setSpacing(3)
|
||||||
|
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||||
|
self.groupBox = QtWidgets.QGroupBox(Dialog)
|
||||||
|
self.groupBox.setCheckable(True)
|
||||||
|
self.groupBox.setChecked(False)
|
||||||
|
self.groupBox.setObjectName("groupBox")
|
||||||
|
self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.groupBox)
|
||||||
|
self.verticalLayout_7.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_7.setSpacing(3)
|
||||||
|
self.verticalLayout_7.setObjectName("verticalLayout_7")
|
||||||
|
self.widget_2 = QtWidgets.QWidget(self.groupBox)
|
||||||
|
self.widget_2.setObjectName("widget_2")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.widget_2)
|
||||||
|
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_2.setSpacing(3)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.name_lineedit = QtWidgets.QLineEdit(self.widget_2)
|
||||||
|
self.name_lineedit.setObjectName("name_lineedit")
|
||||||
|
self.gridLayout_2.addWidget(self.name_lineedit, 0, 1, 1, 1)
|
||||||
|
self.group_lineedit = QtWidgets.QLineEdit(self.widget_2)
|
||||||
|
self.group_lineedit.setObjectName("group_lineedit")
|
||||||
|
self.gridLayout_2.addWidget(self.group_lineedit, 1, 1, 1, 1)
|
||||||
|
self.group_label = QtWidgets.QLabel(self.widget_2)
|
||||||
|
self.group_label.setObjectName("group_label")
|
||||||
|
self.gridLayout_2.addWidget(self.group_label, 1, 0, 1, 1)
|
||||||
|
self.name_label = QtWidgets.QLabel(self.widget_2)
|
||||||
|
self.name_label.setObjectName("name_label")
|
||||||
|
self.gridLayout_2.addWidget(self.name_label, 0, 0, 1, 1)
|
||||||
|
self.lineEdit = QtWidgets.QLineEdit(self.widget_2)
|
||||||
|
self.lineEdit.setObjectName("lineEdit")
|
||||||
|
self.gridLayout_2.addWidget(self.lineEdit, 2, 1, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.widget_2)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout_2.addWidget(self.label_2, 2, 0, 1, 1)
|
||||||
|
self.verticalLayout_7.addWidget(self.widget_2)
|
||||||
|
self.verticalLayout_5.addWidget(self.groupBox)
|
||||||
|
self.groupBox_2 = QtWidgets.QGroupBox(Dialog)
|
||||||
|
self.groupBox_2.setCheckable(True)
|
||||||
|
self.groupBox_2.setChecked(False)
|
||||||
|
self.groupBox_2.setObjectName("groupBox_2")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2)
|
||||||
|
self.verticalLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_2.setSpacing(3)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.widget_3 = QtWidgets.QWidget(self.groupBox_2)
|
||||||
|
self.widget_3.setObjectName("widget_3")
|
||||||
|
self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.widget_3)
|
||||||
|
self.verticalLayout_8.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_8.setSpacing(3)
|
||||||
|
self.verticalLayout_8.setObjectName("verticalLayout_8")
|
||||||
|
self.tableWidget = QtWidgets.QTableWidget(self.widget_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.tableWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.tableWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
|
self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
|
self.tableWidget.setColumnCount(4)
|
||||||
|
self.tableWidget.setObjectName("tableWidget")
|
||||||
|
self.tableWidget.setRowCount(0)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.tableWidget.setHorizontalHeaderItem(0, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.tableWidget.setHorizontalHeaderItem(1, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.tableWidget.setHorizontalHeaderItem(2, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.tableWidget.setHorizontalHeaderItem(3, item)
|
||||||
|
self.verticalLayout_8.addWidget(self.tableWidget)
|
||||||
|
self.parameter_button = QtWidgets.QToolButton(self.widget_3)
|
||||||
|
self.parameter_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.parameter_button.setAutoRaise(False)
|
||||||
|
self.parameter_button.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.parameter_button.setObjectName("parameter_button")
|
||||||
|
self.verticalLayout_8.addWidget(self.parameter_button)
|
||||||
|
self.verticalLayout_2.addWidget(self.widget_3)
|
||||||
|
self.verticalLayout_5.addWidget(self.groupBox_2)
|
||||||
|
self.groupBox_3 = QtWidgets.QGroupBox(Dialog)
|
||||||
|
self.groupBox_3.setCheckable(True)
|
||||||
|
self.groupBox_3.setChecked(False)
|
||||||
|
self.groupBox_3.setObjectName("groupBox_3")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_3)
|
||||||
|
self.verticalLayout_3.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_3.setSpacing(3)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.widget = QtWidgets.QWidget(self.groupBox_3)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.widget)
|
||||||
|
self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_6.setSpacing(3)
|
||||||
|
self.verticalLayout_6.setObjectName("verticalLayout_6")
|
||||||
|
self.use_nuclei = QtWidgets.QCheckBox(self.widget)
|
||||||
|
self.use_nuclei.setObjectName("use_nuclei")
|
||||||
|
self.verticalLayout_6.addWidget(self.use_nuclei)
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(self.widget)
|
||||||
|
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.West)
|
||||||
|
self.tabWidget.setTabsClosable(True)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.verticalLayout_6.addWidget(self.tabWidget)
|
||||||
|
self.selection_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.selection_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.selection_button.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.selection_button.setObjectName("selection_button")
|
||||||
|
self.verticalLayout_6.addWidget(self.selection_button)
|
||||||
|
self.verticalLayout_3.addWidget(self.widget)
|
||||||
|
self.verticalLayout_5.addWidget(self.groupBox_3)
|
||||||
|
self.groupBox_4 = QtWidgets.QGroupBox(Dialog)
|
||||||
|
self.groupBox_4.setCheckable(True)
|
||||||
|
self.groupBox_4.setChecked(False)
|
||||||
|
self.groupBox_4.setObjectName("groupBox_4")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox_4)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.namespace_widget = QNamespaceWidget(self.groupBox_4)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.namespace_widget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.namespace_widget.setSizePolicy(sizePolicy)
|
||||||
|
self.namespace_widget.setObjectName("namespace_widget")
|
||||||
|
self.verticalLayout.addWidget(self.namespace_widget)
|
||||||
|
self.verticalLayout_5.addWidget(self.groupBox_4)
|
||||||
|
self.frame_4 = QtWidgets.QFrame(Dialog)
|
||||||
|
self.frame_4.setObjectName("frame_4")
|
||||||
|
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.frame_4)
|
||||||
|
self.verticalLayout_4.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_4.setSpacing(3)
|
||||||
|
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||||
|
self.label = QtWidgets.QLabel(self.frame_4)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.verticalLayout_4.addWidget(self.label)
|
||||||
|
self.plainTextEdit = CodeEditor(self.frame_4)
|
||||||
|
self.plainTextEdit.setObjectName("plainTextEdit")
|
||||||
|
self.verticalLayout_4.addWidget(self.plainTextEdit)
|
||||||
|
self.verticalLayout_5.addWidget(self.frame_4)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout_5.addWidget(self.buttonBox)
|
||||||
|
self.name_label.setBuddy(self.name_lineedit)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||||
|
self.groupBox.setTitle(_translate("Dialog", "Description"))
|
||||||
|
self.group_label.setText(_translate("Dialog", "Group"))
|
||||||
|
self.name_label.setText(_translate("Dialog", "Name"))
|
||||||
|
self.label_2.setText(_translate("Dialog", "Equation"))
|
||||||
|
self.groupBox_2.setTitle(_translate("Dialog", "Variables"))
|
||||||
|
item = self.tableWidget.horizontalHeaderItem(0)
|
||||||
|
item.setText(_translate("Dialog", "Variable"))
|
||||||
|
item = self.tableWidget.horizontalHeaderItem(1)
|
||||||
|
item.setText(_translate("Dialog", "Name"))
|
||||||
|
item = self.tableWidget.horizontalHeaderItem(2)
|
||||||
|
item.setText(_translate("Dialog", "Lower bound"))
|
||||||
|
item = self.tableWidget.horizontalHeaderItem(3)
|
||||||
|
item.setText(_translate("Dialog", "Upper bound"))
|
||||||
|
self.parameter_button.setText(_translate("Dialog", "Add parameter"))
|
||||||
|
self.groupBox_3.setTitle(_translate("Dialog", "Multiple choice part"))
|
||||||
|
self.use_nuclei.setText(_translate("Dialog", "Add gyromagnetic ratios"))
|
||||||
|
self.selection_button.setText(_translate("Dialog", "Add selection"))
|
||||||
|
self.groupBox_4.setTitle(_translate("Dialog", "Available namespace"))
|
||||||
|
self.label.setText(_translate("Dialog", "Function y = func(x)"))
|
||||||
|
from ..lib.codeeditor import CodeEditor
|
||||||
|
from ..lib.namespace import QNamespaceWidget
|
159
nmreval/gui_qt/_py/fitdialog.py
Normal file
159
nmreval/gui_qt/_py/fitdialog.py
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitdialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FitDialog(object):
|
||||||
|
def setupUi(self, FitDialog):
|
||||||
|
FitDialog.setObjectName("FitDialog")
|
||||||
|
FitDialog.resize(347, 710)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(FitDialog)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.scrollArea = QtWidgets.QScrollArea(FitDialog)
|
||||||
|
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
self.scrollArea.setWidgetResizable(True)
|
||||||
|
self.scrollArea.setObjectName("scrollArea")
|
||||||
|
self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
|
||||||
|
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 341, 665))
|
||||||
|
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_2)
|
||||||
|
self.gridLayout_2.setContentsMargins(0, 0, 0, -1)
|
||||||
|
self.gridLayout_2.setSpacing(3)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.weight_combobox = QtWidgets.QComboBox(self.scrollAreaWidgetContents_2)
|
||||||
|
self.weight_combobox.setObjectName("weight_combobox")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.gridLayout_2.addWidget(self.weight_combobox, 6, 1, 1, 1)
|
||||||
|
self.newmodel_button = QtWidgets.QPushButton(self.scrollAreaWidgetContents_2)
|
||||||
|
self.newmodel_button.setEnabled(False)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.newmodel_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.newmodel_button.setSizePolicy(sizePolicy)
|
||||||
|
self.newmodel_button.setObjectName("newmodel_button")
|
||||||
|
self.gridLayout_2.addWidget(self.newmodel_button, 2, 0, 1, 1)
|
||||||
|
self.deletemodel_button = QtWidgets.QPushButton(self.scrollAreaWidgetContents_2)
|
||||||
|
self.deletemodel_button.setEnabled(False)
|
||||||
|
self.deletemodel_button.setObjectName("deletemodel_button")
|
||||||
|
self.gridLayout_2.addWidget(self.deletemodel_button, 2, 1, 1, 1)
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.scrollAreaWidgetContents_2)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout_2.addWidget(self.label_3, 6, 0, 1, 1)
|
||||||
|
self.stackedWidget = QtWidgets.QStackedWidget(self.scrollAreaWidgetContents_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.stackedWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.stackedWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.stackedWidget.setObjectName("stackedWidget")
|
||||||
|
self.page = QtWidgets.QWidget()
|
||||||
|
self.page.setObjectName("page")
|
||||||
|
self.stackedWidget.addWidget(self.page)
|
||||||
|
self.gridLayout_2.addWidget(self.stackedWidget, 1, 0, 1, 2)
|
||||||
|
self.functionwidget = QFunctionWidget(self.scrollAreaWidgetContents_2)
|
||||||
|
self.functionwidget.setObjectName("functionwidget")
|
||||||
|
self.gridLayout_2.addWidget(self.functionwidget, 0, 0, 1, 2)
|
||||||
|
self.model_frame = QtWidgets.QFrame(self.scrollAreaWidgetContents_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.model_frame.sizePolicy().hasHeightForWidth())
|
||||||
|
self.model_frame.setSizePolicy(sizePolicy)
|
||||||
|
self.model_frame.setObjectName("model_frame")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.model_frame)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setHorizontalSpacing(0)
|
||||||
|
self.gridLayout.setVerticalSpacing(1)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.show_combobox = QtWidgets.QComboBox(self.model_frame)
|
||||||
|
self.show_combobox.setObjectName("show_combobox")
|
||||||
|
self.show_combobox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.show_combobox, 1, 1, 1, 1)
|
||||||
|
self.default_combobox = QtWidgets.QComboBox(self.model_frame)
|
||||||
|
self.default_combobox.setObjectName("default_combobox")
|
||||||
|
self.default_combobox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.default_combobox, 0, 1, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.model_frame)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.model_frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label.setSizePolicy(sizePolicy)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||||
|
self.gridLayout_2.addWidget(self.model_frame, 3, 0, 1, 2)
|
||||||
|
self.data_widget = ExpandableWidget(self.scrollAreaWidgetContents_2)
|
||||||
|
self.data_widget.setMinimumSize(QtCore.QSize(0, 24))
|
||||||
|
self.data_widget.setObjectName("data_widget")
|
||||||
|
self.gridLayout_2.addWidget(self.data_widget, 5, 0, 1, 2)
|
||||||
|
self.scrollArea.setWidget(self.scrollAreaWidgetContents_2)
|
||||||
|
self.verticalLayout.addWidget(self.scrollArea)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.fit_button = QtWidgets.QPushButton(FitDialog)
|
||||||
|
self.fit_button.setStyleSheet("font-weight: bold")
|
||||||
|
self.fit_button.setObjectName("fit_button")
|
||||||
|
self.horizontalLayout.addWidget(self.fit_button)
|
||||||
|
self.abort_button = QtWidgets.QPushButton(FitDialog)
|
||||||
|
self.abort_button.setStyleSheet("font-weight: bold")
|
||||||
|
self.abort_button.setObjectName("abort_button")
|
||||||
|
self.horizontalLayout.addWidget(self.abort_button)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.preview_checkbox = QtWidgets.QCheckBox(FitDialog)
|
||||||
|
self.preview_checkbox.setObjectName("preview_checkbox")
|
||||||
|
self.horizontalLayout.addWidget(self.preview_checkbox)
|
||||||
|
self.preview_button = QtWidgets.QPushButton(FitDialog)
|
||||||
|
self.preview_button.setCheckable(False)
|
||||||
|
self.preview_button.setChecked(False)
|
||||||
|
self.preview_button.setFlat(False)
|
||||||
|
self.preview_button.setObjectName("preview_button")
|
||||||
|
self.horizontalLayout.addWidget(self.preview_button)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
|
||||||
|
self.retranslateUi(FitDialog)
|
||||||
|
self.stackedWidget.setCurrentIndex(0)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FitDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, FitDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FitDialog.setWindowTitle(_translate("FitDialog", "Form"))
|
||||||
|
self.weight_combobox.setItemText(0, _translate("FitDialog", "None"))
|
||||||
|
self.weight_combobox.setItemText(1, _translate("FitDialog", "y"))
|
||||||
|
self.weight_combobox.setItemText(2, _translate("FitDialog", "y²"))
|
||||||
|
self.weight_combobox.setItemText(3, _translate("FitDialog", "Δy"))
|
||||||
|
self.weight_combobox.setItemText(4, _translate("FitDialog", "log(y)"))
|
||||||
|
self.newmodel_button.setText(_translate("FitDialog", "New model"))
|
||||||
|
self.deletemodel_button.setText(_translate("FitDialog", "Delete model"))
|
||||||
|
self.label_3.setText(_translate("FitDialog", "Weight"))
|
||||||
|
self.show_combobox.setItemText(0, _translate("FitDialog", "Model a"))
|
||||||
|
self.default_combobox.setItemText(0, _translate("FitDialog", "Model a"))
|
||||||
|
self.label_2.setText(_translate("FitDialog", "Show model"))
|
||||||
|
self.label.setText(_translate("FitDialog", "Default"))
|
||||||
|
self.fit_button.setText(_translate("FitDialog", "Run fit!!!"))
|
||||||
|
self.abort_button.setText(_translate("FitDialog", "Abort"))
|
||||||
|
self.preview_checkbox.setText(_translate("FitDialog", "Preview"))
|
||||||
|
self.preview_button.setText(_translate("FitDialog", "Update"))
|
||||||
|
from ..fit.fitfunction import QFunctionWidget
|
||||||
|
from ..lib.expandablewidget import ExpandableWidget
|
285
nmreval/gui_qt/_py/fitdialog_window.py
Normal file
285
nmreval/gui_qt/_py/fitdialog_window.py
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitdialog_window.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FitDialog(object):
|
||||||
|
def setupUi(self, FitDialog):
|
||||||
|
FitDialog.setObjectName("FitDialog")
|
||||||
|
FitDialog.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||||
|
FitDialog.resize(828, 827)
|
||||||
|
icon = QtGui.QIcon()
|
||||||
|
icon.addPixmap(QtGui.QPixmap(":/logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
FitDialog.setWindowIcon(icon)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(FitDialog)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.splitter = QtWidgets.QSplitter(self.centralwidget)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.widget_2 = QtWidgets.QWidget(self.splitter)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.widget_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.widget_2.setSizePolicy(sizePolicy)
|
||||||
|
self.widget_2.setObjectName("widget_2")
|
||||||
|
self.gridLayout_3 = QtWidgets.QGridLayout(self.widget_2)
|
||||||
|
self.gridLayout_3.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout_3.setSpacing(3)
|
||||||
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.widget_2)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout_3.addWidget(self.label_3, 3, 0, 1, 1)
|
||||||
|
self.weight_combobox = QtWidgets.QComboBox(self.widget_2)
|
||||||
|
self.weight_combobox.setObjectName("weight_combobox")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.weight_combobox.addItem("")
|
||||||
|
self.gridLayout_3.addWidget(self.weight_combobox, 3, 1, 1, 1)
|
||||||
|
self.line = QtWidgets.QFrame(self.widget_2)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.gridLayout_3.addWidget(self.line, 2, 0, 1, 2)
|
||||||
|
self.tableWidget = QtWidgets.QTableWidget(self.widget_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.tableWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.tableWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
|
self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
|
self.tableWidget.setShowGrid(False)
|
||||||
|
self.tableWidget.setGridStyle(QtCore.Qt.NoPen)
|
||||||
|
self.tableWidget.setColumnCount(2)
|
||||||
|
self.tableWidget.setObjectName("tableWidget")
|
||||||
|
self.tableWidget.setRowCount(0)
|
||||||
|
self.tableWidget.horizontalHeader().setVisible(False)
|
||||||
|
self.tableWidget.horizontalHeader().setStretchLastSection(True)
|
||||||
|
self.tableWidget.verticalHeader().setVisible(False)
|
||||||
|
self.gridLayout_3.addWidget(self.tableWidget, 0, 0, 1, 2)
|
||||||
|
self.horizontalFrame = QtWidgets.QFrame(self.widget_2)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.horizontalFrame.sizePolicy().hasHeightForWidth())
|
||||||
|
self.horizontalFrame.setSizePolicy(sizePolicy)
|
||||||
|
self.horizontalFrame.setObjectName("horizontalFrame")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.horizontalFrame)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setHorizontalSpacing(0)
|
||||||
|
self.gridLayout.setVerticalSpacing(1)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.show_combobox = QtWidgets.QComboBox(self.horizontalFrame)
|
||||||
|
self.show_combobox.setObjectName("show_combobox")
|
||||||
|
self.show_combobox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.show_combobox, 1, 1, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.horizontalFrame)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
|
||||||
|
self.default_combobox = QtWidgets.QComboBox(self.horizontalFrame)
|
||||||
|
self.default_combobox.setObjectName("default_combobox")
|
||||||
|
self.default_combobox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.default_combobox, 0, 1, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.horizontalFrame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label.setSizePolicy(sizePolicy)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||||
|
self.gridLayout_3.addWidget(self.horizontalFrame, 1, 0, 1, 2)
|
||||||
|
self.middle_widget = QtWidgets.QWidget(self.splitter)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.middle_widget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.middle_widget.setSizePolicy(sizePolicy)
|
||||||
|
self.middle_widget.setObjectName("middle_widget")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.middle_widget)
|
||||||
|
self.gridLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout_2.setSpacing(3)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.newmodel_button = QtWidgets.QPushButton(self.middle_widget)
|
||||||
|
self.newmodel_button.setEnabled(False)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.newmodel_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.newmodel_button.setSizePolicy(sizePolicy)
|
||||||
|
self.newmodel_button.setObjectName("newmodel_button")
|
||||||
|
self.gridLayout_2.addWidget(self.newmodel_button, 2, 0, 1, 1)
|
||||||
|
self.functionwidget = FunctionSelectionWidget(self.middle_widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.functionwidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.functionwidget.setSizePolicy(sizePolicy)
|
||||||
|
self.functionwidget.setObjectName("functionwidget")
|
||||||
|
self.gridLayout_2.addWidget(self.functionwidget, 0, 0, 1, 2)
|
||||||
|
self.deletemodel_button = QtWidgets.QPushButton(self.middle_widget)
|
||||||
|
self.deletemodel_button.setEnabled(False)
|
||||||
|
self.deletemodel_button.setObjectName("deletemodel_button")
|
||||||
|
self.gridLayout_2.addWidget(self.deletemodel_button, 2, 1, 1, 1)
|
||||||
|
self.stackedWidget = QtWidgets.QStackedWidget(self.middle_widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.stackedWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.stackedWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.stackedWidget.setObjectName("stackedWidget")
|
||||||
|
self.page = QtWidgets.QWidget()
|
||||||
|
self.page.setObjectName("page")
|
||||||
|
self.stackedWidget.addWidget(self.page)
|
||||||
|
self.page_2 = QtWidgets.QWidget()
|
||||||
|
self.page_2.setObjectName("page_2")
|
||||||
|
self.stackedWidget.addWidget(self.page_2)
|
||||||
|
self.gridLayout_2.addWidget(self.stackedWidget, 1, 0, 1, 2)
|
||||||
|
self.verticalLayout_2.addWidget(self.splitter)
|
||||||
|
self.frame_4 = QtWidgets.QFrame(self.centralwidget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame_4.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame_4.setSizePolicy(sizePolicy)
|
||||||
|
self.frame_4.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_4.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_4.setLineWidth(2)
|
||||||
|
self.frame_4.setMidLineWidth(0)
|
||||||
|
self.frame_4.setObjectName("frame_4")
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.frame_4)
|
||||||
|
self.horizontalLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.horizontalLayout_2.setSpacing(3)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem)
|
||||||
|
self.fit_button = QtWidgets.QPushButton(self.frame_4)
|
||||||
|
self.fit_button.setObjectName("fit_button")
|
||||||
|
self.horizontalLayout_2.addWidget(self.fit_button)
|
||||||
|
self.abort_button = QtWidgets.QPushButton(self.frame_4)
|
||||||
|
self.abort_button.setObjectName("abort_button")
|
||||||
|
self.horizontalLayout_2.addWidget(self.abort_button)
|
||||||
|
self.preview_button = QtWidgets.QPushButton(self.frame_4)
|
||||||
|
icon1 = QtGui.QIcon()
|
||||||
|
icon1.addPixmap(QtGui.QPixmap(":/fit_preview.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.preview_button.setIcon(icon1)
|
||||||
|
self.preview_button.setCheckable(True)
|
||||||
|
self.preview_button.setObjectName("preview_button")
|
||||||
|
self.horizontalLayout_2.addWidget(self.preview_button)
|
||||||
|
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem1)
|
||||||
|
self.verticalLayout_2.addWidget(self.frame_4)
|
||||||
|
FitDialog.setCentralWidget(self.centralwidget)
|
||||||
|
self.menubar = QtWidgets.QMenuBar(FitDialog)
|
||||||
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 828, 30))
|
||||||
|
self.menubar.setObjectName("menubar")
|
||||||
|
self.menuOptions = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuOptions.setObjectName("menuOptions")
|
||||||
|
self.menuMethod = QtWidgets.QMenu(self.menuOptions)
|
||||||
|
self.menuMethod.setObjectName("menuMethod")
|
||||||
|
self.menuLimits = QtWidgets.QMenu(self.menuOptions)
|
||||||
|
self.menuLimits.setObjectName("menuLimits")
|
||||||
|
self.menuHelp = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuHelp.setObjectName("menuHelp")
|
||||||
|
self.menuUser = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menuUser.setObjectName("menuUser")
|
||||||
|
FitDialog.setMenuBar(self.menubar)
|
||||||
|
self.statusBar = QtWidgets.QStatusBar(FitDialog)
|
||||||
|
self.statusBar.setObjectName("statusBar")
|
||||||
|
FitDialog.setStatusBar(self.statusBar)
|
||||||
|
self.action_nm = QtWidgets.QAction(FitDialog)
|
||||||
|
self.action_nm.setCheckable(True)
|
||||||
|
self.action_nm.setObjectName("action_nm")
|
||||||
|
self.action_odr = QtWidgets.QAction(FitDialog)
|
||||||
|
self.action_odr.setCheckable(True)
|
||||||
|
self.action_odr.setObjectName("action_odr")
|
||||||
|
self.action_lm = QtWidgets.QAction(FitDialog)
|
||||||
|
self.action_lm.setCheckable(True)
|
||||||
|
self.action_lm.setChecked(True)
|
||||||
|
self.action_lm.setObjectName("action_lm")
|
||||||
|
self.actionHelp = QtWidgets.QAction(FitDialog)
|
||||||
|
self.actionHelp.setObjectName("actionHelp")
|
||||||
|
self.actionOpen_editor = QtWidgets.QAction(FitDialog)
|
||||||
|
self.actionOpen_editor.setObjectName("actionOpen_editor")
|
||||||
|
self.actionPreview_points = QtWidgets.QAction(FitDialog)
|
||||||
|
self.actionPreview_points.setObjectName("actionPreview_points")
|
||||||
|
self.actionSave_current_model = QtWidgets.QAction(FitDialog)
|
||||||
|
self.actionSave_current_model.setObjectName("actionSave_current_model")
|
||||||
|
self.action_no_range = QtWidgets.QAction(FitDialog)
|
||||||
|
self.action_no_range.setCheckable(True)
|
||||||
|
self.action_no_range.setObjectName("action_no_range")
|
||||||
|
self.action_x_range = QtWidgets.QAction(FitDialog)
|
||||||
|
self.action_x_range.setCheckable(True)
|
||||||
|
self.action_x_range.setChecked(True)
|
||||||
|
self.action_x_range.setObjectName("action_x_range")
|
||||||
|
self.action_custom_range = QtWidgets.QAction(FitDialog)
|
||||||
|
self.action_custom_range.setCheckable(True)
|
||||||
|
self.action_custom_range.setObjectName("action_custom_range")
|
||||||
|
self.menuMethod.addAction(self.action_lm)
|
||||||
|
self.menuMethod.addAction(self.action_nm)
|
||||||
|
self.menuMethod.addAction(self.action_odr)
|
||||||
|
self.menuLimits.addAction(self.action_no_range)
|
||||||
|
self.menuLimits.addAction(self.action_x_range)
|
||||||
|
self.menuLimits.addAction(self.action_custom_range)
|
||||||
|
self.menuOptions.addAction(self.menuMethod.menuAction())
|
||||||
|
self.menuOptions.addAction(self.menuLimits.menuAction())
|
||||||
|
self.menuOptions.addSeparator()
|
||||||
|
self.menuOptions.addAction(self.actionPreview_points)
|
||||||
|
self.menuHelp.addAction(self.actionHelp)
|
||||||
|
self.menuUser.addAction(self.actionOpen_editor)
|
||||||
|
self.menuUser.addAction(self.actionSave_current_model)
|
||||||
|
self.menubar.addAction(self.menuOptions.menuAction())
|
||||||
|
self.menubar.addAction(self.menuUser.menuAction())
|
||||||
|
self.menubar.addAction(self.menuHelp.menuAction())
|
||||||
|
|
||||||
|
self.retranslateUi(FitDialog)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FitDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, FitDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FitDialog.setWindowTitle(_translate("FitDialog", "One must imagine Sisyphus happy."))
|
||||||
|
self.label_3.setText(_translate("FitDialog", "Weight"))
|
||||||
|
self.weight_combobox.setItemText(0, _translate("FitDialog", "None"))
|
||||||
|
self.weight_combobox.setItemText(1, _translate("FitDialog", "y"))
|
||||||
|
self.weight_combobox.setItemText(2, _translate("FitDialog", "y²"))
|
||||||
|
self.weight_combobox.setItemText(3, _translate("FitDialog", "Δy"))
|
||||||
|
self.weight_combobox.setItemText(4, _translate("FitDialog", "log(y)"))
|
||||||
|
self.show_combobox.setItemText(0, _translate("FitDialog", "Model a"))
|
||||||
|
self.label_2.setText(_translate("FitDialog", "Show model"))
|
||||||
|
self.default_combobox.setItemText(0, _translate("FitDialog", "Model a"))
|
||||||
|
self.label.setText(_translate("FitDialog", "Default"))
|
||||||
|
self.newmodel_button.setText(_translate("FitDialog", "New model"))
|
||||||
|
self.deletemodel_button.setText(_translate("FitDialog", "Delete model"))
|
||||||
|
self.fit_button.setText(_translate("FitDialog", "Run fit!!!"))
|
||||||
|
self.abort_button.setText(_translate("FitDialog", "Abort"))
|
||||||
|
self.preview_button.setText(_translate("FitDialog", "Preview"))
|
||||||
|
self.menuOptions.setTitle(_translate("FitDialog", "Options"))
|
||||||
|
self.menuMethod.setTitle(_translate("FitDialog", "Method"))
|
||||||
|
self.menuLimits.setTitle(_translate("FitDialog", "Limits"))
|
||||||
|
self.menuHelp.setTitle(_translate("FitDialog", "Help"))
|
||||||
|
self.menuUser.setTitle(_translate("FitDialog", "User"))
|
||||||
|
self.action_nm.setText(_translate("FitDialog", "Nelder-Mead"))
|
||||||
|
self.action_odr.setText(_translate("FitDialog", "ODR"))
|
||||||
|
self.action_lm.setText(_translate("FitDialog", "Default stuff"))
|
||||||
|
self.actionHelp.setText(_translate("FitDialog", "Help!"))
|
||||||
|
self.actionOpen_editor.setText(_translate("FitDialog", "Open editor..."))
|
||||||
|
self.actionPreview_points.setText(_translate("FitDialog", "Preview points..."))
|
||||||
|
self.actionSave_current_model.setText(_translate("FitDialog", "Save current model..."))
|
||||||
|
self.action_no_range.setText(_translate("FitDialog", "None"))
|
||||||
|
self.action_x_range.setText(_translate("FitDialog", "Visible x range"))
|
||||||
|
self.action_custom_range.setText(_translate("FitDialog", "Custom..."))
|
||||||
|
from ..fit.function_selection import FunctionSelectionWidget
|
||||||
|
import images_rc
|
123
nmreval/gui_qt/_py/fitfunctionwidget.py
Normal file
123
nmreval/gui_qt/_py/fitfunctionwidget.py
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitfunctionwidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(314, 232)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
|
||||||
|
Form.setSizePolicy(sizePolicy)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(3)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.widget = ExpandableWidget(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.widget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.widget.setSizePolicy(sizePolicy)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.gridLayout.addWidget(self.widget, 4, 0, 1, 2)
|
||||||
|
self.complex_widget = QtWidgets.QWidget(Form)
|
||||||
|
self.complex_widget.setObjectName("complex_widget")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.complex_widget)
|
||||||
|
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.complex_widget)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout_2.addWidget(self.label_2, 1, 0, 1, 1)
|
||||||
|
self.complex_comboBox = QtWidgets.QComboBox(self.complex_widget)
|
||||||
|
self.complex_comboBox.setObjectName("complex_comboBox")
|
||||||
|
self.complex_comboBox.addItem("")
|
||||||
|
self.complex_comboBox.addItem("")
|
||||||
|
self.complex_comboBox.addItem("")
|
||||||
|
self.gridLayout_2.addWidget(self.complex_comboBox, 1, 1, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.complex_widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label.setSizePolicy(sizePolicy)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout_2.addWidget(self.label, 0, 0, 1, 2)
|
||||||
|
self.gridLayout.addWidget(self.complex_widget, 5, 0, 1, 2)
|
||||||
|
self.use_function_button = QtWidgets.QToolButton(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.use_function_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.use_function_button.setSizePolicy(sizePolicy)
|
||||||
|
self.use_function_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.use_function_button.setAutoRaise(False)
|
||||||
|
self.use_function_button.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.use_function_button.setObjectName("use_function_button")
|
||||||
|
self.gridLayout.addWidget(self.use_function_button, 3, 1, 1, 1)
|
||||||
|
self.fitcomboBox = QtWidgets.QComboBox(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fitcomboBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fitcomboBox.setSizePolicy(sizePolicy)
|
||||||
|
self.fitcomboBox.setObjectName("fitcomboBox")
|
||||||
|
self.gridLayout.addWidget(self.fitcomboBox, 1, 0, 1, 2)
|
||||||
|
self.typecomboBox = QtWidgets.QComboBox(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.typecomboBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.typecomboBox.setSizePolicy(sizePolicy)
|
||||||
|
self.typecomboBox.setObjectName("typecomboBox")
|
||||||
|
self.gridLayout.addWidget(self.typecomboBox, 0, 0, 1, 2)
|
||||||
|
self.fitequation = QtWidgets.QLabel(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fitequation.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fitequation.setSizePolicy(sizePolicy)
|
||||||
|
self.fitequation.setWordWrap(True)
|
||||||
|
self.fitequation.setObjectName("fitequation")
|
||||||
|
self.gridLayout.addWidget(self.fitequation, 2, 0, 1, 2)
|
||||||
|
self.operator_combobox = QtWidgets.QComboBox(Form)
|
||||||
|
self.operator_combobox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||||
|
self.operator_combobox.setFrame(True)
|
||||||
|
self.operator_combobox.setObjectName("operator_combobox")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.operator_combobox, 3, 0, 1, 1)
|
||||||
|
self.use_combobox = QtWidgets.QComboBox(Form)
|
||||||
|
self.use_combobox.setObjectName("use_combobox")
|
||||||
|
self.gridLayout.addWidget(self.use_combobox, 6, 0, 1, 2)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.label_2.setText(_translate("Form", "Select part to fit"))
|
||||||
|
self.complex_comboBox.setItemText(0, _translate("Form", "Complex"))
|
||||||
|
self.complex_comboBox.setItemText(1, _translate("Form", "Real"))
|
||||||
|
self.complex_comboBox.setItemText(2, _translate("Form", "Imaginary"))
|
||||||
|
self.label.setText(_translate("Form", "Complex function found"))
|
||||||
|
self.use_function_button.setText(_translate("Form", "Use"))
|
||||||
|
self.fitequation.setText(_translate("Form", "Equation"))
|
||||||
|
self.operator_combobox.setItemText(0, _translate("Form", "Add"))
|
||||||
|
self.operator_combobox.setItemText(1, _translate("Form", "Multiply"))
|
||||||
|
self.operator_combobox.setItemText(2, _translate("Form", "Subtract"))
|
||||||
|
self.operator_combobox.setItemText(3, _translate("Form", "Divide by"))
|
||||||
|
from ..lib.expandablewidget import ExpandableWidget
|
70
nmreval/gui_qt/_py/fitfuncwidget.py
Normal file
70
nmreval/gui_qt/_py/fitfuncwidget.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitfuncwidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FormFit(object):
|
||||||
|
def setupUi(self, FormFit):
|
||||||
|
FormFit.setObjectName("FormFit")
|
||||||
|
FormFit.resize(292, 477)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(FormFit)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(FormFit)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.general_tab = QtWidgets.QWidget()
|
||||||
|
self.general_tab.setObjectName("general_tab")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.general_tab)
|
||||||
|
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_2.setSpacing(0)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.scrollArea = QtWidgets.QScrollArea(self.general_tab)
|
||||||
|
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.scrollArea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
|
||||||
|
self.scrollArea.setWidgetResizable(True)
|
||||||
|
self.scrollArea.setObjectName("scrollArea")
|
||||||
|
self.scrollwidget = QtWidgets.QWidget()
|
||||||
|
self.scrollwidget.setGeometry(QtCore.QRect(0, 0, 284, 442))
|
||||||
|
self.scrollwidget.setObjectName("scrollwidget")
|
||||||
|
self.scrollArea.setWidget(self.scrollwidget)
|
||||||
|
self.verticalLayout_2.addWidget(self.scrollArea)
|
||||||
|
self.tabWidget.addTab(self.general_tab, "")
|
||||||
|
self.data_tab = QtWidgets.QWidget()
|
||||||
|
self.data_tab.setObjectName("data_tab")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.data_tab)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.comboBox = QtWidgets.QComboBox(self.data_tab)
|
||||||
|
self.comboBox.setObjectName("comboBox")
|
||||||
|
self.verticalLayout_3.addWidget(self.comboBox)
|
||||||
|
self.scrollArea2 = QtWidgets.QScrollArea(self.data_tab)
|
||||||
|
self.scrollArea2.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.scrollArea2.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.scrollArea2.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
|
||||||
|
self.scrollArea2.setWidgetResizable(True)
|
||||||
|
self.scrollArea2.setObjectName("scrollArea2")
|
||||||
|
self.scrollwidget2 = QtWidgets.QWidget()
|
||||||
|
self.scrollwidget2.setGeometry(QtCore.QRect(0, 0, 272, 357))
|
||||||
|
self.scrollwidget2.setObjectName("scrollwidget2")
|
||||||
|
self.scrollArea2.setWidget(self.scrollwidget2)
|
||||||
|
self.verticalLayout_3.addWidget(self.scrollArea2)
|
||||||
|
self.tabWidget.addTab(self.data_tab, "")
|
||||||
|
self.verticalLayout.addWidget(self.tabWidget)
|
||||||
|
|
||||||
|
self.retranslateUi(FormFit)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FormFit)
|
||||||
|
|
||||||
|
def retranslateUi(self, FormFit):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FormFit.setWindowTitle(_translate("FormFit", "Form"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.general_tab), _translate("FormFit", "General settings"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.data_tab), _translate("FormFit", "Data parameter"))
|
86
nmreval/gui_qt/_py/fitfuncwidget_old.py
Normal file
86
nmreval/gui_qt/_py/fitfuncwidget_old.py
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitfuncwidget_old.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FormFit(object):
|
||||||
|
def setupUi(self, FormFit):
|
||||||
|
FormFit.setObjectName("FormFit")
|
||||||
|
FormFit.resize(402, 523)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(FormFit)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 6, 0, 0)
|
||||||
|
self.verticalLayout.setSpacing(6)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(FormFit)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.tabWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.general_tab = QtWidgets.QWidget()
|
||||||
|
self.general_tab.setObjectName("general_tab")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.general_tab)
|
||||||
|
self.verticalLayout_3.setContentsMargins(2, 2, 2, 2)
|
||||||
|
self.verticalLayout_3.setSpacing(2)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.scrollArea = QtWidgets.QScrollArea(self.general_tab)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth())
|
||||||
|
self.scrollArea.setSizePolicy(sizePolicy)
|
||||||
|
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
||||||
|
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
self.scrollArea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
|
||||||
|
self.scrollArea.setWidgetResizable(False)
|
||||||
|
self.scrollArea.setObjectName("scrollArea")
|
||||||
|
self.scrollwidget = QtWidgets.QWidget()
|
||||||
|
self.scrollwidget.setGeometry(QtCore.QRect(0, 0, 390, 478))
|
||||||
|
self.scrollwidget.setObjectName("scrollwidget")
|
||||||
|
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.scrollwidget)
|
||||||
|
self.verticalLayout_6.setObjectName("verticalLayout_6")
|
||||||
|
self.scrollArea.setWidget(self.scrollwidget)
|
||||||
|
self.verticalLayout_3.addWidget(self.scrollArea)
|
||||||
|
self.tabWidget.addTab(self.general_tab, "")
|
||||||
|
self.data_tab = QtWidgets.QWidget()
|
||||||
|
self.data_tab.setObjectName("data_tab")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.data_tab)
|
||||||
|
self.verticalLayout_2.setContentsMargins(2, 2, 2, 2)
|
||||||
|
self.verticalLayout_2.setSpacing(2)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.comboBox = QtWidgets.QComboBox(self.data_tab)
|
||||||
|
self.comboBox.setObjectName("comboBox")
|
||||||
|
self.verticalLayout_2.addWidget(self.comboBox)
|
||||||
|
self.scrollArea2 = QtWidgets.QScrollArea(self.data_tab)
|
||||||
|
self.scrollArea2.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.scrollArea2.setWidgetResizable(True)
|
||||||
|
self.scrollArea2.setObjectName("scrollArea2")
|
||||||
|
self.scrollwidget2 = QtWidgets.QWidget()
|
||||||
|
self.scrollwidget2.setGeometry(QtCore.QRect(0, 0, 390, 444))
|
||||||
|
self.scrollwidget2.setObjectName("scrollwidget2")
|
||||||
|
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.scrollwidget2)
|
||||||
|
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||||
|
self.scrollArea2.setWidget(self.scrollwidget2)
|
||||||
|
self.verticalLayout_2.addWidget(self.scrollArea2)
|
||||||
|
self.tabWidget.addTab(self.data_tab, "")
|
||||||
|
self.verticalLayout.addWidget(self.tabWidget)
|
||||||
|
|
||||||
|
self.retranslateUi(FormFit)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FormFit)
|
||||||
|
|
||||||
|
def retranslateUi(self, FormFit):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FormFit.setWindowTitle(_translate("FormFit", "Form"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.general_tab), _translate("FormFit", "General settings"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.data_tab), _translate("FormFit", "Data parameter"))
|
67
nmreval/gui_qt/_py/fitmodelfixwidget.py
Normal file
67
nmreval/gui_qt/_py/fitmodelfixwidget.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitmodelfixwidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FitFixParameter(object):
|
||||||
|
def setupUi(self, FitFixParameter):
|
||||||
|
FitFixParameter.setObjectName("FitFixParameter")
|
||||||
|
FitFixParameter.setWindowModality(QtCore.Qt.WindowModal)
|
||||||
|
FitFixParameter.resize(480, 267)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(FitFixParameter.sizePolicy().hasHeightForWidth())
|
||||||
|
FitFixParameter.setSizePolicy(sizePolicy)
|
||||||
|
FitFixParameter.setAutoFillBackground(True)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(FitFixParameter)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.frame = QtWidgets.QFrame(FitFixParameter)
|
||||||
|
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.frame.setObjectName("frame")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 3, 0)
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.parametername = QtWidgets.QLabel(self.frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(1)
|
||||||
|
sizePolicy.setVerticalStretch(10)
|
||||||
|
sizePolicy.setHeightForWidth(self.parametername.sizePolicy().hasHeightForWidth())
|
||||||
|
self.parametername.setSizePolicy(sizePolicy)
|
||||||
|
self.parametername.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.parametername.setIndent(6)
|
||||||
|
self.parametername.setObjectName("parametername")
|
||||||
|
self.horizontalLayout.addWidget(self.parametername)
|
||||||
|
self.label = QtWidgets.QLabel(self.frame)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout.addWidget(self.label)
|
||||||
|
self.gridLayout.addWidget(self.frame, 1, 0, 1, 1)
|
||||||
|
self.parameter_line = QtWidgets.QLineEdit(FitFixParameter)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.parameter_line.sizePolicy().hasHeightForWidth())
|
||||||
|
self.parameter_line.setSizePolicy(sizePolicy)
|
||||||
|
self.parameter_line.setObjectName("parameter_line")
|
||||||
|
self.gridLayout.addWidget(self.parameter_line, 1, 1, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(FitFixParameter)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FitFixParameter)
|
||||||
|
|
||||||
|
def retranslateUi(self, FitFixParameter):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FitFixParameter.setWindowTitle(_translate("FitFixParameter", "Form"))
|
||||||
|
self.parametername.setText(_translate("FitFixParameter", "Parameter"))
|
||||||
|
self.label.setText(_translate("FitFixParameter", "Unit"))
|
||||||
|
self.parameter_line.setText(_translate("FitFixParameter", "1"))
|
135
nmreval/gui_qt/_py/fitmodelwidget.py
Normal file
135
nmreval/gui_qt/_py/fitmodelwidget.py
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitmodelwidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FitParameter(object):
|
||||||
|
def setupUi(self, FitParameter):
|
||||||
|
FitParameter.setObjectName("FitParameter")
|
||||||
|
FitParameter.resize(365, 78)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(FitParameter.sizePolicy().hasHeightForWidth())
|
||||||
|
FitParameter.setSizePolicy(sizePolicy)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(FitParameter)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setSpacing(1)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setSpacing(3)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.parametername = QtWidgets.QLabel(FitParameter)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.parametername.sizePolicy().hasHeightForWidth())
|
||||||
|
self.parametername.setSizePolicy(sizePolicy)
|
||||||
|
self.parametername.setMinimumSize(QtCore.QSize(28, 0))
|
||||||
|
self.parametername.setObjectName("parametername")
|
||||||
|
self.horizontalLayout_2.addWidget(self.parametername)
|
||||||
|
self.parameter_line = LineEdit(FitParameter)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.parameter_line.sizePolicy().hasHeightForWidth())
|
||||||
|
self.parameter_line.setSizePolicy(sizePolicy)
|
||||||
|
self.parameter_line.setText("")
|
||||||
|
self.parameter_line.setObjectName("parameter_line")
|
||||||
|
self.horizontalLayout_2.addWidget(self.parameter_line)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem)
|
||||||
|
self.fixed_check = QtWidgets.QCheckBox(FitParameter)
|
||||||
|
self.fixed_check.setObjectName("fixed_check")
|
||||||
|
self.horizontalLayout_2.addWidget(self.fixed_check)
|
||||||
|
self.global_checkbox = QtWidgets.QCheckBox(FitParameter)
|
||||||
|
self.global_checkbox.setObjectName("global_checkbox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.global_checkbox)
|
||||||
|
self.toolButton = QtWidgets.QToolButton(FitParameter)
|
||||||
|
self.toolButton.setText("")
|
||||||
|
self.toolButton.setPopupMode(QtWidgets.QToolButton.InstantPopup)
|
||||||
|
self.toolButton.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.toolButton.setObjectName("toolButton")
|
||||||
|
self.horizontalLayout_2.addWidget(self.toolButton)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
|
self.frame = QtWidgets.QFrame(FitParameter)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame.setSizePolicy(sizePolicy)
|
||||||
|
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.frame.setObjectName("frame")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.checkBox = QtWidgets.QCheckBox(self.frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.checkBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.checkBox.setSizePolicy(sizePolicy)
|
||||||
|
self.checkBox.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||||
|
self.checkBox.setText("")
|
||||||
|
self.checkBox.setObjectName("checkBox")
|
||||||
|
self.horizontalLayout.addWidget(self.checkBox)
|
||||||
|
self.lineEdit = QtWidgets.QLineEdit(self.frame)
|
||||||
|
self.lineEdit.setEnabled(False)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.lineEdit.setSizePolicy(sizePolicy)
|
||||||
|
self.lineEdit.setText("")
|
||||||
|
self.lineEdit.setFrame(True)
|
||||||
|
self.lineEdit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
|
||||||
|
self.lineEdit.setObjectName("lineEdit")
|
||||||
|
self.horizontalLayout.addWidget(self.lineEdit)
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.frame)
|
||||||
|
self.label_3.setEnabled(True)
|
||||||
|
self.label_3.setTextFormat(QtCore.Qt.RichText)
|
||||||
|
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.horizontalLayout.addWidget(self.label_3)
|
||||||
|
self.lineEdit_2 = QtWidgets.QLineEdit(self.frame)
|
||||||
|
self.lineEdit_2.setEnabled(False)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.lineEdit_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.lineEdit_2.setSizePolicy(sizePolicy)
|
||||||
|
self.lineEdit_2.setText("")
|
||||||
|
self.lineEdit_2.setFrame(True)
|
||||||
|
self.lineEdit_2.setObjectName("lineEdit_2")
|
||||||
|
self.horizontalLayout.addWidget(self.lineEdit_2)
|
||||||
|
self.verticalLayout.addWidget(self.frame)
|
||||||
|
self.line = QtWidgets.QFrame(FitParameter)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.verticalLayout.addWidget(self.line)
|
||||||
|
|
||||||
|
self.retranslateUi(FitParameter)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FitParameter)
|
||||||
|
|
||||||
|
def retranslateUi(self, FitParameter):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FitParameter.setWindowTitle(_translate("FitParameter", "Form"))
|
||||||
|
self.parametername.setText(_translate("FitParameter", "A"))
|
||||||
|
self.parameter_line.setToolTip(_translate("FitParameter", "Initial values"))
|
||||||
|
self.parameter_line.setPlaceholderText(_translate("FitParameter", "0"))
|
||||||
|
self.fixed_check.setText(_translate("FitParameter", "Fix"))
|
||||||
|
self.global_checkbox.setText(_translate("FitParameter", "Global"))
|
||||||
|
self.lineEdit.setToolTip(_translate("FitParameter", "<html><head/><body><p>Lower bound. Same bound is used for all data. Leave empty for no boundary condition.</p></body></html>"))
|
||||||
|
self.label_3.setText(_translate("FitParameter", "Textlabel"))
|
||||||
|
self.lineEdit_2.setToolTip(_translate("FitParameter", "<html><head/><body><p>Upper bound. Same bound is used for all data. Leave empty for no boundary condition.</p></body></html>"))
|
||||||
|
from ..lib.forms import LineEdit
|
50
nmreval/gui_qt/_py/fitparametertable.py
Normal file
50
nmreval/gui_qt/_py/fitparametertable.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitparametertable.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FitParameterDialog(object):
|
||||||
|
def setupUi(self, FitParameterDialog):
|
||||||
|
FitParameterDialog.setObjectName("FitParameterDialog")
|
||||||
|
FitParameterDialog.resize(898, 583)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(FitParameterDialog)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.verticalLayout.addLayout(self.verticalLayout_2)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.pushButton = QtWidgets.QPushButton(FitParameterDialog)
|
||||||
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.horizontalLayout.addWidget(self.pushButton)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(FitParameterDialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.buttonBox.setSizePolicy(sizePolicy)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
|
||||||
|
self.buttonBox.setCenterButtons(False)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.horizontalLayout.addWidget(self.buttonBox)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
|
||||||
|
self.retranslateUi(FitParameterDialog)
|
||||||
|
self.buttonBox.accepted.connect(FitParameterDialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(FitParameterDialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FitParameterDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, FitParameterDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FitParameterDialog.setWindowTitle(_translate("FitParameterDialog", "Fitparameter"))
|
||||||
|
self.pushButton.setText(_translate("FitParameterDialog", "Copy"))
|
70
nmreval/gui_qt/_py/fitparameterwidget.py
Normal file
70
nmreval/gui_qt/_py/fitparameterwidget.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitparameterwidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_FormFit(object):
|
||||||
|
def setupUi(self, FormFit):
|
||||||
|
FormFit.setObjectName("FormFit")
|
||||||
|
FormFit.resize(292, 477)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(FormFit)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(FormFit)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.general_tab = QtWidgets.QWidget()
|
||||||
|
self.general_tab.setObjectName("general_tab")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.general_tab)
|
||||||
|
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_2.setSpacing(0)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.scrollArea = QtWidgets.QScrollArea(self.general_tab)
|
||||||
|
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.scrollArea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
|
||||||
|
self.scrollArea.setWidgetResizable(True)
|
||||||
|
self.scrollArea.setObjectName("scrollArea")
|
||||||
|
self.scrollwidget = QtWidgets.QWidget()
|
||||||
|
self.scrollwidget.setGeometry(QtCore.QRect(0, 0, 284, 442))
|
||||||
|
self.scrollwidget.setObjectName("scrollwidget")
|
||||||
|
self.scrollArea.setWidget(self.scrollwidget)
|
||||||
|
self.verticalLayout_2.addWidget(self.scrollArea)
|
||||||
|
self.tabWidget.addTab(self.general_tab, "")
|
||||||
|
self.data_tab = QtWidgets.QWidget()
|
||||||
|
self.data_tab.setObjectName("data_tab")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.data_tab)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.comboBox = QtWidgets.QComboBox(self.data_tab)
|
||||||
|
self.comboBox.setObjectName("comboBox")
|
||||||
|
self.verticalLayout_3.addWidget(self.comboBox)
|
||||||
|
self.scrollArea2 = QtWidgets.QScrollArea(self.data_tab)
|
||||||
|
self.scrollArea2.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.scrollArea2.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||||
|
self.scrollArea2.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
|
||||||
|
self.scrollArea2.setWidgetResizable(True)
|
||||||
|
self.scrollArea2.setObjectName("scrollArea2")
|
||||||
|
self.scrollwidget2 = QtWidgets.QWidget()
|
||||||
|
self.scrollwidget2.setGeometry(QtCore.QRect(0, 0, 272, 392))
|
||||||
|
self.scrollwidget2.setObjectName("scrollwidget2")
|
||||||
|
self.scrollArea2.setWidget(self.scrollwidget2)
|
||||||
|
self.verticalLayout_3.addWidget(self.scrollArea2)
|
||||||
|
self.tabWidget.addTab(self.data_tab, "")
|
||||||
|
self.verticalLayout.addWidget(self.tabWidget)
|
||||||
|
|
||||||
|
self.retranslateUi(FormFit)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(FormFit)
|
||||||
|
|
||||||
|
def retranslateUi(self, FormFit):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
FormFit.setWindowTitle(_translate("FormFit", "Form"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.general_tab), _translate("FormFit", "General settings"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.data_tab), _translate("FormFit", "Data parameter"))
|
180
nmreval/gui_qt/_py/fitresult.py
Normal file
180
nmreval/gui_qt/_py/fitresult.py
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/fitresult.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(817, 584)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.sets_comboBox = ElideComboBox(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.sets_comboBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.sets_comboBox.setSizePolicy(sizePolicy)
|
||||||
|
self.sets_comboBox.setMaximumSize(QtCore.QSize(400, 16777215))
|
||||||
|
self.sets_comboBox.setBaseSize(QtCore.QSize(200, 0))
|
||||||
|
self.sets_comboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
|
||||||
|
self.sets_comboBox.setObjectName("sets_comboBox")
|
||||||
|
self.gridLayout.addWidget(self.sets_comboBox, 0, 0, 1, 1)
|
||||||
|
self.stack = QtWidgets.QToolBox(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.stack.sizePolicy().hasHeightForWidth())
|
||||||
|
self.stack.setSizePolicy(sizePolicy)
|
||||||
|
self.stack.setObjectName("stack")
|
||||||
|
self.page = QtWidgets.QWidget()
|
||||||
|
self.page.setGeometry(QtCore.QRect(0, 0, 399, 414))
|
||||||
|
self.page.setObjectName("page")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.page)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.graphicsView = GraphicsLayoutWidget(self.page)
|
||||||
|
self.graphicsView.setObjectName("graphicsView")
|
||||||
|
self.verticalLayout.addWidget(self.graphicsView)
|
||||||
|
self.logy_box = QtWidgets.QCheckBox(self.page)
|
||||||
|
self.logy_box.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||||
|
self.logy_box.setObjectName("logy_box")
|
||||||
|
self.verticalLayout.addWidget(self.logy_box)
|
||||||
|
self.stack.addItem(self.page, "")
|
||||||
|
self.page_2 = QtWidgets.QWidget()
|
||||||
|
self.page_2.setGeometry(QtCore.QRect(0, 0, 399, 414))
|
||||||
|
self.page_2.setObjectName("page_2")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.page_2)
|
||||||
|
self.verticalLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_2.setSpacing(3)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.stats_tableWidget = QtWidgets.QTableWidget(self.page_2)
|
||||||
|
self.stats_tableWidget.setFrameShape(QtWidgets.QFrame.Box)
|
||||||
|
self.stats_tableWidget.setGridStyle(QtCore.Qt.NoPen)
|
||||||
|
self.stats_tableWidget.setColumnCount(1)
|
||||||
|
self.stats_tableWidget.setObjectName("stats_tableWidget")
|
||||||
|
self.stats_tableWidget.setRowCount(0)
|
||||||
|
self.stats_tableWidget.horizontalHeader().setVisible(False)
|
||||||
|
self.stats_tableWidget.horizontalHeader().setSortIndicatorShown(True)
|
||||||
|
self.verticalLayout_2.addWidget(self.stats_tableWidget)
|
||||||
|
self.stack.addItem(self.page_2, "")
|
||||||
|
self.page_3 = QtWidgets.QWidget()
|
||||||
|
self.page_3.setGeometry(QtCore.QRect(0, 0, 399, 414))
|
||||||
|
self.page_3.setObjectName("page_3")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.page_3)
|
||||||
|
self.verticalLayout_3.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout_3.setSpacing(3)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.corr_tableWidget = QtWidgets.QTableWidget(self.page_3)
|
||||||
|
self.corr_tableWidget.setFrameShape(QtWidgets.QFrame.Box)
|
||||||
|
self.corr_tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.corr_tableWidget.setGridStyle(QtCore.Qt.NoPen)
|
||||||
|
self.corr_tableWidget.setObjectName("corr_tableWidget")
|
||||||
|
self.corr_tableWidget.setColumnCount(4)
|
||||||
|
self.corr_tableWidget.setRowCount(0)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.corr_tableWidget.setHorizontalHeaderItem(0, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.corr_tableWidget.setHorizontalHeaderItem(1, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.corr_tableWidget.setHorizontalHeaderItem(2, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.corr_tableWidget.setHorizontalHeaderItem(3, item)
|
||||||
|
self.corr_tableWidget.horizontalHeader().setStretchLastSection(True)
|
||||||
|
self.corr_tableWidget.verticalHeader().setVisible(False)
|
||||||
|
self.verticalLayout_3.addWidget(self.corr_tableWidget)
|
||||||
|
self.stack.addItem(self.page_3, "")
|
||||||
|
self.gridLayout.addWidget(self.stack, 0, 1, 4, 1)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.partial_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.partial_checkBox.setObjectName("partial_checkBox")
|
||||||
|
self.horizontalLayout.addWidget(self.partial_checkBox)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.label_2 = QtWidgets.QLabel(Dialog)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.horizontalLayout.addWidget(self.label_2)
|
||||||
|
self.graph_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.graph_checkBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.graph_checkBox.setSizePolicy(sizePolicy)
|
||||||
|
self.graph_checkBox.setChecked(True)
|
||||||
|
self.graph_checkBox.setObjectName("graph_checkBox")
|
||||||
|
self.horizontalLayout.addWidget(self.graph_checkBox)
|
||||||
|
self.graph_comboBox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.graph_comboBox.setEnabled(False)
|
||||||
|
self.graph_comboBox.setObjectName("graph_comboBox")
|
||||||
|
self.horizontalLayout.addWidget(self.graph_comboBox)
|
||||||
|
self.gridLayout.addLayout(self.horizontalLayout, 5, 0, 1, 2)
|
||||||
|
self.line_2 = QtWidgets.QFrame(Dialog)
|
||||||
|
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.gridLayout.addWidget(self.line_2, 3, 0, 1, 1)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setSpacing(3)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.reject_fit_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.reject_fit_checkBox.setObjectName("reject_fit_checkBox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.reject_fit_checkBox)
|
||||||
|
self.del_prev_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.del_prev_checkBox.setObjectName("del_prev_checkBox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.del_prev_checkBox)
|
||||||
|
self.gridLayout.addLayout(self.horizontalLayout_2, 2, 0, 1, 1)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Retry)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 6, 0, 1, 2)
|
||||||
|
self.param_tableWidget = QtWidgets.QTableWidget(Dialog)
|
||||||
|
self.param_tableWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
||||||
|
self.param_tableWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustIgnored)
|
||||||
|
self.param_tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.param_tableWidget.setAlternatingRowColors(True)
|
||||||
|
self.param_tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
|
self.param_tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectColumns)
|
||||||
|
self.param_tableWidget.setShowGrid(False)
|
||||||
|
self.param_tableWidget.setColumnCount(0)
|
||||||
|
self.param_tableWidget.setObjectName("param_tableWidget")
|
||||||
|
self.param_tableWidget.setRowCount(0)
|
||||||
|
self.param_tableWidget.horizontalHeader().setStretchLastSection(False)
|
||||||
|
self.gridLayout.addWidget(self.param_tableWidget, 1, 0, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.stack.setCurrentIndex(0)
|
||||||
|
self.stack.layout().setSpacing(0)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Fit results"))
|
||||||
|
self.logy_box.setText(_translate("Dialog", "logarithmic y axis"))
|
||||||
|
self.stack.setItemText(self.stack.indexOf(self.page), _translate("Dialog", "Plot"))
|
||||||
|
self.stack.setItemText(self.stack.indexOf(self.page_2), _translate("Dialog", "Statistics"))
|
||||||
|
item = self.corr_tableWidget.horizontalHeaderItem(0)
|
||||||
|
item.setText(_translate("Dialog", "Parameter 1"))
|
||||||
|
item = self.corr_tableWidget.horizontalHeaderItem(1)
|
||||||
|
item.setText(_translate("Dialog", "Parameter 2"))
|
||||||
|
item = self.corr_tableWidget.horizontalHeaderItem(2)
|
||||||
|
item.setText(_translate("Dialog", "Corr."))
|
||||||
|
item = self.corr_tableWidget.horizontalHeaderItem(3)
|
||||||
|
item.setText(_translate("Dialog", "Partial Corr."))
|
||||||
|
self.stack.setItemText(self.stack.indexOf(self.page_3), _translate("Dialog", "Correlations"))
|
||||||
|
self.partial_checkBox.setText(_translate("Dialog", "Plot partial functions"))
|
||||||
|
self.label_2.setText(_translate("Dialog", "Location of parameters:"))
|
||||||
|
self.graph_checkBox.setText(_translate("Dialog", "New graph"))
|
||||||
|
self.reject_fit_checkBox.setText(_translate("Dialog", "Reject this fit"))
|
||||||
|
self.del_prev_checkBox.setText(_translate("Dialog", "Delete previous fits"))
|
||||||
|
from ..lib.forms import ElideComboBox
|
||||||
|
from pyqtgraph import GraphicsLayoutWidget
|
58
nmreval/gui_qt/_py/ftdialog.py
Normal file
58
nmreval/gui_qt/_py/ftdialog.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/ftdialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(400, 300)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.listWidget = QtWidgets.QListWidget(Dialog)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.verticalLayout.addWidget(self.listWidget)
|
||||||
|
self.mode_comboBox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.mode_comboBox.setObjectName("mode_comboBox")
|
||||||
|
self.mode_comboBox.addItem("")
|
||||||
|
self.mode_comboBox.addItem("")
|
||||||
|
self.mode_comboBox.addItem("")
|
||||||
|
self.verticalLayout.addWidget(self.mode_comboBox)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.graph_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.graph_checkBox.setObjectName("graph_checkBox")
|
||||||
|
self.horizontalLayout.addWidget(self.graph_checkBox)
|
||||||
|
self.graph_comboBox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.graph_comboBox.setObjectName("graph_comboBox")
|
||||||
|
self.horizontalLayout.addWidget(self.graph_comboBox)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Logarithmic Fourier"))
|
||||||
|
self.mode_comboBox.setItemText(0, _translate("Dialog", "Real"))
|
||||||
|
self.mode_comboBox.setItemText(1, _translate("Dialog", "Imag"))
|
||||||
|
self.mode_comboBox.setItemText(2, _translate("Dialog", "Complex"))
|
||||||
|
self.graph_checkBox.setText(_translate("Dialog", "New graph"))
|
123
nmreval/gui_qt/_py/function_tree_widget.py
Normal file
123
nmreval/gui_qt/_py/function_tree_widget.py
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/function_tree_widget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(314, 232)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
|
||||||
|
Form.setSizePolicy(sizePolicy)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(3)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.widget_2 = ExpandableWidget(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.widget_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.widget_2.setSizePolicy(sizePolicy)
|
||||||
|
self.widget_2.setObjectName("widget_2")
|
||||||
|
self.gridLayout.addWidget(self.widget_2, 4, 0, 1, 2)
|
||||||
|
self.widget = QtWidgets.QWidget(Form)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.widget)
|
||||||
|
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout_2.addWidget(self.label_2, 1, 0, 1, 1)
|
||||||
|
self.complex_comboBox = QtWidgets.QComboBox(self.widget)
|
||||||
|
self.complex_comboBox.setObjectName("complex_comboBox")
|
||||||
|
self.complex_comboBox.addItem("")
|
||||||
|
self.complex_comboBox.addItem("")
|
||||||
|
self.complex_comboBox.addItem("")
|
||||||
|
self.gridLayout_2.addWidget(self.complex_comboBox, 1, 1, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label.setSizePolicy(sizePolicy)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout_2.addWidget(self.label, 0, 0, 1, 2)
|
||||||
|
self.gridLayout.addWidget(self.widget, 5, 0, 1, 2)
|
||||||
|
self.use_function_button = QtWidgets.QToolButton(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.use_function_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.use_function_button.setSizePolicy(sizePolicy)
|
||||||
|
self.use_function_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.use_function_button.setAutoRaise(False)
|
||||||
|
self.use_function_button.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.use_function_button.setObjectName("use_function_button")
|
||||||
|
self.gridLayout.addWidget(self.use_function_button, 3, 1, 1, 1)
|
||||||
|
self.fitcomboBox = QtWidgets.QComboBox(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fitcomboBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fitcomboBox.setSizePolicy(sizePolicy)
|
||||||
|
self.fitcomboBox.setObjectName("fitcomboBox")
|
||||||
|
self.gridLayout.addWidget(self.fitcomboBox, 1, 0, 1, 2)
|
||||||
|
self.typecomboBox = QtWidgets.QComboBox(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.typecomboBox.sizePolicy().hasHeightForWidth())
|
||||||
|
self.typecomboBox.setSizePolicy(sizePolicy)
|
||||||
|
self.typecomboBox.setObjectName("typecomboBox")
|
||||||
|
self.gridLayout.addWidget(self.typecomboBox, 0, 0, 1, 2)
|
||||||
|
self.fitequation = QtWidgets.QLabel(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.fitequation.sizePolicy().hasHeightForWidth())
|
||||||
|
self.fitequation.setSizePolicy(sizePolicy)
|
||||||
|
self.fitequation.setWordWrap(True)
|
||||||
|
self.fitequation.setObjectName("fitequation")
|
||||||
|
self.gridLayout.addWidget(self.fitequation, 2, 0, 1, 2)
|
||||||
|
self.operator_combobox = QtWidgets.QComboBox(Form)
|
||||||
|
self.operator_combobox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||||
|
self.operator_combobox.setFrame(True)
|
||||||
|
self.operator_combobox.setObjectName("operator_combobox")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.operator_combobox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.operator_combobox, 3, 0, 1, 1)
|
||||||
|
self.comboBox_2 = QtWidgets.QComboBox(Form)
|
||||||
|
self.comboBox_2.setObjectName("comboBox_2")
|
||||||
|
self.gridLayout.addWidget(self.comboBox_2, 6, 0, 1, 2)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.label_2.setText(_translate("Form", "Select part to fit"))
|
||||||
|
self.complex_comboBox.setItemText(0, _translate("Form", "Complex"))
|
||||||
|
self.complex_comboBox.setItemText(1, _translate("Form", "Real"))
|
||||||
|
self.complex_comboBox.setItemText(2, _translate("Form", "Imaginary"))
|
||||||
|
self.label.setText(_translate("Form", "Complex function found"))
|
||||||
|
self.use_function_button.setText(_translate("Form", "Use"))
|
||||||
|
self.fitequation.setText(_translate("Form", "Equation"))
|
||||||
|
self.operator_combobox.setItemText(0, _translate("Form", "Add"))
|
||||||
|
self.operator_combobox.setItemText(1, _translate("Form", "Multiply"))
|
||||||
|
self.operator_combobox.setItemText(2, _translate("Form", "Subtract"))
|
||||||
|
self.operator_combobox.setItemText(3, _translate("Form", "Divide by"))
|
||||||
|
from ..lib.expandablewidget import ExpandableWidget
|
276
nmreval/gui_qt/_py/gol.py
Normal file
276
nmreval/gui_qt/_py/gol.py
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/gol.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(883, 732)
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.widget = QtWidgets.QWidget(Form)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget)
|
||||||
|
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.vanish_shadow = QtWidgets.QRadioButton(self.widget)
|
||||||
|
self.vanish_shadow.setChecked(True)
|
||||||
|
self.vanish_shadow.setObjectName("vanish_shadow")
|
||||||
|
self.buttonGroup = QtWidgets.QButtonGroup(Form)
|
||||||
|
self.buttonGroup.setObjectName("buttonGroup")
|
||||||
|
self.buttonGroup.addButton(self.vanish_shadow)
|
||||||
|
self.verticalLayout_3.addWidget(self.vanish_shadow)
|
||||||
|
self.full_shadow = QtWidgets.QRadioButton(self.widget)
|
||||||
|
self.full_shadow.setObjectName("full_shadow")
|
||||||
|
self.buttonGroup.addButton(self.full_shadow)
|
||||||
|
self.verticalLayout_3.addWidget(self.full_shadow)
|
||||||
|
self.radioButton = QtWidgets.QRadioButton(self.widget)
|
||||||
|
self.radioButton.setObjectName("radioButton")
|
||||||
|
self.buttonGroup.addButton(self.radioButton)
|
||||||
|
self.verticalLayout_3.addWidget(self.radioButton)
|
||||||
|
self.line = QtWidgets.QFrame(self.widget)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.verticalLayout_3.addWidget(self.line)
|
||||||
|
self.faster_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.faster_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.faster_button.setSizePolicy(sizePolicy)
|
||||||
|
self.faster_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.faster_button.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.faster_button.setObjectName("faster_button")
|
||||||
|
self.verticalLayout_3.addWidget(self.faster_button)
|
||||||
|
self.velocity_label = QtWidgets.QLabel(self.widget)
|
||||||
|
self.velocity_label.setObjectName("velocity_label")
|
||||||
|
self.verticalLayout_3.addWidget(self.velocity_label)
|
||||||
|
self.slower_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.slower_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.slower_button.setSizePolicy(sizePolicy)
|
||||||
|
self.slower_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.slower_button.setArrowType(QtCore.Qt.LeftArrow)
|
||||||
|
self.slower_button.setObjectName("slower_button")
|
||||||
|
self.verticalLayout_3.addWidget(self.slower_button)
|
||||||
|
self.current_step = QtWidgets.QLabel(self.widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.current_step.sizePolicy().hasHeightForWidth())
|
||||||
|
self.current_step.setSizePolicy(sizePolicy)
|
||||||
|
self.current_step.setObjectName("current_step")
|
||||||
|
self.verticalLayout_3.addWidget(self.current_step)
|
||||||
|
self.pause_button = QtWidgets.QPushButton(self.widget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.pause_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.pause_button.setSizePolicy(sizePolicy)
|
||||||
|
self.pause_button.setCheckable(True)
|
||||||
|
self.pause_button.setObjectName("pause_button")
|
||||||
|
self.verticalLayout_3.addWidget(self.pause_button)
|
||||||
|
self.line_3 = QtWidgets.QFrame(self.widget)
|
||||||
|
self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_3.setObjectName("line_3")
|
||||||
|
self.verticalLayout_3.addWidget(self.line_3)
|
||||||
|
self.label_6 = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.verticalLayout_3.addWidget(self.label_6)
|
||||||
|
self.cover_label = QtWidgets.QLabel(self.widget)
|
||||||
|
self.cover_label.setText("")
|
||||||
|
self.cover_label.setObjectName("cover_label")
|
||||||
|
self.verticalLayout_3.addWidget(self.cover_label)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout_3.addItem(spacerItem)
|
||||||
|
self.gridLayout_2.addWidget(self.widget, 0, 0, 1, 1)
|
||||||
|
self.view = QtWidgets.QGraphicsView(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.view.sizePolicy().hasHeightForWidth())
|
||||||
|
self.view.setSizePolicy(sizePolicy)
|
||||||
|
self.view.setStyleSheet("background-color: transparent")
|
||||||
|
self.view.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
self.view.setObjectName("view")
|
||||||
|
self.gridLayout_2.addWidget(self.view, 0, 1, 1, 1)
|
||||||
|
self.option_frame = QtWidgets.QFrame(Form)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.option_frame.sizePolicy().hasHeightForWidth())
|
||||||
|
self.option_frame.setSizePolicy(sizePolicy)
|
||||||
|
self.option_frame.setFrameShape(QtWidgets.QFrame.Box)
|
||||||
|
self.option_frame.setObjectName("option_frame")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.option_frame)
|
||||||
|
self.gridLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout.setHorizontalSpacing(6)
|
||||||
|
self.gridLayout.setVerticalSpacing(3)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.rule_label = QtWidgets.QLabel(self.option_frame)
|
||||||
|
self.rule_label.setObjectName("rule_label")
|
||||||
|
self.horizontalLayout_2.addWidget(self.rule_label)
|
||||||
|
self.rule_cb = QtWidgets.QComboBox(self.option_frame)
|
||||||
|
self.rule_cb.setObjectName("rule_cb")
|
||||||
|
self.horizontalLayout_2.addWidget(self.rule_cb)
|
||||||
|
self.gridLayout.addLayout(self.horizontalLayout_2, 3, 0, 1, 1)
|
||||||
|
self.line_2 = QtWidgets.QFrame(self.option_frame)
|
||||||
|
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.gridLayout.addWidget(self.line_2, 2, 0, 1, 1)
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_2.setContentsMargins(-1, 0, -1, 0)
|
||||||
|
self.verticalLayout_2.setSpacing(3)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.object_widget = QtWidgets.QWidget(self.option_frame)
|
||||||
|
self.object_widget.setObjectName("object_widget")
|
||||||
|
self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.object_widget)
|
||||||
|
self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_6.setSpacing(3)
|
||||||
|
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.object_widget)
|
||||||
|
self.label_5.setObjectName("label_5")
|
||||||
|
self.horizontalLayout_6.addWidget(self.label_5)
|
||||||
|
self.object_size = QtWidgets.QSpinBox(self.object_widget)
|
||||||
|
self.object_size.setMinimum(1)
|
||||||
|
self.object_size.setMaximum(600)
|
||||||
|
self.object_size.setObjectName("object_size")
|
||||||
|
self.horizontalLayout_6.addWidget(self.object_size)
|
||||||
|
self.verticalLayout_2.addWidget(self.object_widget)
|
||||||
|
self.rand_button_wdgt = QtWidgets.QWidget(self.option_frame)
|
||||||
|
self.rand_button_wdgt.setObjectName("rand_button_wdgt")
|
||||||
|
self.horizontalLayout_7 = QtWidgets.QHBoxLayout(self.rand_button_wdgt)
|
||||||
|
self.horizontalLayout_7.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_7.setSpacing(3)
|
||||||
|
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||||
|
self.add_random_button = QtWidgets.QPushButton(self.rand_button_wdgt)
|
||||||
|
self.add_random_button.setObjectName("add_random_button")
|
||||||
|
self.horizontalLayout_7.addWidget(self.add_random_button)
|
||||||
|
self.remove_random_button = QtWidgets.QPushButton(self.rand_button_wdgt)
|
||||||
|
self.remove_random_button.setObjectName("remove_random_button")
|
||||||
|
self.horizontalLayout_7.addWidget(self.remove_random_button)
|
||||||
|
self.verticalLayout_2.addWidget(self.rand_button_wdgt)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.verticalLayout_2.addLayout(self.verticalLayout)
|
||||||
|
self.gridLayout.addLayout(self.verticalLayout_2, 2, 1, 4, 1)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.option_frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_3.setSizePolicy(sizePolicy)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.horizontalLayout.addWidget(self.label_3)
|
||||||
|
self.survival_line = QtWidgets.QLineEdit(self.option_frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.survival_line.sizePolicy().hasHeightForWidth())
|
||||||
|
self.survival_line.setSizePolicy(sizePolicy)
|
||||||
|
self.survival_line.setObjectName("survival_line")
|
||||||
|
self.horizontalLayout.addWidget(self.survival_line)
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.option_frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_4.setSizePolicy(sizePolicy)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.horizontalLayout.addWidget(self.label_4)
|
||||||
|
self.birth_line = QtWidgets.QLineEdit(self.option_frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.birth_line.sizePolicy().hasHeightForWidth())
|
||||||
|
self.birth_line.setSizePolicy(sizePolicy)
|
||||||
|
self.birth_line.setObjectName("birth_line")
|
||||||
|
self.horizontalLayout.addWidget(self.birth_line)
|
||||||
|
self.gridLayout.addLayout(self.horizontalLayout, 4, 0, 1, 1)
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.label = QtWidgets.QLabel(self.option_frame)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label)
|
||||||
|
self.width_box = QtWidgets.QSpinBox(self.option_frame)
|
||||||
|
self.width_box.setMaximum(600)
|
||||||
|
self.width_box.setProperty("value", 100)
|
||||||
|
self.width_box.setObjectName("width_box")
|
||||||
|
self.horizontalLayout_3.addWidget(self.width_box)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.option_frame)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_2)
|
||||||
|
self.height_box = QtWidgets.QSpinBox(self.option_frame)
|
||||||
|
self.height_box.setMaximum(600)
|
||||||
|
self.height_box.setProperty("value", 100)
|
||||||
|
self.height_box.setObjectName("height_box")
|
||||||
|
self.horizontalLayout_3.addWidget(self.height_box)
|
||||||
|
self.gridLayout.addLayout(self.horizontalLayout_3, 1, 0, 1, 1)
|
||||||
|
self.object_combobox = QtWidgets.QComboBox(self.option_frame)
|
||||||
|
self.object_combobox.setObjectName("object_combobox")
|
||||||
|
self.object_combobox.addItem("")
|
||||||
|
self.object_combobox.addItem("")
|
||||||
|
self.object_combobox.addItem("")
|
||||||
|
self.object_combobox.addItem("")
|
||||||
|
self.object_combobox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.object_combobox, 1, 1, 1, 1)
|
||||||
|
self.start_button = QtWidgets.QPushButton(self.option_frame)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.start_button.sizePolicy().hasHeightForWidth())
|
||||||
|
self.start_button.setSizePolicy(sizePolicy)
|
||||||
|
self.start_button.setObjectName("start_button")
|
||||||
|
self.gridLayout.addWidget(self.start_button, 0, 0, 1, 2)
|
||||||
|
self.gridLayout_2.addWidget(self.option_frame, 1, 1, 1, 1)
|
||||||
|
self.hide_button = QtWidgets.QCheckBox(Form)
|
||||||
|
self.hide_button.setObjectName("hide_button")
|
||||||
|
self.gridLayout_2.addWidget(self.hide_button, 1, 0, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Game Of Life"))
|
||||||
|
self.vanish_shadow.setText(_translate("Form", "Motion blur"))
|
||||||
|
self.full_shadow.setText(_translate("Form", "Scorched earth"))
|
||||||
|
self.radioButton.setText(_translate("Form", "Nothing"))
|
||||||
|
self.faster_button.setText(_translate("Form", "Faster"))
|
||||||
|
self.velocity_label.setText(_translate("Form", "10 steps / s"))
|
||||||
|
self.slower_button.setText(_translate("Form", "Slower"))
|
||||||
|
self.current_step.setText(_translate("Form", "0 step"))
|
||||||
|
self.pause_button.setText(_translate("Form", "Pause"))
|
||||||
|
self.label_6.setText(_translate("Form", "Coverage:"))
|
||||||
|
self.rule_label.setText(_translate("Form", "Rule"))
|
||||||
|
self.label_5.setText(_translate("Form", "Size"))
|
||||||
|
self.add_random_button.setText(_translate("Form", "Add Random"))
|
||||||
|
self.remove_random_button.setText(_translate("Form", "Remove Random"))
|
||||||
|
self.label_3.setText(_translate("Form", "Survival"))
|
||||||
|
self.label_4.setText(_translate("Form", " Birth"))
|
||||||
|
self.label.setText(_translate("Form", "Width"))
|
||||||
|
self.label_2.setText(_translate("Form", "Height"))
|
||||||
|
self.object_combobox.setItemText(0, _translate("Form", "Random"))
|
||||||
|
self.object_combobox.setItemText(1, _translate("Form", "Circle"))
|
||||||
|
self.object_combobox.setItemText(2, _translate("Form", "Square"))
|
||||||
|
self.object_combobox.setItemText(3, _translate("Form", "Diamond"))
|
||||||
|
self.object_combobox.setItemText(4, _translate("Form", "Plus"))
|
||||||
|
self.start_button.setText(_translate("Form", "Start"))
|
||||||
|
self.hide_button.setText(_translate("Form", "Hide options"))
|
56
nmreval/gui_qt/_py/gracemsgdialog.py
Normal file
56
nmreval/gui_qt/_py/gracemsgdialog.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/gracemsgdialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_GraceMsgDialog(object):
|
||||||
|
def setupUi(self, GraceMsgDialog):
|
||||||
|
GraceMsgDialog.setObjectName("GraceMsgDialog")
|
||||||
|
GraceMsgDialog.resize(400, 300)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(GraceMsgDialog)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.graph_combo = QtWidgets.QComboBox(GraceMsgDialog)
|
||||||
|
self.graph_combo.setObjectName("graph_combo")
|
||||||
|
self.gridLayout.addWidget(self.graph_combo, 1, 1, 1, 1)
|
||||||
|
self.graph_button = QtWidgets.QRadioButton(GraceMsgDialog)
|
||||||
|
self.graph_button.setObjectName("graph_button")
|
||||||
|
self.buttonGroup = QtWidgets.QButtonGroup(GraceMsgDialog)
|
||||||
|
self.buttonGroup.setObjectName("buttonGroup")
|
||||||
|
self.buttonGroup.addButton(self.graph_button)
|
||||||
|
self.gridLayout.addWidget(self.graph_button, 1, 0, 1, 1)
|
||||||
|
self.overwrite_button = QtWidgets.QRadioButton(GraceMsgDialog)
|
||||||
|
self.overwrite_button.setChecked(True)
|
||||||
|
self.overwrite_button.setObjectName("overwrite_button")
|
||||||
|
self.buttonGroup.addButton(self.overwrite_button)
|
||||||
|
self.gridLayout.addWidget(self.overwrite_button, 0, 0, 1, 1)
|
||||||
|
self.radioButton = QtWidgets.QRadioButton(GraceMsgDialog)
|
||||||
|
self.radioButton.setObjectName("radioButton")
|
||||||
|
self.buttonGroup.addButton(self.radioButton)
|
||||||
|
self.gridLayout.addWidget(self.radioButton, 2, 0, 1, 1)
|
||||||
|
self.tableWidget = QtWidgets.QTableWidget(GraceMsgDialog)
|
||||||
|
self.tableWidget.setColumnCount(2)
|
||||||
|
self.tableWidget.setObjectName("tableWidget")
|
||||||
|
self.tableWidget.setRowCount(0)
|
||||||
|
self.tableWidget.horizontalHeader().setVisible(False)
|
||||||
|
self.gridLayout.addWidget(self.tableWidget, 3, 0, 2, 2)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(GraceMsgDialog)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2)
|
||||||
|
|
||||||
|
self.retranslateUi(GraceMsgDialog)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(GraceMsgDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, GraceMsgDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
GraceMsgDialog.setWindowTitle(_translate("GraceMsgDialog", "Goodness gracious, file already exists."))
|
||||||
|
self.graph_button.setText(_translate("GraceMsgDialog", "Add to graph"))
|
||||||
|
self.overwrite_button.setText(_translate("GraceMsgDialog", "Overwrite file"))
|
||||||
|
self.radioButton.setText(_translate("GraceMsgDialog", "Replace sets"))
|
92
nmreval/gui_qt/_py/gracereader.py
Normal file
92
nmreval/gui_qt/_py/gracereader.py
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/gracereader.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(400, 613)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.label = QtWidgets.QLabel(Dialog)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.verticalLayout.addWidget(self.label)
|
||||||
|
self.treeWidget = QtWidgets.QTreeWidget(Dialog)
|
||||||
|
self.treeWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
|
self.treeWidget.setObjectName("treeWidget")
|
||||||
|
self.treeWidget.headerItem().setText(0, "1")
|
||||||
|
self.treeWidget.header().setVisible(False)
|
||||||
|
self.verticalLayout.addWidget(self.treeWidget)
|
||||||
|
self.tableWidget = QtWidgets.QTableWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.tableWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.tableWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
|
self.tableWidget.setGridStyle(QtCore.Qt.NoPen)
|
||||||
|
self.tableWidget.setRowCount(4)
|
||||||
|
self.tableWidget.setColumnCount(2)
|
||||||
|
self.tableWidget.setObjectName("tableWidget")
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(0, 0, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(0, 1, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(1, 0, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(1, 1, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(2, 0, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(2, 1, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(3, 0, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
item.setFlags(QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidget.setItem(3, 1, item)
|
||||||
|
self.tableWidget.horizontalHeader().setVisible(False)
|
||||||
|
self.tableWidget.horizontalHeader().setStretchLastSection(True)
|
||||||
|
self.tableWidget.verticalHeader().setVisible(False)
|
||||||
|
self.verticalLayout.addWidget(self.tableWidget)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Load data from agr"))
|
||||||
|
self.label.setText(_translate("Dialog", "Only data will be loaded, no line and symbol properties!"))
|
||||||
|
__sortingEnabled = self.tableWidget.isSortingEnabled()
|
||||||
|
self.tableWidget.setSortingEnabled(False)
|
||||||
|
item = self.tableWidget.item(0, 0)
|
||||||
|
item.setText(_translate("Dialog", "Symbol"))
|
||||||
|
item = self.tableWidget.item(1, 0)
|
||||||
|
item.setText(_translate("Dialog", "Symbol color"))
|
||||||
|
item = self.tableWidget.item(2, 0)
|
||||||
|
item.setText(_translate("Dialog", "Linestyle"))
|
||||||
|
item = self.tableWidget.item(3, 0)
|
||||||
|
item.setText(_translate("Dialog", "Line color"))
|
||||||
|
self.tableWidget.setSortingEnabled(__sortingEnabled)
|
275
nmreval/gui_qt/_py/graph.py
Normal file
275
nmreval/gui_qt/_py/graph.py
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/graph.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_GraphWindow(object):
|
||||||
|
def setupUi(self, GraphWindow):
|
||||||
|
GraphWindow.setObjectName("GraphWindow")
|
||||||
|
GraphWindow.resize(680, 520)
|
||||||
|
GraphWindow.setBaseSize(QtCore.QSize(300, 10))
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(GraphWindow)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.widget = QtWidgets.QWidget(GraphWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.widget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.widget.setSizePolicy(sizePolicy)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setSpacing(1)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.logx_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.logx_button.setIconSize(QtCore.QSize(16, 16))
|
||||||
|
self.logx_button.setCheckable(True)
|
||||||
|
self.logx_button.setAutoRaise(True)
|
||||||
|
self.logx_button.setObjectName("logx_button")
|
||||||
|
self.horizontalLayout.addWidget(self.logx_button)
|
||||||
|
self.logy_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.logy_button.setIconSize(QtCore.QSize(16, 16))
|
||||||
|
self.logy_button.setCheckable(True)
|
||||||
|
self.logy_button.setAutoRaise(True)
|
||||||
|
self.logy_button.setObjectName("logy_button")
|
||||||
|
self.horizontalLayout.addWidget(self.logy_button)
|
||||||
|
self.line = QtWidgets.QFrame(self.widget)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.VLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.horizontalLayout.addWidget(self.line)
|
||||||
|
self.gridbutton = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.gridbutton.setCheckable(True)
|
||||||
|
self.gridbutton.setAutoRaise(True)
|
||||||
|
self.gridbutton.setObjectName("gridbutton")
|
||||||
|
self.horizontalLayout.addWidget(self.gridbutton)
|
||||||
|
self.bwbutton = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.bwbutton.setCheckable(True)
|
||||||
|
self.bwbutton.setAutoRaise(True)
|
||||||
|
self.bwbutton.setObjectName("bwbutton")
|
||||||
|
self.horizontalLayout.addWidget(self.bwbutton)
|
||||||
|
self.line_2 = QtWidgets.QFrame(self.widget)
|
||||||
|
self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.horizontalLayout.addWidget(self.line_2)
|
||||||
|
self.legend_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.legend_button.setIconSize(QtCore.QSize(16, 16))
|
||||||
|
self.legend_button.setCheckable(True)
|
||||||
|
self.legend_button.setAutoRaise(True)
|
||||||
|
self.legend_button.setObjectName("legend_button")
|
||||||
|
self.horizontalLayout.addWidget(self.legend_button)
|
||||||
|
self.imag_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.imag_button.setIconSize(QtCore.QSize(16, 16))
|
||||||
|
self.imag_button.setCheckable(True)
|
||||||
|
self.imag_button.setChecked(True)
|
||||||
|
self.imag_button.setAutoRaise(True)
|
||||||
|
self.imag_button.setObjectName("imag_button")
|
||||||
|
self.horizontalLayout.addWidget(self.imag_button)
|
||||||
|
self.real_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.real_button.setIconSize(QtCore.QSize(16, 16))
|
||||||
|
self.real_button.setCheckable(True)
|
||||||
|
self.real_button.setChecked(True)
|
||||||
|
self.real_button.setAutoRaise(True)
|
||||||
|
self.real_button.setObjectName("real_button")
|
||||||
|
self.horizontalLayout.addWidget(self.real_button)
|
||||||
|
self.error_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.error_button.setIconSize(QtCore.QSize(16, 16))
|
||||||
|
self.error_button.setCheckable(True)
|
||||||
|
self.error_button.setAutoRaise(True)
|
||||||
|
self.error_button.setObjectName("error_button")
|
||||||
|
self.horizontalLayout.addWidget(self.error_button)
|
||||||
|
self.line_3 = QtWidgets.QFrame(self.widget)
|
||||||
|
self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
|
||||||
|
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_3.setObjectName("line_3")
|
||||||
|
self.horizontalLayout.addWidget(self.line_3)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.limit_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.limit_button.setCheckable(True)
|
||||||
|
self.limit_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.limit_button.setAutoRaise(True)
|
||||||
|
self.limit_button.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.limit_button.setObjectName("limit_button")
|
||||||
|
self.horizontalLayout.addWidget(self.limit_button)
|
||||||
|
self.label_button = QtWidgets.QToolButton(self.widget)
|
||||||
|
self.label_button.setCheckable(True)
|
||||||
|
self.label_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.label_button.setAutoRaise(True)
|
||||||
|
self.label_button.setArrowType(QtCore.Qt.RightArrow)
|
||||||
|
self.label_button.setObjectName("label_button")
|
||||||
|
self.horizontalLayout.addWidget(self.label_button)
|
||||||
|
self.verticalLayout.addWidget(self.widget)
|
||||||
|
self.line_4 = QtWidgets.QFrame(GraphWindow)
|
||||||
|
self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_4.setObjectName("line_4")
|
||||||
|
self.verticalLayout.addWidget(self.line_4)
|
||||||
|
self.limit_widget = QtWidgets.QWidget(GraphWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.limit_widget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.limit_widget.setSizePolicy(sizePolicy)
|
||||||
|
self.limit_widget.setObjectName("limit_widget")
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.limit_widget)
|
||||||
|
self.horizontalLayout_2.setContentsMargins(1, 1, 1, 1)
|
||||||
|
self.horizontalLayout_2.setSpacing(2)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.label = QtWidgets.QLabel(self.limit_widget)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout_2.addWidget(self.label)
|
||||||
|
self.xmin_lineedit = QtWidgets.QLineEdit(self.limit_widget)
|
||||||
|
self.xmin_lineedit.setObjectName("xmin_lineedit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.xmin_lineedit)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.limit_widget)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_2)
|
||||||
|
self.xmax_lineedit = QtWidgets.QLineEdit(self.limit_widget)
|
||||||
|
self.xmax_lineedit.setObjectName("xmax_lineedit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.xmax_lineedit)
|
||||||
|
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem1)
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.limit_widget)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_3)
|
||||||
|
self.ymin_lineedit = QtWidgets.QLineEdit(self.limit_widget)
|
||||||
|
self.ymin_lineedit.setObjectName("ymin_lineedit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.ymin_lineedit)
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.limit_widget)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_4)
|
||||||
|
self.ymax_lineedit = QtWidgets.QLineEdit(self.limit_widget)
|
||||||
|
self.ymax_lineedit.setObjectName("ymax_lineedit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.ymax_lineedit)
|
||||||
|
self.apply_button = QtWidgets.QPushButton(self.limit_widget)
|
||||||
|
icon = QtGui.QIcon.fromTheme("dialog-ok")
|
||||||
|
self.apply_button.setIcon(icon)
|
||||||
|
self.apply_button.setObjectName("apply_button")
|
||||||
|
self.horizontalLayout_2.addWidget(self.apply_button)
|
||||||
|
self.verticalLayout.addWidget(self.limit_widget)
|
||||||
|
self.label_widget = QtWidgets.QWidget(GraphWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.label_widget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.label_widget.setSizePolicy(sizePolicy)
|
||||||
|
self.label_widget.setObjectName("label_widget")
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.label_widget)
|
||||||
|
self.horizontalLayout_3.setContentsMargins(1, 1, 1, 1)
|
||||||
|
self.horizontalLayout_3.setSpacing(2)
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.label_widget)
|
||||||
|
self.label_5.setObjectName("label_5")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_5)
|
||||||
|
self.title_lineedit = QtWidgets.QLineEdit(self.label_widget)
|
||||||
|
self.title_lineedit.setObjectName("title_lineedit")
|
||||||
|
self.horizontalLayout_3.addWidget(self.title_lineedit)
|
||||||
|
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_3.addItem(spacerItem2)
|
||||||
|
self.label_6 = QtWidgets.QLabel(self.label_widget)
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_6)
|
||||||
|
self.xaxis_linedit = QtWidgets.QLineEdit(self.label_widget)
|
||||||
|
self.xaxis_linedit.setObjectName("xaxis_linedit")
|
||||||
|
self.horizontalLayout_3.addWidget(self.xaxis_linedit)
|
||||||
|
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_3.addItem(spacerItem3)
|
||||||
|
self.label_7 = QtWidgets.QLabel(self.label_widget)
|
||||||
|
self.label_7.setObjectName("label_7")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_7)
|
||||||
|
self.yaxis_linedit = QtWidgets.QLineEdit(self.label_widget)
|
||||||
|
self.yaxis_linedit.setObjectName("yaxis_linedit")
|
||||||
|
self.horizontalLayout_3.addWidget(self.yaxis_linedit)
|
||||||
|
self.verticalLayout.addWidget(self.label_widget)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout()
|
||||||
|
self.gridLayout.setHorizontalSpacing(3)
|
||||||
|
self.gridLayout.setVerticalSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.listWidget = QtWidgets.QListWidget(GraphWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.gridLayout.addWidget(self.listWidget, 1, 1, 1, 1)
|
||||||
|
self.checkBox = QtWidgets.QCheckBox(GraphWindow)
|
||||||
|
self.checkBox.setChecked(True)
|
||||||
|
self.checkBox.setObjectName("checkBox")
|
||||||
|
self.gridLayout.addWidget(self.checkBox, 0, 1, 1, 1)
|
||||||
|
self.graphic = PlotWidget(GraphWindow)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.graphic.sizePolicy().hasHeightForWidth())
|
||||||
|
self.graphic.setSizePolicy(sizePolicy)
|
||||||
|
self.graphic.setObjectName("graphic")
|
||||||
|
self.gridLayout.addWidget(self.graphic, 0, 0, 2, 1)
|
||||||
|
self.verticalLayout.addLayout(self.gridLayout)
|
||||||
|
self.label.setBuddy(self.xmin_lineedit)
|
||||||
|
self.label_2.setBuddy(self.xmax_lineedit)
|
||||||
|
self.label_3.setBuddy(self.ymin_lineedit)
|
||||||
|
self.label_4.setBuddy(self.ymax_lineedit)
|
||||||
|
self.label_5.setBuddy(self.title_lineedit)
|
||||||
|
self.label_6.setBuddy(self.xaxis_linedit)
|
||||||
|
self.label_7.setBuddy(self.yaxis_linedit)
|
||||||
|
|
||||||
|
self.retranslateUi(GraphWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(GraphWindow)
|
||||||
|
GraphWindow.setTabOrder(self.logx_button, self.logy_button)
|
||||||
|
GraphWindow.setTabOrder(self.logy_button, self.gridbutton)
|
||||||
|
GraphWindow.setTabOrder(self.gridbutton, self.legend_button)
|
||||||
|
GraphWindow.setTabOrder(self.legend_button, self.imag_button)
|
||||||
|
GraphWindow.setTabOrder(self.imag_button, self.error_button)
|
||||||
|
GraphWindow.setTabOrder(self.error_button, self.limit_button)
|
||||||
|
GraphWindow.setTabOrder(self.limit_button, self.label_button)
|
||||||
|
GraphWindow.setTabOrder(self.label_button, self.xmin_lineedit)
|
||||||
|
GraphWindow.setTabOrder(self.xmin_lineedit, self.xmax_lineedit)
|
||||||
|
GraphWindow.setTabOrder(self.xmax_lineedit, self.ymin_lineedit)
|
||||||
|
GraphWindow.setTabOrder(self.ymin_lineedit, self.ymax_lineedit)
|
||||||
|
GraphWindow.setTabOrder(self.ymax_lineedit, self.title_lineedit)
|
||||||
|
GraphWindow.setTabOrder(self.title_lineedit, self.xaxis_linedit)
|
||||||
|
GraphWindow.setTabOrder(self.xaxis_linedit, self.yaxis_linedit)
|
||||||
|
|
||||||
|
def retranslateUi(self, GraphWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
GraphWindow.setWindowTitle(_translate("GraphWindow", "Form"))
|
||||||
|
self.logx_button.setToolTip(_translate("GraphWindow", "Change x axis linear <-> logarithmic"))
|
||||||
|
self.logx_button.setText(_translate("GraphWindow", "Log X"))
|
||||||
|
self.logy_button.setToolTip(_translate("GraphWindow", "Change y axis linear <-> logarithmic"))
|
||||||
|
self.logy_button.setText(_translate("GraphWindow", "Log Y"))
|
||||||
|
self.gridbutton.setToolTip(_translate("GraphWindow", "Show/hide grid"))
|
||||||
|
self.gridbutton.setText(_translate("GraphWindow", "Grid"))
|
||||||
|
self.bwbutton.setToolTip(_translate("GraphWindow", "Change background"))
|
||||||
|
self.bwbutton.setText(_translate("GraphWindow", "Black/white"))
|
||||||
|
self.legend_button.setToolTip(_translate("GraphWindow", "Change legend"))
|
||||||
|
self.legend_button.setText(_translate("GraphWindow", "Legend"))
|
||||||
|
self.imag_button.setToolTip(_translate("GraphWindow", "Show/hide imaginary part"))
|
||||||
|
self.imag_button.setText(_translate("GraphWindow", "Imaginary"))
|
||||||
|
self.real_button.setToolTip(_translate("GraphWindow", "Show/hide real part"))
|
||||||
|
self.real_button.setText(_translate("GraphWindow", "Real"))
|
||||||
|
self.error_button.setToolTip(_translate("GraphWindow", "Show/hide errorbars"))
|
||||||
|
self.error_button.setText(_translate("GraphWindow", "Errorbars"))
|
||||||
|
self.limit_button.setText(_translate("GraphWindow", "Limits"))
|
||||||
|
self.label_button.setText(_translate("GraphWindow", "Labels"))
|
||||||
|
self.label.setText(_translate("GraphWindow", "X: "))
|
||||||
|
self.label_2.setText(_translate("GraphWindow", "---"))
|
||||||
|
self.label_3.setText(_translate("GraphWindow", "Y: "))
|
||||||
|
self.label_4.setText(_translate("GraphWindow", "---"))
|
||||||
|
self.apply_button.setText(_translate("GraphWindow", "Apply"))
|
||||||
|
self.label_5.setText(_translate("GraphWindow", "Title"))
|
||||||
|
self.label_6.setText(_translate("GraphWindow", "X Axis"))
|
||||||
|
self.label_7.setText(_translate("GraphWindow", "Y Axis"))
|
||||||
|
self.checkBox.setText(_translate("GraphWindow", "Show legend"))
|
||||||
|
from pyqtgraph import PlotWidget
|
121
nmreval/gui_qt/_py/guidelinewidget.py
Normal file
121
nmreval/gui_qt/_py/guidelinewidget.py
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/guidelinewidget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(431, 799)
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout_2.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout_2.setSpacing(3)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.mode_comboBox = QtWidgets.QComboBox(Form)
|
||||||
|
self.mode_comboBox.setObjectName("mode_comboBox")
|
||||||
|
self.mode_comboBox.addItem("")
|
||||||
|
self.mode_comboBox.addItem("")
|
||||||
|
self.gridLayout_2.addWidget(self.mode_comboBox, 2, 0, 1, 2)
|
||||||
|
self.graph_comboBox = QtWidgets.QComboBox(Form)
|
||||||
|
self.graph_comboBox.setObjectName("graph_comboBox")
|
||||||
|
self.gridLayout_2.addWidget(self.graph_comboBox, 0, 0, 1, 2)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.diagonal_widget = QtWidgets.QWidget(Form)
|
||||||
|
self.diagonal_widget.setObjectName("diagonal_widget")
|
||||||
|
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.diagonal_widget)
|
||||||
|
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||||
|
self.horizontalLayout_2.addWidget(self.diagonal_widget)
|
||||||
|
self.vh_widget = QtWidgets.QWidget(Form)
|
||||||
|
self.vh_widget.setObjectName("vh_widget")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.vh_widget)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.label = QtWidgets.QLabel(self.vh_widget)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout.addWidget(self.label)
|
||||||
|
self.vh_pos_lineEdit = QtWidgets.QLineEdit(self.vh_widget)
|
||||||
|
self.vh_pos_lineEdit.setObjectName("vh_pos_lineEdit")
|
||||||
|
self.horizontalLayout.addWidget(self.vh_pos_lineEdit)
|
||||||
|
self.horizontalLayout_2.addWidget(self.vh_widget)
|
||||||
|
self.drag_checkBox = QtWidgets.QCheckBox(Form)
|
||||||
|
self.drag_checkBox.setChecked(True)
|
||||||
|
self.drag_checkBox.setObjectName("drag_checkBox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.drag_checkBox)
|
||||||
|
self.gridLayout_2.addLayout(self.horizontalLayout_2, 3, 0, 1, 2)
|
||||||
|
self.color_comboBox = ColorListEditor(Form)
|
||||||
|
self.color_comboBox.setObjectName("color_comboBox")
|
||||||
|
self.gridLayout_2.addWidget(self.color_comboBox, 6, 1, 1, 1)
|
||||||
|
self.pushButton = QtWidgets.QPushButton(Form)
|
||||||
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.gridLayout_2.addWidget(self.pushButton, 7, 0, 1, 2)
|
||||||
|
self.label_6 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.gridLayout_2.addWidget(self.label_6, 5, 0, 1, 1)
|
||||||
|
self.comment_lineEdit = QtWidgets.QLineEdit(Form)
|
||||||
|
self.comment_lineEdit.setObjectName("comment_lineEdit")
|
||||||
|
self.gridLayout_2.addWidget(self.comment_lineEdit, 5, 1, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout_2.addWidget(self.label_2, 6, 0, 1, 1)
|
||||||
|
self.tableWidget = QtWidgets.QTableWidget(Form)
|
||||||
|
self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
|
self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
|
self.tableWidget.setColumnCount(2)
|
||||||
|
self.tableWidget.setObjectName("tableWidget")
|
||||||
|
self.tableWidget.setRowCount(0)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.tableWidget.setHorizontalHeaderItem(0, item)
|
||||||
|
item = QtWidgets.QTableWidgetItem()
|
||||||
|
self.tableWidget.setHorizontalHeaderItem(1, item)
|
||||||
|
self.tableWidget.horizontalHeader().setVisible(True)
|
||||||
|
self.tableWidget.horizontalHeader().setStretchLastSection(True)
|
||||||
|
self.gridLayout_2.addWidget(self.tableWidget, 8, 0, 1, 2)
|
||||||
|
self.line = QtWidgets.QFrame(Form)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.gridLayout_2.addWidget(self.line, 1, 0, 1, 2)
|
||||||
|
self.line_2 = QtWidgets.QFrame(Form)
|
||||||
|
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.gridLayout_2.addWidget(self.line_2, 4, 0, 1, 2)
|
||||||
|
self.label.setBuddy(self.vh_pos_lineEdit)
|
||||||
|
self.label_6.setBuddy(self.comment_lineEdit)
|
||||||
|
self.label_2.setBuddy(self.color_comboBox)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
Form.setTabOrder(self.graph_comboBox, self.mode_comboBox)
|
||||||
|
Form.setTabOrder(self.mode_comboBox, self.vh_pos_lineEdit)
|
||||||
|
Form.setTabOrder(self.vh_pos_lineEdit, self.drag_checkBox)
|
||||||
|
Form.setTabOrder(self.drag_checkBox, self.comment_lineEdit)
|
||||||
|
Form.setTabOrder(self.comment_lineEdit, self.color_comboBox)
|
||||||
|
Form.setTabOrder(self.color_comboBox, self.pushButton)
|
||||||
|
Form.setTabOrder(self.pushButton, self.tableWidget)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.mode_comboBox.setItemText(0, _translate("Form", "Vertical"))
|
||||||
|
self.mode_comboBox.setItemText(1, _translate("Form", "Horizontal"))
|
||||||
|
self.label.setText(_translate("Form", "Position"))
|
||||||
|
self.vh_pos_lineEdit.setText(_translate("Form", "0"))
|
||||||
|
self.drag_checkBox.setText(_translate("Form", "Drag enabled"))
|
||||||
|
self.pushButton.setText(_translate("Form", "Create line"))
|
||||||
|
self.label_6.setText(_translate("Form", "Comment"))
|
||||||
|
self.label_2.setText(_translate("Form", "Color"))
|
||||||
|
item = self.tableWidget.horizontalHeaderItem(0)
|
||||||
|
item.setText(_translate("Form", "Pos."))
|
||||||
|
item = self.tableWidget.horizontalHeaderItem(1)
|
||||||
|
item.setText(_translate("Form", "Comment"))
|
||||||
|
from ..lib.delegates import ColorListEditor
|
61
nmreval/gui_qt/_py/hdftree.py
Normal file
61
nmreval/gui_qt/_py/hdftree.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/hdftree.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Hdf_Dialog(object):
|
||||||
|
def setupUi(self, Hdf_Dialog):
|
||||||
|
Hdf_Dialog.setObjectName("Hdf_Dialog")
|
||||||
|
Hdf_Dialog.resize(460, 772)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Hdf_Dialog)
|
||||||
|
self.verticalLayout.setContentsMargins(4, 4, 4, 4)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.verticalLayout.addLayout(self.verticalLayout_3)
|
||||||
|
self.widget = QtWidgets.QWidget(Hdf_Dialog)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.widget)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(2)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.comboBox_2 = QtWidgets.QComboBox(self.widget)
|
||||||
|
self.comboBox_2.setObjectName("comboBox_2")
|
||||||
|
self.gridLayout.addWidget(self.comboBox_2, 1, 1, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
|
||||||
|
self.comboBox = QtWidgets.QComboBox(self.widget)
|
||||||
|
self.comboBox.setObjectName("comboBox")
|
||||||
|
self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
|
||||||
|
self.verticalLayout.addWidget(self.widget)
|
||||||
|
self.widget_2 = ExpandableWidget(Hdf_Dialog)
|
||||||
|
self.widget_2.setObjectName("widget_2")
|
||||||
|
self.verticalLayout.addWidget(self.widget_2)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Hdf_Dialog)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
|
self.retranslateUi(Hdf_Dialog)
|
||||||
|
self.buttonBox.rejected.connect(Hdf_Dialog.close)
|
||||||
|
self.buttonBox.accepted.connect(Hdf_Dialog.accept)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Hdf_Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Hdf_Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Hdf_Dialog.setWindowTitle(_translate("Hdf_Dialog", "View HDF file"))
|
||||||
|
self.label.setText(_translate("Hdf_Dialog", "Label"))
|
||||||
|
self.label_2.setText(_translate("Hdf_Dialog", "Group"))
|
||||||
|
from ..lib.expandablewidget import ExpandableWidget
|
53
nmreval/gui_qt/_py/integral_widget.py
Normal file
53
nmreval/gui_qt/_py/integral_widget.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/integral_widget.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(397, 681)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
|
||||||
|
self.verticalLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.verticalLayout.setSpacing(3)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.label_2 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.verticalLayout.addWidget(self.label_2)
|
||||||
|
self.set_combobox = QtWidgets.QComboBox(Form)
|
||||||
|
self.set_combobox.setObjectName("set_combobox")
|
||||||
|
self.verticalLayout.addWidget(self.set_combobox)
|
||||||
|
self.treeWidget = QtWidgets.QTreeWidget(Form)
|
||||||
|
self.treeWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
self.treeWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
|
self.treeWidget.setHeaderHidden(True)
|
||||||
|
self.treeWidget.setObjectName("treeWidget")
|
||||||
|
self.treeWidget.headerItem().setText(0, "1")
|
||||||
|
self.verticalLayout.addWidget(self.treeWidget)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.label = QtWidgets.QLabel(Form)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout.addWidget(self.label)
|
||||||
|
self.pushButton = QtWidgets.QPushButton(Form)
|
||||||
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.horizontalLayout.addWidget(self.pushButton)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.label_2.setText(_translate("Form", "TextLabel"))
|
||||||
|
self.label.setText(_translate("Form", "Save integrals as dataset"))
|
||||||
|
self.pushButton.setText(_translate("Form", "Apply"))
|
83
nmreval/gui_qt/_py/integratederive_dialog.py
Normal file
83
nmreval/gui_qt/_py/integratederive_dialog.py
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/integratederive_dialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(400, 308)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.listWidget = QtWidgets.QListWidget(Dialog)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.verticalLayout.addWidget(self.listWidget)
|
||||||
|
self.widget = QtWidgets.QWidget(Dialog)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.label = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout.addWidget(self.label)
|
||||||
|
self.start_lineedit = QtWidgets.QLineEdit(self.widget)
|
||||||
|
self.start_lineedit.setEnabled(False)
|
||||||
|
self.start_lineedit.setObjectName("start_lineedit")
|
||||||
|
self.horizontalLayout.addWidget(self.start_lineedit)
|
||||||
|
self.stop_lineedit = QtWidgets.QLineEdit(self.widget)
|
||||||
|
self.stop_lineedit.setEnabled(False)
|
||||||
|
self.stop_lineedit.setObjectName("stop_lineedit")
|
||||||
|
self.horizontalLayout.addWidget(self.stop_lineedit)
|
||||||
|
self.range_checkbox = QtWidgets.QCheckBox(self.widget)
|
||||||
|
self.range_checkbox.setChecked(True)
|
||||||
|
self.range_checkbox.setObjectName("range_checkbox")
|
||||||
|
self.horizontalLayout.addWidget(self.range_checkbox)
|
||||||
|
self.verticalLayout.addWidget(self.widget)
|
||||||
|
self.ft_comboBox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.ft_comboBox.setObjectName("ft_comboBox")
|
||||||
|
self.ft_comboBox.addItem("")
|
||||||
|
self.ft_comboBox.addItem("")
|
||||||
|
self.ft_comboBox.addItem("")
|
||||||
|
self.verticalLayout.addWidget(self.ft_comboBox)
|
||||||
|
self.log_checkbox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.log_checkbox.setObjectName("log_checkbox")
|
||||||
|
self.verticalLayout.addWidget(self.log_checkbox)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1)
|
||||||
|
self.horizontalLayout_2.setSpacing(3)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.newgraph_checkbox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.newgraph_checkbox.setObjectName("newgraph_checkbox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.newgraph_checkbox)
|
||||||
|
self.graph_combobox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.graph_combobox.setObjectName("graph_combobox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.graph_combobox)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||||
|
self.label.setText(_translate("Dialog", "Limits"))
|
||||||
|
self.range_checkbox.setText(_translate("Dialog", "Full"))
|
||||||
|
self.ft_comboBox.setItemText(0, _translate("Dialog", "Real"))
|
||||||
|
self.ft_comboBox.setItemText(1, _translate("Dialog", "Imag"))
|
||||||
|
self.ft_comboBox.setItemText(2, _translate("Dialog", "Complex"))
|
||||||
|
self.log_checkbox.setText(_translate("Dialog", "use logarithmic x axis"))
|
||||||
|
self.newgraph_checkbox.setText(_translate("Dialog", "New graph"))
|
166
nmreval/gui_qt/_py/interpol_dialog.py
Normal file
166
nmreval/gui_qt/_py/interpol_dialog.py
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/interpol_dialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(416, 494)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
||||||
|
self.gridLayout.setContentsMargins(3, 3, 3, 3)
|
||||||
|
self.gridLayout.setSpacing(3)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.src_widget = QtWidgets.QWidget(Dialog)
|
||||||
|
self.src_widget.setObjectName("src_widget")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.src_widget)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setSpacing(3)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.graph_combobox = QtWidgets.QComboBox(self.src_widget)
|
||||||
|
self.graph_combobox.setObjectName("graph_combobox")
|
||||||
|
self.horizontalLayout.addWidget(self.graph_combobox)
|
||||||
|
self.set_combobox = QtWidgets.QComboBox(self.src_widget)
|
||||||
|
self.set_combobox.setObjectName("set_combobox")
|
||||||
|
self.horizontalLayout.addWidget(self.set_combobox)
|
||||||
|
self.gridLayout.addWidget(self.src_widget, 8, 0, 1, 2)
|
||||||
|
self.label_3 = QtWidgets.QLabel(Dialog)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout.addWidget(self.label_3, 0, 0, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(Dialog)
|
||||||
|
self.label.setToolTip("")
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
|
||||||
|
self.line_2 = QtWidgets.QFrame(Dialog)
|
||||||
|
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.gridLayout.addWidget(self.line_2, 5, 0, 1, 2)
|
||||||
|
self.ylog_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.ylog_checkBox.setObjectName("ylog_checkBox")
|
||||||
|
self.gridLayout.addWidget(self.ylog_checkBox, 2, 1, 1, 1)
|
||||||
|
self.interp_comboBox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.interp_comboBox.setToolTip("")
|
||||||
|
self.interp_comboBox.setObjectName("interp_comboBox")
|
||||||
|
self.interp_comboBox.addItem("")
|
||||||
|
self.interp_comboBox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.interp_comboBox, 4, 1, 1, 1)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||||
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.gridLayout.addWidget(self.buttonBox, 12, 0, 1, 2)
|
||||||
|
self.line = QtWidgets.QFrame(Dialog)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.gridLayout.addWidget(self.line, 3, 0, 1, 2)
|
||||||
|
self.label_2 = QtWidgets.QLabel(Dialog)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 6, 0, 1, 1)
|
||||||
|
self.listWidget = QtWidgets.QListWidget(Dialog)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
self.listWidget.setSizePolicy(sizePolicy)
|
||||||
|
self.listWidget.setObjectName("listWidget")
|
||||||
|
self.gridLayout.addWidget(self.listWidget, 1, 0, 1, 2)
|
||||||
|
self.sampling_widget = QtWidgets.QWidget(Dialog)
|
||||||
|
self.sampling_widget.setObjectName("sampling_widget")
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.sampling_widget)
|
||||||
|
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_2.setSpacing(3)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.sampling_widget)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_4)
|
||||||
|
self.start_lineEdit = QtWidgets.QLineEdit(self.sampling_widget)
|
||||||
|
self.start_lineEdit.setObjectName("start_lineEdit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.start_lineEdit)
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.sampling_widget)
|
||||||
|
self.label_5.setObjectName("label_5")
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_5)
|
||||||
|
self.stop_lineEdit = QtWidgets.QLineEdit(self.sampling_widget)
|
||||||
|
self.stop_lineEdit.setObjectName("stop_lineEdit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.stop_lineEdit)
|
||||||
|
self.label_6 = QtWidgets.QLabel(self.sampling_widget)
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_6)
|
||||||
|
self.step_lineEdit = QtWidgets.QLineEdit(self.sampling_widget)
|
||||||
|
self.step_lineEdit.setObjectName("step_lineEdit")
|
||||||
|
self.horizontalLayout_2.addWidget(self.step_lineEdit)
|
||||||
|
self.logspace_checkBox = QtWidgets.QCheckBox(self.sampling_widget)
|
||||||
|
self.logspace_checkBox.setObjectName("logspace_checkBox")
|
||||||
|
self.horizontalLayout_2.addWidget(self.logspace_checkBox)
|
||||||
|
self.gridLayout.addWidget(self.sampling_widget, 7, 0, 1, 2)
|
||||||
|
self.xaxis_comboBox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.xaxis_comboBox.setObjectName("xaxis_comboBox")
|
||||||
|
self.xaxis_comboBox.addItem("")
|
||||||
|
self.xaxis_comboBox.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.xaxis_comboBox, 6, 1, 1, 1)
|
||||||
|
self.line_3 = QtWidgets.QFrame(Dialog)
|
||||||
|
self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_3.setObjectName("line_3")
|
||||||
|
self.gridLayout.addWidget(self.line_3, 9, 0, 1, 2)
|
||||||
|
self.dest_combobox = QtWidgets.QComboBox(Dialog)
|
||||||
|
self.dest_combobox.setObjectName("dest_combobox")
|
||||||
|
self.gridLayout.addWidget(self.dest_combobox, 10, 1, 1, 1)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.gridLayout.addItem(spacerItem, 11, 0, 1, 1)
|
||||||
|
self.label_8 = QtWidgets.QLabel(Dialog)
|
||||||
|
self.label_8.setObjectName("label_8")
|
||||||
|
self.gridLayout.addWidget(self.label_8, 10, 0, 1, 1)
|
||||||
|
self.xlog_checkBox = QtWidgets.QCheckBox(Dialog)
|
||||||
|
self.xlog_checkBox.setObjectName("xlog_checkBox")
|
||||||
|
self.gridLayout.addWidget(self.xlog_checkBox, 2, 0, 1, 1)
|
||||||
|
self.label.setBuddy(self.interp_comboBox)
|
||||||
|
self.label_2.setBuddy(self.xaxis_comboBox)
|
||||||
|
self.label_4.setBuddy(self.start_lineEdit)
|
||||||
|
self.label_5.setBuddy(self.stop_lineEdit)
|
||||||
|
self.label_6.setBuddy(self.step_lineEdit)
|
||||||
|
self.label_8.setBuddy(self.dest_combobox)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
self.buttonBox.accepted.connect(Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
Dialog.setTabOrder(self.listWidget, self.ylog_checkBox)
|
||||||
|
Dialog.setTabOrder(self.ylog_checkBox, self.interp_comboBox)
|
||||||
|
Dialog.setTabOrder(self.interp_comboBox, self.xaxis_comboBox)
|
||||||
|
Dialog.setTabOrder(self.xaxis_comboBox, self.start_lineEdit)
|
||||||
|
Dialog.setTabOrder(self.start_lineEdit, self.stop_lineEdit)
|
||||||
|
Dialog.setTabOrder(self.stop_lineEdit, self.step_lineEdit)
|
||||||
|
Dialog.setTabOrder(self.step_lineEdit, self.logspace_checkBox)
|
||||||
|
Dialog.setTabOrder(self.logspace_checkBox, self.graph_combobox)
|
||||||
|
Dialog.setTabOrder(self.graph_combobox, self.set_combobox)
|
||||||
|
Dialog.setTabOrder(self.set_combobox, self.dest_combobox)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Data interpolation"))
|
||||||
|
self.label_3.setText(_translate("Dialog", "Source data"))
|
||||||
|
self.label.setText(_translate("Dialog", "Spline"))
|
||||||
|
self.ylog_checkBox.setToolTip(_translate("Dialog", "If your data is on a logarithmic scale in y, check this box"))
|
||||||
|
self.ylog_checkBox.setText(_translate("Dialog", "use log(y)"))
|
||||||
|
self.interp_comboBox.setItemText(0, _translate("Dialog", "Cubic"))
|
||||||
|
self.interp_comboBox.setItemText(1, _translate("Dialog", "Linear"))
|
||||||
|
self.buttonBox.setToolTip(_translate("Dialog", "Accept to create new data sets."))
|
||||||
|
self.label_2.setText(_translate("Dialog", "New x axis"))
|
||||||
|
self.listWidget.setToolTip(_translate("Dialog", "Select sets that shall be interpolated. No selection will create interpolations of all visible sets."))
|
||||||
|
self.label_4.setText(_translate("Dialog", "Start"))
|
||||||
|
self.label_5.setText(_translate("Dialog", "Stop"))
|
||||||
|
self.label_6.setText(_translate("Dialog", "Steps"))
|
||||||
|
self.logspace_checkBox.setText(_translate("Dialog", "log-spaced?"))
|
||||||
|
self.xaxis_comboBox.setItemText(0, _translate("Dialog", "new values"))
|
||||||
|
self.xaxis_comboBox.setItemText(1, _translate("Dialog", "from data"))
|
||||||
|
self.label_8.setText(_translate("Dialog", "Add interpolated data to"))
|
||||||
|
self.xlog_checkBox.setText(_translate("Dialog", "use log(x)"))
|
39
nmreval/gui_qt/_py/lineedit_dialog.py
Normal file
39
nmreval/gui_qt/_py/lineedit_dialog.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/_ui/lineedit_dialog.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.12.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_LineEdit_Dialog(object):
|
||||||
|
def setupUi(self, LineEdit_Dialog):
|
||||||
|
LineEdit_Dialog.setObjectName("LineEdit_Dialog")
|
||||||
|
LineEdit_Dialog.resize(400, 84)
|
||||||
|
self.formLayout = QtWidgets.QFormLayout(LineEdit_Dialog)
|
||||||
|
self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
|
||||||
|
self.formLayout.setObjectName("formLayout")
|
||||||
|
self.label = QtWidgets.QLabel(LineEdit_Dialog)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
|
||||||
|
self.new_string = QtWidgets.QLineEdit(LineEdit_Dialog)
|
||||||
|
self.new_string.setObjectName("new_string")
|
||||||
|
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.new_string)
|
||||||
|
self.buttonBox = QtWidgets.QDialogButtonBox(LineEdit_Dialog)
|
||||||
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.SpanningRole, self.buttonBox)
|
||||||
|
|
||||||
|
self.retranslateUi(LineEdit_Dialog)
|
||||||
|
self.buttonBox.accepted.connect(LineEdit_Dialog.accept)
|
||||||
|
self.buttonBox.rejected.connect(LineEdit_Dialog.reject)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(LineEdit_Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, LineEdit_Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
LineEdit_Dialog.setWindowTitle(_translate("LineEdit_Dialog", "Dialog"))
|
||||||
|
self.label.setText(_translate("LineEdit_Dialog", "Label"))
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user