From 7145f9e3cd6b8802e5f2d3c941ba008e20b17f5f Mon Sep 17 00:00:00 2001
From: Dominik Demuth
Date: Wed, 13 Nov 2024 13:02:05 +0000
Subject: [PATCH] dev (#295)
Co-authored-by: Dominik Demuth
Reviewed-on: https://gitea.pkm.physik.tu-darmstadt.de/IPKM/nmreval/pulls/295
---
src/gui_qt/_py/asciidialog.py | 2 +-
src/gui_qt/_py/ptstab.py | 170 ++++++-----
src/gui_qt/data/point_select.py | 53 +++-
src/gui_qt/graphs/graphwindow.py | 8 +
src/gui_qt/main/management.py | 25 +-
src/nmreval/data/points.py | 11 +-
src/nmreval/models/transitions.py | 20 +-
src/resources/_ui/asciidialog.ui | 2 +-
src/resources/_ui/ptstab.ui | 479 ++++++++++++++++--------------
9 files changed, 443 insertions(+), 327 deletions(-)
diff --git a/src/gui_qt/_py/asciidialog.py b/src/gui_qt/_py/asciidialog.py
index 099ff18..83a8914 100644
--- a/src/gui_qt/_py/asciidialog.py
+++ b/src/gui_qt/_py/asciidialog.py
@@ -360,7 +360,7 @@ class Ui_ascii_reader(object):
self.x_label.setText(_translate("ascii_reader", "x"))
self.dsdfsf.setText(_translate("ascii_reader", "Numerical value"))
self.label_9.setText(_translate("ascii_reader", "Match index"))
- self.regex_input.setToolTip(_translate("ascii_reader", "Token:
[abc]: Matches any of a, b, or c
[a-z]: Matches any digit in the range a-z
\\d: Matches any digit in the range 0-9 (equal to [0-9}
Quantifiers:
a*: 0 or more of a
a*: 1 or more of a
a?: 0 or 1 of a
"))
+ self.regex_input.setToolTip(_translate("ascii_reader", "
Token:
[abc]: Matches any of a, b, or c
[a-z]: Matches any digit in the range a-z
\\d: Matches any digit in the range 0-9 (equal to [0-9}
Quantifiers:
a*: 0 or more of a
a+: 1 or more of a
a?: 0 or 1 of a
"))
self.re_button.setText(_translate("ascii_reader", "Regex"))
self.custom_button.setText(_translate("ascii_reader", "Custom value"))
self.label_8.setText(_translate("ascii_reader", "Filename"))
diff --git a/src/gui_qt/_py/ptstab.py b/src/gui_qt/_py/ptstab.py
index 211722f..47f2ab6 100644
--- a/src/gui_qt/_py/ptstab.py
+++ b/src/gui_qt/_py/ptstab.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file './nmreval/src/resources/_ui/ptstab.ui'
+# Form implementation generated from reading ui file 'nmreval/src/resources/_ui/ptstab.ui'
#
# Created by: PyQt5 UI code generator 5.15.10
#
@@ -14,29 +14,50 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
- Form.resize(316, 747)
- self.verticalLayout = QtWidgets.QVBoxLayout(Form)
- self.verticalLayout.setContentsMargins(3, 3, 3, 3)
- self.verticalLayout.setObjectName("verticalLayout")
+ Form.resize(417, 746)
+ self.gridLayout = QtWidgets.QGridLayout(Form)
+ self.gridLayout.setObjectName("gridLayout")
+ self.label_2 = QtWidgets.QLabel(Form)
+ self.label_2.setObjectName("label_2")
+ self.gridLayout.addWidget(self.label_2, 0, 0, 1, 2)
self.peaktable = QtWidgets.QListWidget(Form)
self.peaktable.setEditTriggers(QtWidgets.QAbstractItemView.DoubleClicked|QtWidgets.QAbstractItemView.EditKeyPressed)
self.peaktable.setObjectName("peaktable")
- self.verticalLayout.addWidget(self.peaktable)
- self.groupBox = QtWidgets.QGroupBox(Form)
- self.groupBox.setObjectName("groupBox")
- self.horizontalLayout = QtWidgets.QHBoxLayout(self.groupBox)
- self.horizontalLayout.setContentsMargins(3, 3, 3, 3)
- self.horizontalLayout.setSpacing(3)
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.left_pt = QtWidgets.QSpinBox(self.groupBox)
- self.left_pt.setMaximum(999)
- self.left_pt.setObjectName("left_pt")
- self.horizontalLayout.addWidget(self.left_pt)
- self.right_pt = QtWidgets.QSpinBox(self.groupBox)
- self.right_pt.setMaximum(999)
- self.right_pt.setObjectName("right_pt")
- self.horizontalLayout.addWidget(self.right_pt)
- self.average_combobox = QtWidgets.QComboBox(self.groupBox)
+ self.gridLayout.addWidget(self.peaktable, 1, 0, 1, 2)
+ self.special_checkbox = QtWidgets.QCheckBox(Form)
+ self.special_checkbox.setObjectName("special_checkbox")
+ self.gridLayout.addWidget(self.special_checkbox, 3, 0, 1, 1)
+ self.special_comboBox = QtWidgets.QComboBox(Form)
+ self.special_comboBox.setEnabled(False)
+ self.special_comboBox.setObjectName("special_comboBox")
+ self.special_comboBox.addItem("")
+ self.special_comboBox.addItem("")
+ self.special_comboBox.addItem("")
+ self.special_comboBox.addItem("")
+ self.gridLayout.addWidget(self.special_comboBox, 3, 1, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(20, 30, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
+ self.gridLayout.addItem(spacerItem, 4, 0, 1, 1)
+ self.label_3 = QtWidgets.QLabel(Form)
+ self.label_3.setObjectName("label_3")
+ self.gridLayout.addWidget(self.label_3, 5, 0, 1, 1)
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.left_limit = QtWidgets.QLineEdit(Form)
+ self.left_limit.setObjectName("left_limit")
+ self.horizontalLayout_2.addWidget(self.left_limit)
+ self.right_limit = QtWidgets.QLineEdit(Form)
+ self.right_limit.setObjectName("right_limit")
+ self.horizontalLayout_2.addWidget(self.right_limit)
+ self.limit_combobox = QtWidgets.QComboBox(Form)
+ self.limit_combobox.setObjectName("limit_combobox")
+ self.limit_combobox.addItem("")
+ self.limit_combobox.addItem("")
+ self.horizontalLayout_2.addWidget(self.limit_combobox)
+ self.gridLayout.addLayout(self.horizontalLayout_2, 5, 1, 1, 1)
+ self.label_5 = QtWidgets.QLabel(Form)
+ self.label_5.setObjectName("label_5")
+ self.gridLayout.addWidget(self.label_5, 6, 0, 1, 1)
+ self.average_combobox = QtWidgets.QComboBox(Form)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -47,90 +68,93 @@ class Ui_Form(object):
self.average_combobox.addItem("")
self.average_combobox.addItem("")
self.average_combobox.addItem("")
- self.horizontalLayout.addWidget(self.average_combobox)
- self.verticalLayout.addWidget(self.groupBox)
- self.groupBox_2 = QtWidgets.QGroupBox(Form)
- self.groupBox_2.setCheckable(True)
- self.groupBox_2.setChecked(False)
- self.groupBox_2.setObjectName("groupBox_2")
- self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.groupBox_2)
- self.horizontalLayout_5.setContentsMargins(3, 3, 3, 3)
- self.horizontalLayout_5.setSpacing(2)
- self.horizontalLayout_5.setObjectName("horizontalLayout_5")
- self.special_comboBox = QtWidgets.QComboBox(self.groupBox_2)
- self.special_comboBox.setObjectName("special_comboBox")
- self.special_comboBox.addItem("")
- self.special_comboBox.addItem("")
- self.special_comboBox.addItem("")
- self.special_comboBox.addItem("")
- self.horizontalLayout_5.addWidget(self.special_comboBox)
- self.verticalLayout.addWidget(self.groupBox_2)
- self.groupBox_3 = QtWidgets.QGroupBox(Form)
- self.groupBox_3.setObjectName("groupBox_3")
- self.gridLayout = QtWidgets.QGridLayout(self.groupBox_3)
- self.gridLayout.setContentsMargins(3, 3, 3, 3)
- self.gridLayout.setSpacing(3)
- self.gridLayout.setObjectName("gridLayout")
- self.xbutton = QtWidgets.QCheckBox(self.groupBox_3)
+ self.gridLayout.addWidget(self.average_combobox, 6, 1, 1, 1)
+ self.label_4 = QtWidgets.QLabel(Form)
+ self.label_4.setObjectName("label_4")
+ self.gridLayout.addWidget(self.label_4, 7, 0, 1, 1)
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.xbutton = QtWidgets.QCheckBox(Form)
self.xbutton.setObjectName("xbutton")
- self.gridLayout.addWidget(self.xbutton, 0, 0, 1, 1)
- self.ybutton = QtWidgets.QCheckBox(self.groupBox_3)
+ self.horizontalLayout.addWidget(self.xbutton)
+ self.ybutton = QtWidgets.QCheckBox(Form)
self.ybutton.setChecked(True)
self.ybutton.setObjectName("ybutton")
- self.gridLayout.addWidget(self.ybutton, 0, 1, 1, 1)
- self.graph_checkbox = QtWidgets.QCheckBox(self.groupBox_3)
+ self.horizontalLayout.addWidget(self.ybutton)
+ self.gridLayout.addLayout(self.horizontalLayout, 7, 1, 1, 1)
+ self.label = QtWidgets.QLabel(Form)
+ self.label.setObjectName("label")
+ self.gridLayout.addWidget(self.label, 8, 0, 1, 1)
+ self.group_box = QtWidgets.QComboBox(Form)
+ self.group_box.setObjectName("group_box")
+ self.group_box.addItem("")
+ self.group_box.addItem("")
+ self.gridLayout.addWidget(self.group_box, 8, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
+ self.gridLayout.addItem(spacerItem1, 9, 0, 1, 1)
+ self.graph_checkbox = QtWidgets.QCheckBox(Form)
self.graph_checkbox.setChecked(True)
self.graph_checkbox.setObjectName("graph_checkbox")
- self.gridLayout.addWidget(self.graph_checkbox, 1, 0, 1, 1)
- self.graph_combobox = QtWidgets.QComboBox(self.groupBox_3)
+ self.gridLayout.addWidget(self.graph_checkbox, 10, 0, 1, 1)
+ self.graph_combobox = QtWidgets.QComboBox(Form)
self.graph_combobox.setEnabled(False)
self.graph_combobox.setObjectName("graph_combobox")
- self.gridLayout.addWidget(self.graph_combobox, 1, 1, 1, 1)
- self.verticalLayout.addWidget(self.groupBox_3)
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1)
- self.horizontalLayout_2.setSpacing(2)
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.gridLayout.addWidget(self.graph_combobox, 10, 1, 1, 1)
+ spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridLayout.addItem(spacerItem2, 12, 0, 1, 1)
self.okButton = QtWidgets.QPushButton(Form)
icon = QtGui.QIcon.fromTheme("dialog-ok")
self.okButton.setIcon(icon)
self.okButton.setObjectName("okButton")
- self.horizontalLayout_2.addWidget(self.okButton)
+ self.gridLayout.addWidget(self.okButton, 11, 0, 1, 2)
self.deleteButton = QtWidgets.QPushButton(Form)
icon = QtGui.QIcon.fromTheme("dialog-cancel")
self.deleteButton.setIcon(icon)
self.deleteButton.setObjectName("deleteButton")
- self.horizontalLayout_2.addWidget(self.deleteButton)
- self.verticalLayout.addLayout(self.horizontalLayout_2)
+ self.gridLayout.addWidget(self.deleteButton, 2, 0, 1, 2)
+ self.label_2.setBuddy(self.peaktable)
+ self.label_5.setBuddy(self.average_combobox)
+ self.label_4.setBuddy(self.xbutton)
+ self.label.setBuddy(self.group_box)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
+ Form.setTabOrder(self.peaktable, self.limit_combobox)
+ Form.setTabOrder(self.limit_combobox, self.average_combobox)
+ Form.setTabOrder(self.average_combobox, self.xbutton)
+ Form.setTabOrder(self.xbutton, self.ybutton)
+ Form.setTabOrder(self.ybutton, self.group_box)
+ Form.setTabOrder(self.group_box, self.graph_checkbox)
+ Form.setTabOrder(self.graph_checkbox, self.graph_combobox)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
+ self.label_2.setText(_translate("Form", "Selected points and regions"))
self.peaktable.setToolTip(_translate("Form", "Edit by entering new value: \n"
"Single number for points (e.g. 1e-6); \n"
"two numbers separated by space for regions (e.g. 1e-6 5e-6). \n"
"Changing between regions and points is NOT possible"))
- self.groupBox.setTitle(_translate("Form", "Average (drop-down used for pts and regions)"))
- self.left_pt.setSuffix(_translate("Form", " pts"))
- self.left_pt.setPrefix(_translate("Form", "- "))
- self.right_pt.setSuffix(_translate("Form", " pts"))
- self.right_pt.setPrefix(_translate("Form", "+ "))
- self.average_combobox.setItemText(0, _translate("Form", "Mean"))
- self.average_combobox.setItemText(1, _translate("Form", "Sum"))
- self.average_combobox.setItemText(2, _translate("Form", "Integral"))
- self.average_combobox.setItemText(3, _translate("Form", "Std. deviation"))
- self.groupBox_2.setTitle(_translate("Form", "Special value"))
+ self.special_checkbox.setText(_translate("Form", "Use special value"))
self.special_comboBox.setToolTip(_translate("Form", "Automatic selection of respective points"))
self.special_comboBox.setItemText(0, _translate("Form", "max(y)"))
self.special_comboBox.setItemText(1, _translate("Form", "max(abs(y))"))
self.special_comboBox.setItemText(2, _translate("Form", "min(y)"))
self.special_comboBox.setItemText(3, _translate("Form", "min(abs(y))"))
- self.groupBox_3.setTitle(_translate("Form", "Result"))
+ self.label_3.setText(_translate("Form", "Region around points"))
+ self.limit_combobox.setItemText(0, _translate("Form", "points"))
+ self.limit_combobox.setItemText(1, _translate("Form", "range"))
+ self.label_5.setText(_translate("Form", "Aggregation"))
+ self.average_combobox.setItemText(0, _translate("Form", "Mean"))
+ self.average_combobox.setItemText(1, _translate("Form", "Sum"))
+ self.average_combobox.setItemText(2, _translate("Form", "Integral"))
+ self.average_combobox.setItemText(3, _translate("Form", "Std. deviation"))
+ self.label_4.setText(_translate("Form", "New set based on"))
self.xbutton.setText(_translate("Form", "x"))
self.ybutton.setText(_translate("Form", "y"))
+ self.label.setText(_translate("Form", "Group by"))
+ self.group_box.setItemText(0, _translate("Form", "\"Group\" value"))
+ self.group_box.setItemText(1, _translate("Form", "x value"))
self.graph_checkbox.setText(_translate("Form", "New graph?"))
self.okButton.setText(_translate("Form", "Apply"))
- self.deleteButton.setText(_translate("Form", "Delete selected"))
+ self.deleteButton.setText(_translate("Form", "Delete selection"))
diff --git a/src/gui_qt/data/point_select.py b/src/gui_qt/data/point_select.py
index 377ee38..b3d9eb7 100644
--- a/src/gui_qt/data/point_select.py
+++ b/src/gui_qt/data/point_select.py
@@ -1,6 +1,6 @@
import re
-from ..Qt import QtCore, QtWidgets
+from ..Qt import QtCore, QtWidgets, QtGui
from .._py.ptstab import Ui_Form
from ..lib.pg_objects import LogInfiniteLine, RegionItem
@@ -27,15 +27,23 @@ class PointSelectWidget(QtWidgets.QWidget, Ui_Form):
self._last_item = None
self.connected_figure = ''
+ self._avg_modes = ['mean', 'sum', 'integral', 'std']
+ self._special_values = ['max', 'absmax', 'min', 'absmin']
+ self._group_modes = ['group', 'x']
+
self.okButton.clicked.connect(self.apply)
self.deleteButton.clicked.connect(self.remove_points)
+
self.peaktable.itemChanged.connect(self.editing_finished)
self.peaktable.itemDoubleClicked.connect(self.editing_started)
+ self.left_limit.setValidator(QtGui.QDoubleValidator())
+ self.right_limit.setValidator(QtGui.QDoubleValidator())
+
def keyPressEvent(self, e):
- if e.key() == QtCore.Qt.Key_Delete:
+ if e.key() == QtCore.Qt.Key.Key_Delete:
self.remove_points()
- elif e.key() == QtCore.Qt.Key_F2:
+ elif e.key() == QtCore.Qt.Key.Key_F2:
self.editing_started()
else:
super().keyPressEvent(e)
@@ -102,21 +110,22 @@ class PointSelectWidget(QtWidgets.QWidget, Ui_Form):
@QtCore.pyqtSlot()
def apply(self) -> dict:
- ret_dic = {'avg_range': [self.left_pt.value(), self.right_pt.value()],
- 'avg_mode': {0: 'mean', 1: 'sum', 2: 'integral', 3: 'std'}[self.average_combobox.currentIndex()],
- 'special': None, 'idx': None,
- 'xy': (self.xbutton.isChecked(), self.ybutton.isChecked())}
+ ret_dic = {
+ 'avg_range': self.get_limits(),
+ 'avg_mode': self._avg_modes[self.average_combobox.currentIndex()],
+ 'special': None,
+ 'idx': None,
+ 'xy': (self.xbutton.isChecked(), self.ybutton.isChecked()),
+ 'groupby': self._group_modes[self.group_box.currentIndex()],
+ }
- if self.groupBox_2.isChecked():
- ret_dic['special'] = {0: 'max', 1: 'absmax', 2: 'min', 3: 'absmin'}[self.special_comboBox.currentIndex()]
+ if self.special_checkbox.isChecked():
+ ret_dic['special'] = self._special_values[self.special_comboBox.currentIndex()]
if len(self.pts) != 0:
ret_dic['idx'] = self.pts
- if self.graph_checkbox.isChecked():
- gid = ''
- else:
- gid = self.graph_combobox.currentData()
+ gid = self.graph_combobox.currentData() if not self.graph_checkbox.isChecked() else ''
self.points_selected.emit(ret_dic, gid)
@@ -200,3 +209,21 @@ class PointSelectWidget(QtWidgets.QWidget, Ui_Form):
@QtCore.pyqtSlot(int, name='on_graph_checkbox_stateChanged')
def changed_state(self, checked):
self.graph_combobox.setEnabled(checked != QtCore.Qt.CheckState.Checked)
+
+ @QtCore.pyqtSlot(int, name='on_special_checkbox_stateChanged')
+ def changed_special(self, checked: int):
+ self.graph_combobox.setEnabled(checked != QtCore.Qt.CheckState.Checked)
+
+ def get_limits(self) -> tuple[float, float, str]:
+ try:
+ left = float(self.left_limit.text())
+ except ValueError:
+ left = 0.
+
+ try:
+ right = float(self.right_limit.text())
+ except ValueError:
+ right = 0.
+
+ return left, right, self.limit_combobox.currentText()
+
diff --git a/src/gui_qt/graphs/graphwindow.py b/src/gui_qt/graphs/graphwindow.py
index 405e520..0ea6624 100644
--- a/src/gui_qt/graphs/graphwindow.py
+++ b/src/gui_qt/graphs/graphwindow.py
@@ -539,6 +539,10 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
if self.graphic.plotItem.sceneBoundingRect().contains(evt.scenePos()) and evt.button() == 1:
pos = vb.mapSceneToView(evt.scenePos())
+
+ if not _inside_range(pos.x(), pos.y(), vb.viewRange()):
+ return
+
_x, _y = pos.x(), pos.y()
if self.log[0]:
@@ -854,3 +858,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
self.set_color(foreground=self._prev_colors[0], background=self._prev_colors[1])
self._prev_colors = temp
+
+def _inside_range(x: float, y: float, ranges: list[list[float]]) -> bool:
+ x_range, y_range = ranges
+ return (x_range[0] <= x <= x_range[1]) and (y_range[0] <= y <= y_range[1])
\ No newline at end of file
diff --git a/src/gui_qt/main/management.py b/src/gui_qt/main/management.py
index 31553e3..8c923ae 100644
--- a/src/gui_qt/main/management.py
+++ b/src/gui_qt/main/management.py
@@ -791,16 +791,27 @@ class UpperManagement(QtCore.QObject):
_active = self.graphs[self.current_graph].active
new_datasets = {}
+ groupby = params.pop('groupby')
+
for sid in _active:
data_i = self.data[sid]
- if data_i.group not in new_datasets:
- new_datasets[data_i.group] = [], []
- new_x_axis, _temp = new_datasets[data_i.group]
-
pts = data_i.points(params)
- if pts:
- new_x_axis.append(data_i.value)
- _temp.append(pts)
+
+ if groupby == 'group':
+ if data_i.group not in new_datasets:
+ new_datasets[data_i.group] = [], []
+ new_x_axis, _temp = new_datasets[data_i.group]
+ if pts:
+ new_x_axis.append(data_i.value)
+ _temp.append(pts)
+
+ else:
+ for (_x, _y, _yerr) in pts:
+ if _x not in new_datasets:
+ new_datasets[_x] = [], []
+ new_x_axis, _temp = new_datasets[_x]
+ new_x_axis.append(data_i.value)
+ _temp.append([[_x, _y, _yerr]])
key_list = []
for label, (new_x_axis, _temp) in new_datasets.items():
diff --git a/src/nmreval/data/points.py b/src/nmreval/data/points.py
index 656c685..4f7ec6b 100644
--- a/src/nmreval/data/points.py
+++ b/src/nmreval/data/points.py
@@ -273,9 +273,14 @@ class Points:
def length(self):
return len(self._x)
- def points(self, idx: list = None, special: str = None,
- avg_range: tuple[int, int] = (0, 0), avg_mode: str = 'mean',
- pts: list = None) -> list[tuple]:
+ def points(
+ self,
+ idx: list = None,
+ special: str = None,
+ avg_range: tuple[int, int] = (0, 0),
+ avg_mode: str = 'mean',
+ pts: list = None,
+ ) -> list[tuple]:
"""
Return (x, y) values at specified positions.
diff --git a/src/nmreval/models/transitions.py b/src/nmreval/models/transitions.py
index 217903f..ed80f59 100644
--- a/src/nmreval/models/transitions.py
+++ b/src/nmreval/models/transitions.py
@@ -4,16 +4,26 @@ from scipy import special as special
from ..utils import kB
-class Weight2Phase:
+class Weight:
type = 'Line shape'
name = 'Weighting factor'
- equation = r'A*[0.5 + 0.5 erf[(x-T_{0})/\DeltaT]] + A_{0}'
+ equation = r'A * [0.5 \pm 0.5 erf[(x-T_{0})/\DeltaT]] + A_{0}'
params = ['T_{0}', r'\DeltaT', 'A', 'A_{0}']
+ choices = [('Direction', 'sign', {'increase': '+', 'decrease': '-'})]
bounds = [(0, None), (0, None), (None, None), (None, None)]
@staticmethod
- def func(x, t0, dt, amp, off):
- return amp*(0.5 + 0.5*special.erf((x-t0)/dt)) + off
+ def func(x: np.ndarray | float, t0: float, dt: float, amp: float, off: float, sign: str = '+') -> np.ndarray | float:
+ if sign not in '+-':
+ raise ValueError(f"`value` is `+` or `-`, not {sign}")
+
+ error_func = 1
+ if sign == '+':
+ error_func += special.erf((x-t0)/dt)
+ else:
+ error_func -= special.erf((x - t0) / dt)
+
+ return amp * error_func / 2. + off
class HendricksonBray:
@@ -24,5 +34,5 @@ class HendricksonBray:
bounds = [(0, None)] * 4
@staticmethod
- def func(x, a, b, e, w0):
+ def func(x: np.ndarray | float, a: float, b: float, e: float, w0: float) -> np.ndarray | float:
return a*b / (b + (a-b)*np.exp(-e/kB/x)) + w0
diff --git a/src/resources/_ui/asciidialog.ui b/src/resources/_ui/asciidialog.ui
index 5492220..89839dc 100644
--- a/src/resources/_ui/asciidialog.ui
+++ b/src/resources/_ui/asciidialog.ui
@@ -336,7 +336,7 @@
- <html><head/><body><p>Token:<br/>[abc]: Matches any of a, b, or c<br/>[a-z]: Matches any digit in the range a-z<br/>\d: Matches any digit in the range 0-9 (equal to [0-9}</p><p>Quantifiers:<br/>a*: 0 or more of a<br/>a*: 1 or more of a<br/>a?: 0 or 1 of a</p></body></html>
+ <html><head/><body><p>Token:<br/>[abc]: Matches any of a, b, or c<br/>[a-z]: Matches any digit in the range a-z<br/>\d: Matches any digit in the range 0-9 (equal to [0-9}</p><p>Quantifiers:<br/>a+: 0 or more of a<br/>a*: 1 or more of a<br/>a?: 0 or 1 of a</p></body></html>
diff --git a/src/resources/_ui/ptstab.ui b/src/resources/_ui/ptstab.ui
index d7c31ef..16701cb 100644
--- a/src/resources/_ui/ptstab.ui
+++ b/src/resources/_ui/ptstab.ui
@@ -6,27 +6,25 @@
0
0
- 316
- 747
+ 417
+ 746
Form
-
-
- 3
-
-
- 3
-
-
- 3
-
-
- 3
-
- -
+
+
-
+
+
+ Selected points and regions
+
+
+ peaktable
+
+
+
+ -
Edit by entering new value:
@@ -39,235 +37,268 @@ Changing between regions and points is NOT possible
- -
-
-
- Average (drop-down used for pts and regions)
+
-
+
+
+ Use special value
-
-
- 3
-
-
- 3
-
-
- 3
-
-
- 3
-
-
- 3
-
-
-
-
-
- pts
-
-
- -
-
-
- 999
-
-
-
- -
-
-
- pts
-
-
- +
-
-
- 999
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- Mean
-
-
- -
-
- Sum
-
-
- -
-
- Integral
-
-
- -
-
- Std. deviation
-
-
-
-
-
- -
-
-
- Special value
-
-
- true
-
-
+
-
+
+
false
-
-
- 2
-
-
- 3
-
-
- 3
-
-
- 3
-
-
- 3
-
-
-
-
-
- Automatic selection of respective points
-
-
-
-
- max(y)
-
-
- -
-
- max(abs(y))
-
-
- -
-
- min(y)
-
-
- -
-
- min(abs(y))
-
-
-
-
-
-
-
- -
-
-
- Result
-
-
-
- 3
-
-
- 3
-
-
- 3
-
-
- 3
-
-
- 3
-
-
-
-
-
- x
-
-
-
- -
-
-
- y
-
-
- true
-
-
-
- -
-
-
- New graph?
-
-
- true
-
-
-
- -
-
-
- false
-
-
-
-
-
-
- -
-
-
- 2
-
-
- 0
+
+ Automatic selection of respective points
-
-
+
+ max(y)
+
+
+ -
+
+ max(abs(y))
+
+
+ -
+
+ min(y)
+
+
+ -
+
+ min(abs(y))
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 30
+
+
+
+
+ -
+
+
+ Region around points
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ -
+
+
-
+
+ points
+
+
+ -
+
+ range
+
+
+
+
+
+
+ -
+
+
+ Aggregation
+
+
+ average_combobox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ Mean
+
+
+ -
+
+ Sum
+
+
+ -
+
+ Integral
+
+
+ -
+
+ Std. deviation
+
+
+
+
+ -
+
+
+ New set based on
+
+
+ xbutton
+
+
+
+ -
+
+
-
+
- Apply
-
-
-
- ..
+ x
-
-
+
- Delete selected
+ y
-
-
- ..
+
+ true
+ -
+
+
+ Group by
+
+
+ group_box
+
+
+
+ -
+
+
-
+
+ "Group" value
+
+
+ -
+
+ x value
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 20
+
+
+
+
+ -
+
+
+ New graph?
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Expanding
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Apply
+
+
+
+ ..
+
+
+
+ -
+
+
+ Delete selection
+
+
+
+ ..
+
+
+
+
+ peaktable
+ limit_combobox
+ average_combobox
+ xbutton
+ ybutton
+ group_box
+ graph_checkbox
+ graph_combobox
+