calculate t1 for generalized gamma
This commit is contained in:
@ -31,7 +31,7 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
self.t1calculator = RelaxationEvaluation()
|
||||
|
||||
self.sd_parameter = []
|
||||
self.sdmodels = [Debye, ColeCole, ColeDavidson, KWW, HavriliakNegami, LogGaussian]
|
||||
self.sdmodels = [Debye, ColeCole, ColeDavidson, KWW, HavriliakNegami, LogGaussian, GGAlpha]
|
||||
for i in self.sdmodels:
|
||||
self.specdens_combobox.addItem(i.name)
|
||||
self.specdens_combobox.currentIndexChanged.connect(self.update_specdens)
|
||||
@ -51,8 +51,14 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
self.conv_y = QT1Widget.time_conversion[self.t1_combobox.currentIndex()]
|
||||
|
||||
self.minimum = (1, np.inf)
|
||||
self.min_pos = PlotItem(x=np.array([]), y=np.array([]),
|
||||
symbol='+', symbolBrush=mkBrush(color='r'), symbolPen=mkPen(color='r'), symbolSize=14)
|
||||
self.min_pos = PlotItem(
|
||||
x=np.array([]),
|
||||
y=np.array([]),
|
||||
symbol='+',
|
||||
symbolBrush=mkBrush(color='r'),
|
||||
symbolPen=mkPen(color='r'),
|
||||
symbolSize=14,
|
||||
)
|
||||
self.parabola = PlotItem(x=np.array([]), y=np.array([]))
|
||||
|
||||
self.lineEdit_2.setValidator(QtGui.QDoubleValidator())
|
||||
@ -83,10 +89,10 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
right_b = min(np.argmin(y)+3, len(x)-1)
|
||||
|
||||
self.lineEdit_2.blockSignals(True)
|
||||
self.lineEdit_2.setText('{:.2f}'.format(x[left_b]))
|
||||
self.lineEdit_2.setText(f'{x[left_b]:.2f}')
|
||||
self.lineEdit_2.blockSignals(False)
|
||||
self.lineEdit_3.blockSignals(True)
|
||||
self.lineEdit_3.setText('{:.2f}'.format(x[right_b]))
|
||||
self.lineEdit_3.setText(f'{x[right_b]:.2f}')
|
||||
self.lineEdit_3.blockSignals(False)
|
||||
|
||||
self.t1calculator.set_data(x, y)
|
||||
@ -110,6 +116,7 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
|
||||
if self.sdmodels[idx].parameter is not None:
|
||||
for name in self.sdmodels[idx].parameter:
|
||||
print(name)
|
||||
_temp = FormWidget(parent=self, name=name, fixable=True)
|
||||
_temp.value = 1
|
||||
_temp.setChecked(True)
|
||||
@ -133,7 +140,7 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
try:
|
||||
for i, v, in enumerate(values):
|
||||
self.sd_parameter[i].blockSignals(True)
|
||||
self.sd_parameter[i].value = '{:.3g}'.format(round(v, 3))
|
||||
self.sd_parameter[i].value = f'{v:.3g}'
|
||||
self.sd_parameter[i].blockSignals(False)
|
||||
except IndexError:
|
||||
pass
|
||||
@ -219,7 +226,7 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
self.update_model()
|
||||
|
||||
@QtCore.pyqtSlot(int, name='on_interpol_combobox_currentIndexChanged')
|
||||
def determine_minimum(self, idx):
|
||||
def determine_minimum(self, idx: int):
|
||||
if idx == 0:
|
||||
self.checkBox_interpol.setChecked(False)
|
||||
self.checkBox_interpol.hide()
|
||||
@ -229,9 +236,10 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
self.checkBox_interpol.show()
|
||||
self.frame.show()
|
||||
try:
|
||||
m, i_func = self.t1calculator.calculate_t1_min(interpolate=idx,
|
||||
trange=(float(self.lineEdit_2.text()),
|
||||
float(self.lineEdit_3.text())))
|
||||
m, i_func = self.t1calculator.calculate_t1_min(
|
||||
interpolate=idx,
|
||||
trange=(float(self.lineEdit_2.text()), float(self.lineEdit_3.text())),
|
||||
)
|
||||
except ValueError:
|
||||
m, i_func = self.t1calculator.calculate_t1_min(interpolate=None)
|
||||
|
||||
@ -273,11 +281,13 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
return
|
||||
|
||||
with busy_cursor():
|
||||
calc_stretching, mini = self.t1calculator.get_increase(height=self.minimum[1],
|
||||
idx=var_idx, mode=notfix,
|
||||
omega=2*np.pi*self.frequency,
|
||||
dist_parameter=sd_args, prefactor=cp_args,
|
||||
coupling_kwargs=cp_kwargs)
|
||||
calc_stretching, mini = self.t1calculator.get_increase(
|
||||
height=self.minimum[1],
|
||||
idx=var_idx, mode=notfix,
|
||||
omega=2*np.pi*self.frequency,
|
||||
dist_parameter=sd_args, prefactor=cp_args,
|
||||
coupling_kwargs=cp_kwargs
|
||||
)
|
||||
|
||||
self.label_t1min.setText(f'{mini:.4g} s')
|
||||
|
||||
@ -292,9 +302,13 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
sd_args, _ = self.get_sd_values()
|
||||
cp_args, cp_kwargs, _ = self.get_cp_values()
|
||||
tau_mode = ['fit', 'peak', 'mean', 'logmean'][self.tau_combox.currentIndex()]
|
||||
corr, opts = self.t1calculator.correlation_from_t1(omega=2*np.pi*self.frequency, dist_parameter=sd_args,
|
||||
coupling_param=cp_args, coupling_kwargs=cp_kwargs,
|
||||
mode=tau_mode, interpolate=self.checkBox_interpol.isChecked())
|
||||
corr, opts = self.t1calculator.correlation_from_t1(
|
||||
omega=2*np.pi*self.frequency,
|
||||
dist_parameter=sd_args,
|
||||
coupling_param=cp_args, coupling_kwargs=cp_kwargs,
|
||||
mode=tau_mode,
|
||||
interpolate=self.checkBox_interpol.isChecked()
|
||||
)
|
||||
|
||||
name = self.name + '-' + str(self.t1calculator) + '('
|
||||
name += ','.join([f'{a:.3g}' for a in sd_args])
|
||||
@ -332,4 +346,4 @@ class QT1Widget(QtWidgets.QDialog, Ui_t1dialog):
|
||||
|
||||
@QtCore.pyqtSlot(int, name='on_graph_checkbox_stateChanged')
|
||||
def changed_state(self, checked):
|
||||
self.graph_combobox.setEnabled(checked != QtCore.Qt.Checked)
|
||||
self.graph_combobox.setEnabled(checked != QtCore.Qt.CheckState.Checked)
|
||||
|
Reference in New Issue
Block a user