read text files as BDS and DSC

This commit is contained in:
Dominik Demuth 2023-05-19 13:02:58 +02:00
parent fcaf43b3eb
commit 09a2b61160
6 changed files with 402 additions and 319 deletions

View File

@ -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", "<html><head/><body><p>Specify which column is used as x-value.</p></body></html>"))
self.y_label.setText(_translate("ascii_reader", "y"))
self.pts_radioButton.setText(_translate("ascii_reader", "Points"))
self.label_5.setText(_translate("ascii_reader", "<html><head/><body><p>Δy</p></body></html>"))
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", "<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.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", "<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.y_label.setText(_translate("ascii_reader", "y"))
self.x_lineedit.setToolTip(_translate("ascii_reader", "<html><head/><body><p>Specify which column is used as x-value.</p></body></html>"))
self.label_5.setText(_translate("ascii_reader", "<html><head/><body><p>Δy</p></body></html>"))
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"))

View File

@ -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()

View File

@ -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])

View File

@ -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)

View File

@ -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
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:

View File

@ -41,10 +41,16 @@
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>3</number>
</property>
@ -57,82 +63,12 @@
<property name="bottomMargin">
<number>3</number>
</property>
<property name="horizontalSpacing">
<number>9</number>
</property>
<item row="2" column="1">
<widget class="QRadioButton" name="FID_radioButton">
<property name="text">
<string>FID</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="x_lineedit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Specify which column is used as x-value.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="y_label">
<property name="text">
<string>y</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="pts_radioButton">
<property name="text">
<string>Points</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item row="3" column="3">
<widget class="QLineEdit" name="deltay_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Δy&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="column_checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -142,72 +78,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Import as</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use columns as</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLineEdit" name="y_lineedit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QRadioButton" name="spectrum_radioButton">
<property name="text">
<string>Spectrum</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="x_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QSpinBox" name="line_spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -223,7 +94,14 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Preview length</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="preview_spinBox">
<property name="minimum">
<number>1</number>
@ -233,18 +111,207 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Preview length</string>
<string>Import as</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="pts_radioButton">
<property name="text">
<string>Points</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="dsc_radioButton">
<property name="text">
<string>DSC</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="FID_radioButton">
<property name="text">
<string>FID</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="spectrum_radioButton">
<property name="text">
<string>Spectrum</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="bds_radioButton">
<property name="text">
<string>BDS</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="1">
<widget class="QLineEdit" name="deltay_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use columns as</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="y_lineedit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="y_label">
<property name="text">
<string>y</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="x_lineedit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Specify which column is used as x-value.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Δy&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="x_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Preview</string>
</property>
@ -489,15 +556,6 @@
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>column_checkBox</tabstop>
<tabstop>line_spinBox</tabstop>
<tabstop>preview_spinBox</tabstop>
<tabstop>pts_radioButton</tabstop>
<tabstop>FID_radioButton</tabstop>
<tabstop>spectrum_radioButton</tabstop>
<tabstop>x_lineedit</tabstop>
<tabstop>y_lineedit</tabstop>
<tabstop>deltay_lineEdit</tabstop>
<tabstop>ascii_table</tabstop>
<tabstop>skippy_checkbox</tabstop>
<tabstop>delay_textfield</tabstop>