From 09a2b61160395a58893c58cb77e60728b28e9e7d Mon Sep 17 00:00:00 2001
From: Dominik Demuth
Date: Fri, 19 May 2023 13:02:58 +0200
Subject: [PATCH] read text files as BDS and DSC
---
src/gui_qt/_py/asciidialog.py | 245 +++++++++--------
src/gui_qt/io/asciireader.py | 4 +-
src/gui_qt/io/dscreader.py | 1 +
src/nmreval/data/dsc.py | 5 +-
src/nmreval/io/asciireader.py | 28 +-
src/resources/_ui/asciidialog.ui | 438 +++++++++++++++++--------------
6 files changed, 402 insertions(+), 319 deletions(-)
diff --git a/src/gui_qt/_py/asciidialog.py b/src/gui_qt/_py/asciidialog.py
index 66ceccf..feac8f5 100644
--- a/src/gui_qt/_py/asciidialog.py
+++ b/src/gui_qt/_py/asciidialog.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'src/resources/_ui/asciidialog.ui'
#
-# Created by: PyQt5 UI code generator 5.15.7
+# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
@@ -28,92 +28,25 @@ class Ui_ascii_reader(object):
self.header_widget.setObjectName("header_widget")
self.verticalLayout_3.addWidget(self.header_widget)
self.groupBox = QtWidgets.QGroupBox(self.tabWidgetPage1)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth())
+ self.groupBox.setSizePolicy(sizePolicy)
self.groupBox.setObjectName("groupBox")
- self.gridLayout = QtWidgets.QGridLayout(self.groupBox)
- self.gridLayout.setContentsMargins(3, 3, 3, 3)
- self.gridLayout.setHorizontalSpacing(9)
- self.gridLayout.setObjectName("gridLayout")
- self.FID_radioButton = QtWidgets.QRadioButton(self.groupBox)
- self.FID_radioButton.setAutoExclusive(True)
- self.FID_radioButton.setObjectName("FID_radioButton")
- self.buttonGroup = QtWidgets.QButtonGroup(ascii_reader)
- self.buttonGroup.setObjectName("buttonGroup")
- self.buttonGroup.addButton(self.FID_radioButton)
- self.gridLayout.addWidget(self.FID_radioButton, 2, 1, 1, 1)
- self.x_lineedit = QtWidgets.QLineEdit(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.x_lineedit.sizePolicy().hasHeightForWidth())
- self.x_lineedit.setSizePolicy(sizePolicy)
- self.x_lineedit.setInputMethodHints(QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers)
- self.x_lineedit.setObjectName("x_lineedit")
- self.gridLayout.addWidget(self.x_lineedit, 1, 3, 1, 1)
- self.y_label = QtWidgets.QLabel(self.groupBox)
- self.y_label.setObjectName("y_label")
- self.gridLayout.addWidget(self.y_label, 2, 2, 1, 1)
- self.pts_radioButton = QtWidgets.QRadioButton(self.groupBox)
- self.pts_radioButton.setChecked(True)
- self.pts_radioButton.setAutoExclusive(True)
- self.pts_radioButton.setObjectName("pts_radioButton")
- self.buttonGroup.addButton(self.pts_radioButton)
- self.gridLayout.addWidget(self.pts_radioButton, 1, 1, 1, 1)
- self.deltay_lineEdit = QtWidgets.QLineEdit(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.deltay_lineEdit.sizePolicy().hasHeightForWidth())
- self.deltay_lineEdit.setSizePolicy(sizePolicy)
- self.deltay_lineEdit.setObjectName("deltay_lineEdit")
- self.gridLayout.addWidget(self.deltay_lineEdit, 3, 3, 1, 1)
- self.label_5 = QtWidgets.QLabel(self.groupBox)
- self.label_5.setObjectName("label_5")
- self.gridLayout.addWidget(self.label_5, 3, 2, 1, 1)
+ self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.groupBox)
+ self.horizontalLayout_4.setContentsMargins(3, 3, 3, 3)
+ self.horizontalLayout_4.setObjectName("horizontalLayout_4")
+ self.verticalLayout_6 = QtWidgets.QVBoxLayout()
+ self.verticalLayout_6.setObjectName("verticalLayout_6")
self.column_checkBox = QtWidgets.QCheckBox(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.column_checkBox.sizePolicy().hasHeightForWidth())
self.column_checkBox.setSizePolicy(sizePolicy)
self.column_checkBox.setObjectName("column_checkBox")
- self.gridLayout.addWidget(self.column_checkBox, 0, 0, 1, 1)
- self.label = QtWidgets.QLabel(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, 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, 1, 1, 1)
- self.label_7 = QtWidgets.QLabel(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth())
- self.label_7.setSizePolicy(sizePolicy)
- self.label_7.setObjectName("label_7")
- self.gridLayout.addWidget(self.label_7, 0, 2, 1, 2)
- self.y_lineedit = QtWidgets.QLineEdit(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.y_lineedit.sizePolicy().hasHeightForWidth())
- self.y_lineedit.setSizePolicy(sizePolicy)
- self.y_lineedit.setInputMethodHints(QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers)
- self.y_lineedit.setObjectName("y_lineedit")
- self.gridLayout.addWidget(self.y_lineedit, 2, 3, 1, 1)
- self.spectrum_radioButton = QtWidgets.QRadioButton(self.groupBox)
- self.spectrum_radioButton.setObjectName("spectrum_radioButton")
- self.buttonGroup.addButton(self.spectrum_radioButton)
- self.gridLayout.addWidget(self.spectrum_radioButton, 3, 1, 1, 1)
- self.x_label = QtWidgets.QLabel(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.x_label.sizePolicy().hasHeightForWidth())
- self.x_label.setSizePolicy(sizePolicy)
- self.x_label.setObjectName("x_label")
- self.gridLayout.addWidget(self.x_label, 1, 2, 1, 1)
+ self.verticalLayout_6.addWidget(self.column_checkBox)
self.line_spinBox = QtWidgets.QSpinBox(self.groupBox)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -122,17 +55,114 @@ class Ui_ascii_reader(object):
self.line_spinBox.setSizePolicy(sizePolicy)
self.line_spinBox.setMinimum(1)
self.line_spinBox.setObjectName("line_spinBox")
- self.gridLayout.addWidget(self.line_spinBox, 1, 0, 1, 1)
+ self.verticalLayout_6.addWidget(self.line_spinBox)
+ self.label_6 = QtWidgets.QLabel(self.groupBox)
+ self.label_6.setObjectName("label_6")
+ self.verticalLayout_6.addWidget(self.label_6)
self.preview_spinBox = QtWidgets.QSpinBox(self.groupBox)
self.preview_spinBox.setMinimum(1)
self.preview_spinBox.setProperty("value", 10)
self.preview_spinBox.setObjectName("preview_spinBox")
- self.gridLayout.addWidget(self.preview_spinBox, 3, 0, 1, 1)
- self.label_6 = QtWidgets.QLabel(self.groupBox)
- self.label_6.setObjectName("label_6")
- self.gridLayout.addWidget(self.label_6, 2, 0, 1, 1)
+ self.verticalLayout_6.addWidget(self.preview_spinBox)
+ spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.verticalLayout_6.addItem(spacerItem)
+ self.horizontalLayout_4.addLayout(self.verticalLayout_6)
+ self.verticalLayout_5 = QtWidgets.QVBoxLayout()
+ self.verticalLayout_5.setObjectName("verticalLayout_5")
+ self.label = QtWidgets.QLabel(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
+ self.label.setSizePolicy(sizePolicy)
+ self.label.setObjectName("label")
+ self.verticalLayout_5.addWidget(self.label)
+ self.pts_radioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.pts_radioButton.setChecked(True)
+ self.pts_radioButton.setAutoExclusive(True)
+ self.pts_radioButton.setObjectName("pts_radioButton")
+ self.buttonGroup = QtWidgets.QButtonGroup(ascii_reader)
+ self.buttonGroup.setObjectName("buttonGroup")
+ self.buttonGroup.addButton(self.pts_radioButton)
+ self.verticalLayout_5.addWidget(self.pts_radioButton)
+ self.dsc_radioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.dsc_radioButton.setObjectName("dsc_radioButton")
+ self.buttonGroup.addButton(self.dsc_radioButton)
+ self.verticalLayout_5.addWidget(self.dsc_radioButton)
+ self.FID_radioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.FID_radioButton.setAutoExclusive(True)
+ self.FID_radioButton.setObjectName("FID_radioButton")
+ self.buttonGroup.addButton(self.FID_radioButton)
+ self.verticalLayout_5.addWidget(self.FID_radioButton)
+ self.spectrum_radioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.spectrum_radioButton.setObjectName("spectrum_radioButton")
+ self.buttonGroup.addButton(self.spectrum_radioButton)
+ self.verticalLayout_5.addWidget(self.spectrum_radioButton)
+ self.bds_radioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.bds_radioButton.setObjectName("bds_radioButton")
+ self.buttonGroup.addButton(self.bds_radioButton)
+ self.verticalLayout_5.addWidget(self.bds_radioButton)
+ self.horizontalLayout_4.addLayout(self.verticalLayout_5)
+ self.gridLayout_2 = QtWidgets.QGridLayout()
+ self.gridLayout_2.setObjectName("gridLayout_2")
+ self.deltay_lineEdit = QtWidgets.QLineEdit(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.deltay_lineEdit.sizePolicy().hasHeightForWidth())
+ self.deltay_lineEdit.setSizePolicy(sizePolicy)
+ self.deltay_lineEdit.setObjectName("deltay_lineEdit")
+ self.gridLayout_2.addWidget(self.deltay_lineEdit, 3, 1, 1, 1)
+ self.label_7 = QtWidgets.QLabel(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth())
+ self.label_7.setSizePolicy(sizePolicy)
+ self.label_7.setObjectName("label_7")
+ self.gridLayout_2.addWidget(self.label_7, 0, 0, 1, 2)
+ self.y_lineedit = QtWidgets.QLineEdit(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.y_lineedit.sizePolicy().hasHeightForWidth())
+ self.y_lineedit.setSizePolicy(sizePolicy)
+ self.y_lineedit.setInputMethodHints(QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers)
+ self.y_lineedit.setObjectName("y_lineedit")
+ self.gridLayout_2.addWidget(self.y_lineedit, 2, 1, 1, 1)
+ self.y_label = QtWidgets.QLabel(self.groupBox)
+ self.y_label.setObjectName("y_label")
+ self.gridLayout_2.addWidget(self.y_label, 2, 0, 1, 1)
+ self.x_lineedit = QtWidgets.QLineEdit(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.x_lineedit.sizePolicy().hasHeightForWidth())
+ self.x_lineedit.setSizePolicy(sizePolicy)
+ self.x_lineedit.setInputMethodHints(QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers)
+ self.x_lineedit.setObjectName("x_lineedit")
+ self.gridLayout_2.addWidget(self.x_lineedit, 1, 1, 1, 1)
+ self.label_5 = QtWidgets.QLabel(self.groupBox)
+ self.label_5.setObjectName("label_5")
+ self.gridLayout_2.addWidget(self.label_5, 3, 0, 1, 1)
+ self.x_label = QtWidgets.QLabel(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.x_label.sizePolicy().hasHeightForWidth())
+ self.x_label.setSizePolicy(sizePolicy)
+ self.x_label.setObjectName("x_label")
+ self.gridLayout_2.addWidget(self.x_label, 1, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridLayout_2.addItem(spacerItem1, 4, 1, 1, 1)
+ self.horizontalLayout_4.addLayout(self.gridLayout_2)
self.verticalLayout_3.addWidget(self.groupBox)
self.groupBox_2 = QtWidgets.QGroupBox(self.tabWidgetPage1)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth())
+ self.groupBox_2.setSizePolicy(sizePolicy)
self.groupBox_2.setObjectName("groupBox_2")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2)
self.verticalLayout_2.setContentsMargins(3, 3, 3, 3)
@@ -215,15 +245,15 @@ class Ui_ascii_reader(object):
self.pushButton.setSizePolicy(sizePolicy)
self.pushButton.setObjectName("pushButton")
self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.pushButton)
- spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
- self.formLayout.setItem(6, QtWidgets.QFormLayout.FieldRole, spacerItem)
+ spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.formLayout.setItem(6, QtWidgets.QFormLayout.FieldRole, spacerItem2)
self.horizontalLayout_3.addLayout(self.formLayout)
self.tabWidget.addTab(self.tabWidgetPage2, "")
self.verticalLayout.addWidget(self.tabWidget)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
- spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem1)
+ spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout.addItem(spacerItem3)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1)
@@ -231,8 +261,8 @@ class Ui_ascii_reader(object):
self.skippy_checkbox = QtWidgets.QCheckBox(ascii_reader)
self.skippy_checkbox.setObjectName("skippy_checkbox")
self.horizontalLayout_2.addWidget(self.skippy_checkbox)
- spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.horizontalLayout_2.addItem(spacerItem2)
+ spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_2.addItem(spacerItem4)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.buttonbox = QtWidgets.QDialogButtonBox(ascii_reader)
self.buttonbox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
@@ -243,16 +273,7 @@ class Ui_ascii_reader(object):
self.tabWidget.setCurrentIndex(0)
self.buttonbox.rejected.connect(ascii_reader.close) # type: ignore
QtCore.QMetaObject.connectSlotsByName(ascii_reader)
- ascii_reader.setTabOrder(self.tabWidget, self.column_checkBox)
- ascii_reader.setTabOrder(self.column_checkBox, self.line_spinBox)
- ascii_reader.setTabOrder(self.line_spinBox, self.preview_spinBox)
- ascii_reader.setTabOrder(self.preview_spinBox, self.pts_radioButton)
- ascii_reader.setTabOrder(self.pts_radioButton, self.FID_radioButton)
- ascii_reader.setTabOrder(self.FID_radioButton, self.spectrum_radioButton)
- ascii_reader.setTabOrder(self.spectrum_radioButton, self.x_lineedit)
- ascii_reader.setTabOrder(self.x_lineedit, self.y_lineedit)
- ascii_reader.setTabOrder(self.y_lineedit, self.deltay_lineEdit)
- ascii_reader.setTabOrder(self.deltay_lineEdit, self.ascii_table)
+ ascii_reader.setTabOrder(self.tabWidget, self.ascii_table)
ascii_reader.setTabOrder(self.ascii_table, self.skippy_checkbox)
ascii_reader.setTabOrder(self.skippy_checkbox, self.delay_textfield)
ascii_reader.setTabOrder(self.delay_textfield, self.delay_lineedit)
@@ -267,19 +288,21 @@ class Ui_ascii_reader(object):
_translate = QtCore.QCoreApplication.translate
ascii_reader.setWindowTitle(_translate("ascii_reader", "Read text file"))
self.groupBox.setTitle(_translate("ascii_reader", "Options"))
- self.FID_radioButton.setText(_translate("ascii_reader", "FID"))
- self.x_lineedit.setToolTip(_translate("ascii_reader", "
Specify which column is used as x-value.
"))
- self.y_label.setText(_translate("ascii_reader", "y"))
- self.pts_radioButton.setText(_translate("ascii_reader", "Points"))
- self.label_5.setText(_translate("ascii_reader", "Δy
"))
self.column_checkBox.setText(_translate("ascii_reader", "Column name"))
- self.label.setText(_translate("ascii_reader", "Import as"))
- self.label_7.setText(_translate("ascii_reader", "Use columns as"))
- self.y_lineedit.setToolTip(_translate("ascii_reader", "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.)
"))
- self.spectrum_radioButton.setText(_translate("ascii_reader", "Spectrum"))
- self.x_label.setText(_translate("ascii_reader", "x"))
self.line_spinBox.setPrefix(_translate("ascii_reader", "header line "))
self.label_6.setText(_translate("ascii_reader", "Preview length"))
+ self.label.setText(_translate("ascii_reader", "Import as"))
+ self.pts_radioButton.setText(_translate("ascii_reader", "Points"))
+ self.dsc_radioButton.setText(_translate("ascii_reader", "DSC"))
+ self.FID_radioButton.setText(_translate("ascii_reader", "FID"))
+ self.spectrum_radioButton.setText(_translate("ascii_reader", "Spectrum"))
+ self.bds_radioButton.setText(_translate("ascii_reader", "BDS"))
+ self.label_7.setText(_translate("ascii_reader", "Use columns as"))
+ self.y_lineedit.setToolTip(_translate("ascii_reader", "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.)
"))
+ self.y_label.setText(_translate("ascii_reader", "y"))
+ self.x_lineedit.setToolTip(_translate("ascii_reader", "Specify which column is used as x-value.
"))
+ self.label_5.setText(_translate("ascii_reader", "Δy
"))
+ self.x_label.setText(_translate("ascii_reader", "x"))
self.groupBox_2.setTitle(_translate("ascii_reader", "Preview"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), _translate("ascii_reader", "Data"))
self.label_2.setText(_translate("ascii_reader", "Number of delays"))
diff --git a/src/gui_qt/io/asciireader.py b/src/gui_qt/io/asciireader.py
index 4a41bc0..153b069 100644
--- a/src/gui_qt/io/asciireader.py
+++ b/src/gui_qt/io/asciireader.py
@@ -167,7 +167,6 @@ class QAsciiReader(QtWidgets.QDialog, Ui_ascii_reader):
# default row for x is the first row, it will be superseded if an integer number is given.
try:
x = int(self.x_lineedit.text())-1
- print(x)
except ValueError:
x = None
@@ -199,7 +198,7 @@ class QAsciiReader(QtWidgets.QDialog, Ui_ascii_reader):
col_names=col_header)
self.data_read.emit(ret_dic)
- except Exception as e:
+ except ImportError as e:
_ = QtWidgets.QMessageBox.information(self, 'Reading failed',
f'Import data failed with {e.args}')
@@ -211,5 +210,4 @@ class QAsciiReader(QtWidgets.QDialog, Ui_ascii_reader):
@QtCore.pyqtSlot(int, name='on_skippy_checkbox_stateChanged')
def skip_next_dial(self, _: int):
- print('skippy das buschkänguru', _)
self.skip = self.skippy_checkbox.isChecked()
diff --git a/src/gui_qt/io/dscreader.py b/src/gui_qt/io/dscreader.py
index d83a46f..b672a78 100644
--- a/src/gui_qt/io/dscreader.py
+++ b/src/gui_qt/io/dscreader.py
@@ -254,6 +254,7 @@ class QDSCReader(QtWidgets.QDialog, Ui_Dialog):
if filesave:
new_val.savetxt(self.fname.with_name(f'{self.fname.stem} {rate}K-min {mode}.dat'.replace(' ', '_')))
+ close_after = False
else:
self.data_read.emit([new_val])
diff --git a/src/nmreval/data/dsc.py b/src/nmreval/data/dsc.py
index 69d3ba9..5f7c95d 100644
--- a/src/nmreval/data/dsc.py
+++ b/src/nmreval/data/dsc.py
@@ -18,12 +18,13 @@ from ..dsc.tnmh_model import TNMH
class DSC(Points):
def __init__(self, x, y, **kwargs):
+
+ y = np.asarray(y).reshape(np.asarray(x).shape)
+
x, unique = np.unique(x, return_index=True)
super().__init__(x, y[unique], **kwargs)
- self.meta['is_fictive'] = False
-
def get_fictive_cp(self, glass: tuple[float, float], liquid: tuple[float, float]) -> ('DSC', float):
min_glass, max_glass = min(glass), max(glass)
min_liquid, max_liquid = min(liquid), max(liquid)
diff --git a/src/nmreval/io/asciireader.py b/src/nmreval/io/asciireader.py
index 04fd19e..a998cc8 100644
--- a/src/nmreval/io/asciireader.py
+++ b/src/nmreval/io/asciireader.py
@@ -7,6 +7,8 @@ import numpy as np
from ..data.points import Points
from ..data.nmr import FID, Spectrum
+from ..data.bds import BDS
+from ..data.dsc import DSC
from ..utils.utils import staggered_range
NUMBERRE = re.compile(r'[0-9]\.*[0-9]*[Ee]*[+-]*[0-9]*')
@@ -88,7 +90,12 @@ class AsciiReader:
self.delays = staggered_range(self.delays, stepsize=stag_size)
def export(self, x: int = None, y: list = None, yerr: list = None,
- mode: str = 'Points', col_names=None) -> list:
+ mode: str = 'points', col_names=None) -> list:
+
+ mode = mode.lower()
+ if mode not in ['points', 'fid', 'spectrum', 'dsc', 'bds']:
+ raise ValueError(f'Unknown mode {mode!r} as selected class')
+
if yerr is None:
yerr = []
elif y is None:
@@ -141,20 +148,15 @@ class AsciiReader:
kwargs = {'value': value, 'filename': self.fname, 'name': filename, 'group': filename, 'y_err': None}
num_y = len(y)
- if mode == 'Points':
- single_len = 1
- cls = Points
- stepsize = 1
- elif mode == 'FID':
- cls = FID
+ single_len = 1
+ stepsize = 1
+
+ if mode in ['spectrum', 'fid', 'bds']:
+ # complex data types
single_len = 2
stepsize = 2
- elif mode == 'Spectrum':
- cls = Spectrum
- single_len = 2
- stepsize = 2
- else:
- raise ValueError(f'Unknown mode {mode}, mot ´Points´, ´FID´ or ´Spectrum´.')
+
+ cls = {'points': Points, 'fid': FID, 'spectrum': Spectrum, 'bds': BDS, 'dsc': DSC}[mode]
for j in range(1, num_y+1, stepsize):
if col_names is not None:
diff --git a/src/resources/_ui/asciidialog.ui b/src/resources/_ui/asciidialog.ui
index cb9e338..4813898 100644
--- a/src/resources/_ui/asciidialog.ui
+++ b/src/resources/_ui/asciidialog.ui
@@ -41,10 +41,16 @@
-
+
+
+ 0
+ 0
+
+
Options
-
+
3
@@ -57,194 +63,255 @@
3
-
- 9
-
-
-
-
-
- FID
-
-
- true
-
-
- buttonGroup
-
-
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Column name
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ header line
+
+
+ 1
+
+
+
+ -
+
+
+ Preview length
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
- -
-
-
-
- 0
- 0
-
-
-
- <html><head/><body><p>Specify which column is used as x-value.</p></body></html>
-
-
- Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers
-
-
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Import as
+
+
+
+ -
+
+
+ Points
+
+
+ true
+
+
+ true
+
+
+ buttonGroup
+
+
+
+ -
+
+
+ DSC
+
+
+ buttonGroup
+
+
+
+ -
+
+
+ FID
+
+
+ true
+
+
+ buttonGroup
+
+
+
+ -
+
+
+ Spectrum
+
+
+ buttonGroup
+
+
+
+ -
+
+
+ BDS
+
+
+ buttonGroup
+
+
+
+
- -
-
-
- y
-
-
-
- -
-
-
- Points
-
-
- true
-
-
- true
-
-
- buttonGroup
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- <html><head/><body><p>Δy</p></body></html>
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Column name
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Import as
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Use columns as
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- <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>
-
-
- Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers
-
-
-
- -
-
-
- Spectrum
-
-
- buttonGroup
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- x
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- header line
-
-
- 1
-
-
-
- -
-
-
- 1
-
-
- 10
-
-
-
- -
-
-
- Preview length
-
-
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Use columns as
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ <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>
+
+
+ Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers
+
+
+
+ -
+
+
+ y
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ <html><head/><body><p>Specify which column is used as x-value.</p></body></html>
+
+
+ Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers
+
+
+
+ -
+
+
+ <html><head/><body><p>Δy</p></body></html>
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ x
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
-
+
+
+ 0
+ 0
+
+
Preview
@@ -489,15 +556,6 @@
tabWidget
- column_checkBox
- line_spinBox
- preview_spinBox
- pts_radioButton
- FID_radioButton
- spectrum_radioButton
- x_lineedit
- y_lineedit
- deltay_lineEdit
ascii_table
skippy_checkbox
delay_textfield