forked from IPKM/nmreval
removed __name__ == __main__
This commit is contained in:
parent
73e4a2b4d9
commit
a300182153
@ -14,10 +14,6 @@ from ..utils import NUMBER_RE
|
||||
|
||||
PointLike = TypeVar('PointLike', bound='Points')
|
||||
|
||||
"""
|
||||
This is a test for all and everything
|
||||
"""
|
||||
|
||||
|
||||
class Points:
|
||||
"""
|
||||
@ -514,11 +510,19 @@ class Points:
|
||||
|
||||
return self
|
||||
|
||||
def cut(self, *limits):
|
||||
if len(limits) != 2:
|
||||
def cut(self, low_lim=None, high_lim=None):
|
||||
"""
|
||||
Cut
|
||||
Args:
|
||||
low_lim:
|
||||
high_lim:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if low_lim is None and high_lim is None:
|
||||
raise ValueError('Two arguments are needed')
|
||||
|
||||
low_lim, high_lim = limits
|
||||
if low_lim is None:
|
||||
low_lim = np.min(self._x)
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
import abc
|
||||
from typing import Any, Union
|
||||
|
||||
|
||||
import numpy as np
|
||||
|
||||
from nmreval.lib.utils import ArrayLike
|
||||
from ..lib.utils import ArrayLike
|
||||
|
||||
|
||||
class Distribution(abc.ABC):
|
||||
|
@ -163,19 +163,3 @@ class ColeDavidson(Distribution):
|
||||
|
||||
"""
|
||||
return gammaincc(gamma, t / tau)
|
||||
|
||||
|
||||
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()
|
||||
|
@ -97,28 +97,3 @@ class EnergyBarriers(Distribution):
|
||||
@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()
|
||||
|
@ -81,19 +81,3 @@ class FFHS(Distribution):
|
||||
# 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()
|
||||
|
@ -2,8 +2,8 @@ import numpy as np
|
||||
from scipy.interpolate import interp1d
|
||||
from scipy.special import gamma
|
||||
|
||||
from nmreval.lib.decorator import adjust_dims
|
||||
from .base import Distribution
|
||||
from ..lib.decorator import adjust_dims
|
||||
from ..math.kww import kww_cos, kww_sin
|
||||
from ..utils.constants import Eu
|
||||
|
||||
@ -61,25 +61,3 @@ class KWW(Distribution):
|
||||
@staticmethod
|
||||
def max(tau, beta):
|
||||
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()
|
||||
|
@ -3,7 +3,7 @@ from itertools import product
|
||||
|
||||
import numpy as np
|
||||
|
||||
from nmreval.lib.decorator import adjust_dims
|
||||
from ..lib.decorator import adjust_dims
|
||||
|
||||
try:
|
||||
from scipy.integrate import simpson
|
||||
@ -122,19 +122,3 @@ def _integrand_freq_real_low(u, omega, tau, sigma):
|
||||
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()
|
||||
|
@ -49,7 +49,7 @@ class ExperimentContainer(QtCore.QObject):
|
||||
try:
|
||||
return self._data[item]
|
||||
except KeyError:
|
||||
raise KeyError('Unknown key %s' % str(item))
|
||||
raise KeyError('Unknown key %s' % str(item)) from None
|
||||
|
||||
def __del__(self):
|
||||
del self._data
|
||||
@ -65,13 +65,23 @@ class ExperimentContainer(QtCore.QObject):
|
||||
|
||||
def copy(self, full: bool = False):
|
||||
if full:
|
||||
# pen_dict = {
|
||||
# 'symbol': self.plot_real.symbol,
|
||||
# 'symbolcolor': self.plot_real.symbolcolor,
|
||||
# 'symbolsize': self.plot_real.symbolsize,
|
||||
# 'linestyle': self.plot_real.linestyle,
|
||||
# 'linecolor': self.plot_real.linecolor,
|
||||
# 'linewidth': self.plot_real.linewidth,
|
||||
# }
|
||||
|
||||
new_data = type(self)(str(self.id), self._data.copy(), manager=self._manager)
|
||||
new_data.mode = self.mode
|
||||
|
||||
for src, dest in [(self.plot_real, new_data.plot_real), (self.plot_imag, new_data.plot_imag)]:
|
||||
if src is not None:
|
||||
dest.set_symbol(symbol=src.symbol, size=src.symbolsize, color=src.symbolcolor)
|
||||
dest.set_line(style=src.linestyle, width=src.linewidth, color=src.linecolor)
|
||||
# if self.plot_imag is not None:
|
||||
# new_data.plot_imag.set_symbol(symbol=self.plot_imag.symbol, size=self.plot_imag.symbolsize,
|
||||
# color=self.plot_imag.symbolcolor)
|
||||
# new_data.plot_imag.set_line(style=self.plot_imag.linestyle, width=self.plot_imag.linewidth,
|
||||
# color=self.plot_imag.linecolor)
|
||||
|
||||
return new_data
|
||||
|
||||
@ -86,16 +96,28 @@ class ExperimentContainer(QtCore.QObject):
|
||||
else:
|
||||
raise TypeError('Unknown data type')
|
||||
|
||||
# pen_dict = {
|
||||
# 'symbol': self.plot_real.symbol,
|
||||
# 'symbolcolor': self.plot_real.symbolcolor,
|
||||
# 'symbolsize': self.plot_real.symbolsize,
|
||||
# 'linestyle': self.plot_real.linestyle,
|
||||
# 'linecolor': self.plot_real.linecolor,
|
||||
# 'linewidth': self.plot_real.linewidth,
|
||||
# }
|
||||
|
||||
new_data = new_type(str(self.id), data, manager=self._manager)
|
||||
|
||||
for src, dest in [(self.plot_real, new_data.plot_real), (self.plot_imag, new_data.plot_imag)]:
|
||||
if dest is not None:
|
||||
if src is not None:
|
||||
dest.set_symbol(symbol=src.symbol, size=src.symbolsize, color=src.symbolcolor)
|
||||
dest.set_line(style=src.linestyle, width=src.linewidth, color=src.linecolor)
|
||||
else:
|
||||
dest.set_symbol(symbol=self.plot_real.symbol, size=self.plot_real.symbolsize, color=self.plot_real.symbolcolor)
|
||||
dest.set_line(style=self.plot_real.linestyle, width=self.plot_real.linewidth, color=self.plot_real.linecolor)
|
||||
# if new_data.plot_imag is not None:
|
||||
# if self.plot_imag is not None:
|
||||
# new_data.plot_imag.set_symbol(symbol=self.plot_imag.symbol, size=self.plot_imag.symbolsize,
|
||||
# color=self.plot_imag.symbolcolor)
|
||||
# new_data.plot_imag.set_line(style=self.plot_imag.linestyle, width=self.plot_imag.linewidth,
|
||||
# color=self.plot_imag.linecolor)
|
||||
# else:
|
||||
# new_data.plot_imag.set_symbol(symbol=self.plot_real.symbol, size=self.plot_real.symbolsize,
|
||||
# color=self.plot_real.symbolcolor)
|
||||
# new_data.plot_imag.set_line(style=self.plot_real.linestyle, width=self.plot_real.linewidth,
|
||||
# color=self.plot_real.linecolor)
|
||||
|
||||
return new_data
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from nmreval.gui_qt.Qt import QtWidgets, QtCore, QtGui
|
||||
from nmreval.gui_qt._py.typeconversion import Ui_Dialog
|
||||
from ..Qt import QtWidgets, QtCore, QtGui
|
||||
from .._py.typeconversion import Ui_Dialog
|
||||
|
||||
|
||||
class ConversionDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
@ -150,20 +150,3 @@ class ConversionDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
else:
|
||||
self.collect_args()
|
||||
self.accept()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
d = ConversionDialog()
|
||||
|
||||
data = OrderedDict([
|
||||
(('1', 'Graph 0'), [('a', 'Das Sein und das Nichts'), ('b', 'b'), ('c', 'c'), ('d', 'd')]),
|
||||
(('2', 'Graph 2'), [('e', 'e'), ('f', 'f'), ('g', 'g'), ('h', 'h')])])
|
||||
|
||||
d.set_graphs(data)
|
||||
d.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -324,6 +324,9 @@ class DataTree(QtWidgets.QTreeWidget):
|
||||
idx = {}
|
||||
has_fits = False
|
||||
for i in self.selectedIndexes():
|
||||
if i.column() == 0:
|
||||
continue
|
||||
|
||||
item = self.itemFromIndex(i)
|
||||
parent = item.parent()
|
||||
if parent is None:
|
||||
|
@ -112,12 +112,3 @@ class QPlotDialog(QtWidgets.QDialog, Ui_NewCurveDialog):
|
||||
|
||||
lw = self.doubleSpinBox.value()
|
||||
sw = self.spinBox.value()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
win = QPlotDialog()
|
||||
win.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -174,17 +174,3 @@ class SpinBoxDelegate(QtWidgets.QStyledItemDelegate):
|
||||
# geht bestimmt besser...
|
||||
table = self.sender().parent().parent()
|
||||
self.valueChanged.emit(table.currentRow(), table.currentColumn(), val)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
mplQt = QShift()
|
||||
xx = np.geomspace(1, 100)
|
||||
mplQt.add_item('aa', 'a', xx, xx/(1+xx**2)*10)
|
||||
mplQt.add_item('bb', 'b', xx, xx/(1+(0.1*xx)**2))
|
||||
mplQt.add_item('cc', 'c', xx, xx/(1+(0.01*xx)**2)/10)
|
||||
mplQt.set_graphs([('123', 'zyx'), ('456', 'wvu')])
|
||||
mplQt.show()
|
||||
sys.exit(app.exec())
|
||||
|
@ -1,15 +1,15 @@
|
||||
from itertools import cycle, count
|
||||
from typing import List, Tuple, Union
|
||||
|
||||
from nmreval.configs import config_paths
|
||||
from .fit_forms import FitModelTree
|
||||
from ..lib import get_icon
|
||||
from .._py.fitfunctionwidget import Ui_Form
|
||||
from ..Qt import QtWidgets, QtCore, QtGui
|
||||
from ...configs import config_paths
|
||||
from ... import models
|
||||
from ...lib.importer import find_models
|
||||
from ...lib.colors import BaseColor, Tab10
|
||||
from ...utils.text import convert
|
||||
from ..Qt import QtWidgets, QtCore, QtGui
|
||||
from .._py.fitfunctionwidget import Ui_Form
|
||||
from .fit_forms import FitModelTree
|
||||
from ..lib import get_icon
|
||||
|
||||
|
||||
class QFunctionWidget(QtWidgets.QWidget, Ui_Form):
|
||||
@ -223,18 +223,3 @@ class QFunctionWidget(QtWidgets.QWidget, Ui_Form):
|
||||
|
||||
self.complex_comboBox.setCurrentIndex(0)
|
||||
self.complex_widget.hide()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from numpy.random import choice
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
qw = choice(QtWidgets.QStyleFactory.keys())
|
||||
|
||||
app.setStyle(QtWidgets.QStyleFactory.create(qw))
|
||||
|
||||
fd = QFunctionWidget()
|
||||
fd.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -1,14 +1,14 @@
|
||||
from itertools import count, cycle
|
||||
from string import ascii_letters
|
||||
|
||||
from pyqtgraph import PlotDataItem, mkPen
|
||||
from pyqtgraph import mkPen
|
||||
|
||||
from nmreval.gui_qt.lib.pg_objects import PlotItem
|
||||
from ...fit._meta import MultiModel, ModelFactory
|
||||
from ..Qt import QtGui, QtCore, QtWidgets
|
||||
from .._py.fitdialog import Ui_FitDialog
|
||||
from .fit_forms import FitTableWidget
|
||||
from .fit_parameter import QFitParameterWidget
|
||||
from ..lib.pg_objects import PlotItem
|
||||
from ..Qt import QtGui, QtCore, QtWidgets
|
||||
from .._py.fitdialog import Ui_FitDialog
|
||||
from ...fit._meta import MultiModel, ModelFactory
|
||||
|
||||
|
||||
class QFitDialog(QtWidgets.QWidget, Ui_FitDialog):
|
||||
@ -434,22 +434,3 @@ class QFitDialog(QtWidgets.QWidget, Ui_FitDialog):
|
||||
self.preview_lines = []
|
||||
|
||||
super().closeEvent(evt)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from numpy.random import choice
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
# while qw == 'QtCurve':
|
||||
qw = choice(QtWidgets.QStyleFactory.keys())
|
||||
app.setStyle(QtWidgets.QStyleFactory.create(qw))
|
||||
|
||||
fd = QFitDialog()
|
||||
|
||||
fd.load([('fff', 'testtesttesttest'),
|
||||
('ggg', 'testtesttesttesttest'),
|
||||
('hhh', 'testtesttesttesttesttest')])
|
||||
fd.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -3,8 +3,8 @@ import re
|
||||
import numexpr as ne
|
||||
import numpy as np
|
||||
|
||||
from nmreval.gui_qt.Qt import QtCore, QtWidgets
|
||||
from nmreval.gui_qt._py.fitcreationdialog import Ui_Dialog
|
||||
from ..Qt import QtCore, QtWidgets
|
||||
from .._py.fitcreationdialog import Ui_Dialog
|
||||
|
||||
|
||||
_numexpr_funcs = []
|
||||
@ -236,12 +236,3 @@ def func_decorator(f_string):
|
||||
return ne.evaluate(f_string, local_dict=namespace)
|
||||
|
||||
return wrapped_f
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication([])
|
||||
w = QUserFitCreator()
|
||||
w.show()
|
||||
sys.exit(app.exec())
|
||||
|
@ -145,22 +145,3 @@ class LineWidget(QtWidgets.QWidget, Ui_Form):
|
||||
pos = line.value()
|
||||
text_item = self.tableWidget.item(i, 0)
|
||||
text_item.setText(text_item.text()[:4]+f'{pos:.4g}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from numpy.random import choice
|
||||
|
||||
app = QtWidgets.QApplication([])
|
||||
|
||||
qw = 'QtCurve'
|
||||
while qw == 'QtCurve':
|
||||
qw = choice(QtWidgets.QStyleFactory.keys())
|
||||
print(qw)
|
||||
app.setStyle(QtWidgets.QStyleFactory.create(qw))
|
||||
|
||||
mplQt = LineWidget()
|
||||
mplQt.show()
|
||||
mplQt.set_graphs([('a', 'a'), ('b', 'b')])
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -73,17 +73,3 @@ class QMover(QtWidgets.QDialog, Ui_MoveDialog):
|
||||
self.entries = {}
|
||||
|
||||
super().close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
global propData
|
||||
|
||||
app = QtWidgets.QApplication([])
|
||||
|
||||
m = QMover()
|
||||
m.setup({('a', '1'): ('z', '100'), ('b', '2'): ('y', '99'), ('c', '3'): ('x', '98')})
|
||||
|
||||
m.show()
|
||||
|
||||
sys.exit(app.exec())
|
@ -1,6 +1,6 @@
|
||||
from nmreval.io.bds_reader import BDSReader
|
||||
from nmreval.gui_qt.Qt import QtCore, QtWidgets
|
||||
from nmreval.gui_qt._py.bdsdialog import Ui_Dialog
|
||||
from ...io.bds_reader import BDSReader
|
||||
from ..Qt import QtCore, QtWidgets
|
||||
from .._py.bdsdialog import Ui_Dialog
|
||||
|
||||
|
||||
class QBDSReader(QtWidgets.QDialog, Ui_Dialog):
|
||||
@ -75,16 +75,3 @@ class QBDSReader(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.data_read.emit(data)
|
||||
|
||||
super().accept()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
reader = QBDSReader()
|
||||
# reader('/autohome/dominik/nmreval/testdata/ZWEITECHANCE_EGD4H2O.EPS')
|
||||
# reader('/autohome/dominik/nmreval/testdata/MZ-ME/CHLOROFORM_2017-02-06.EPS')
|
||||
reader('/autohome/dominik/nmreval/testdata/SBA_5P4NM_ISOCHRON_150-300K_18-03-22.EPS')
|
||||
reader.show()
|
||||
sys.exit(app.exec())
|
||||
|
@ -4,11 +4,10 @@ from typing import Union
|
||||
import numpy as np
|
||||
from pyqtgraph import PlotDataItem
|
||||
|
||||
from nmreval.data.points import Points
|
||||
from nmreval.io.dsc import Cyclohexane, DSCCalibrator, DSCSample
|
||||
|
||||
from nmreval.gui_qt.Qt import QtWidgets, QtCore
|
||||
from nmreval.gui_qt._py.dscfile_dialog import Ui_Dialog
|
||||
from ..Qt import QtWidgets, QtCore
|
||||
from .._py.dscfile_dialog import Ui_Dialog
|
||||
from ...data.points import Points
|
||||
from ...io.dsc import Cyclohexane, DSCCalibrator, DSCSample
|
||||
|
||||
|
||||
class QDSCReader(QtWidgets.QDialog, Ui_Dialog):
|
||||
@ -260,14 +259,3 @@ class ReferenceComboBox(QtWidgets.QComboBox):
|
||||
|
||||
def get_reference(self):
|
||||
return self.references[self.currentIndex()]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
reader = QDSCReader(sample='/autohome/dominik/nmreval/testdata/dsc/20m_LiTFSI_H2O.txt',
|
||||
empty='/autohome/dominik/nmreval/testdata/dsc/leer.txt',
|
||||
reference='/autohome/dominik/nmreval/testdata/dsc/cyclohexan_10K-min.txt')
|
||||
reader.show()
|
||||
sys.exit(app.exec())
|
||||
|
@ -105,12 +105,3 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
|
||||
grp = self.graph_comboBox.currentData(QtCore.Qt.UserRole)
|
||||
|
||||
self.data_read.emit(ret_vals, grp)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication([])
|
||||
qfc = QFCReader()
|
||||
qfc.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -127,7 +127,3 @@ class QFileReader(QtCore.QObject):
|
||||
|
||||
# nothing matched, text file is best guess
|
||||
return 'txt'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
|
@ -98,13 +98,3 @@ class QGraceReader(QtWidgets.QDialog, Ui_Dialog):
|
||||
def close(self):
|
||||
self._reader.clear()
|
||||
super().close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
reader = QGraceReader()
|
||||
reader.read('/autohome/dominik/nmreval/testdata/02_relax_2.agr')
|
||||
reader.show()
|
||||
sys.exit(app.exec())
|
||||
|
@ -182,15 +182,3 @@ class HDFTreeWidget(QtWidgets.QTreeWidget):
|
||||
for i in range(item.childCount()):
|
||||
child = item.child(i)
|
||||
child.setCheckState(column, state)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication([])
|
||||
# w = QHdfViewer('/autohome/dominik/nmreval/testdata/fc_test/abc.h5')
|
||||
w = QHdfViewer('/autohome/dominik/nmreval/testdata/L8_313K_17O_GG_KG_2020-12-02_1535.h5')
|
||||
|
||||
w.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -63,16 +63,3 @@ class QSaveFit(QtWidgets.QDialog, Ui_fitparameter_save_dialog):
|
||||
|
||||
def accept(self):
|
||||
super().accept()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication([])
|
||||
|
||||
dialog = QSaveFit()
|
||||
dialog.set_parameter({'fit1': ['p1', 'p2'], 'fit2': ['p2', 'p3']})
|
||||
|
||||
dialog.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -1,7 +1,7 @@
|
||||
from nmreval.configs import config_paths
|
||||
from nmreval.gui_qt.Qt import QtWidgets, QtCore, QtGui
|
||||
from nmreval.gui_qt._py.color_palette import Ui_Dialog
|
||||
from nmreval.lib.colors import Colors, get_palettes
|
||||
from ...configs import config_paths
|
||||
from ..Qt import QtWidgets, QtCore, QtGui
|
||||
from .._py.color_palette import Ui_Dialog
|
||||
from ...lib.colors import Colors, get_palettes
|
||||
|
||||
|
||||
class PaletteDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
@ -78,12 +78,3 @@ class PaletteDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
if idx != -1:
|
||||
self.palette_combobox.setCurrentIndex(idx)
|
||||
self.set_palette(clear=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication([])
|
||||
d = PaletteDialog()
|
||||
d.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -381,10 +381,3 @@ class QSliderText(QtWidgets.QWidget):
|
||||
def setValue(self, value: int):
|
||||
self.slider.setValue(value)
|
||||
self.value.setText(f'{value} %')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
application = QtWidgets.QApplication(sys.argv)
|
||||
qGameOfLife = QGameOfLife()
|
||||
qGameOfLife.show()
|
||||
sys.exit(application.exec())
|
||||
|
@ -1,4 +1,3 @@
|
||||
import sys
|
||||
import os.path
|
||||
import json
|
||||
import urllib.request
|
||||
@ -109,11 +108,3 @@ class QPokemon(QtWidgets.QDialog, Ui_Dialog):
|
||||
new_number = len(self._js)
|
||||
self._id = new_number
|
||||
self.show_pokemon(f'{new_number:03d}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
w = QPokemon(number=807)
|
||||
w.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -1,8 +1,8 @@
|
||||
import random
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
from nmreval.gui_qt.Qt import QtWidgets, QtCore, QtGui
|
||||
from ..Qt import QtWidgets, QtCore, QtGui
|
||||
|
||||
|
||||
__all__ = ['Game']
|
||||
@ -493,10 +493,3 @@ class MirrorL(Tetromino):
|
||||
SHAPE = np.array([[1, 0, 0, 0],
|
||||
[-1, -1, 0, 1]])
|
||||
color = 'lightGray'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QtWidgets.QApplication([])
|
||||
tetris = Game('snake')
|
||||
tetris.show()
|
||||
sys.exit(app.exec_())
|
||||
|
@ -130,14 +130,3 @@ class QUsermodelEditor(QtWidgets.QMainWindow):
|
||||
evt.ignore()
|
||||
else:
|
||||
super().closeEvent(evt)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication([])
|
||||
|
||||
win = QUsermodelEditor('/autohome/dominik/.nmreval/myfitmodels.py')
|
||||
win.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
||||
|
@ -289,7 +289,11 @@ class UpperManagement(QtCore.QObject):
|
||||
value_set = set()
|
||||
|
||||
if src_sets is None:
|
||||
src_sets = self.graphs[self.current_graph].active
|
||||
if self.current_graph:
|
||||
src_sets = self.graphs[self.current_graph].active
|
||||
else:
|
||||
return
|
||||
|
||||
for sid in src_sets:
|
||||
data_i = self.data[sid]
|
||||
if joined is None:
|
||||
@ -355,8 +359,9 @@ class UpperManagement(QtCore.QObject):
|
||||
self.undostack.endMacro()
|
||||
|
||||
def cut(self):
|
||||
xlim, _ = self.graphs[self.current_graph].ranges
|
||||
self.apply('cut', xlim)
|
||||
if self.current_graph:
|
||||
xlim, _ = self.graphs[self.current_graph].ranges
|
||||
self.apply('cut', xlim)
|
||||
|
||||
@QtCore.pyqtSlot()
|
||||
def unmask(self):
|
||||
|
@ -100,21 +100,3 @@ class QEvalDialog(QtWidgets.QDialog, Ui_CalcDialog):
|
||||
else:
|
||||
# keine Ahnung, warum man hier landen sollte ...
|
||||
self.success = False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication([])
|
||||
names = Namespace(basic=True)
|
||||
names.add_namespace({'g[0].s[0].x': (1,), 'g[0].s[0].y': (4,)}, parents=('Data', 'S0 (G0)'))
|
||||
names.add_namespace({'g[0].s[1].x': (2,), 'g[0].s[1].y': (5,)}, parents=('Data', 'S1 (G0)'))
|
||||
names.add_namespace({'g[1].s[2].x': (3,), 'g[1].s[2].y': (6,),
|
||||
"g[1].s[2].fit['C']": (7,), "g[1].s[2].fit['D_0']": (8,)},
|
||||
parents=('Data', 'S0 (G1)'))
|
||||
|
||||
dialog = QEvalDialog(mode='c')
|
||||
dialog.set_namespace(names)
|
||||
dialog.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -89,21 +89,3 @@ class InterpolDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
success = self.collect_parameter()
|
||||
if success:
|
||||
super().accept()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication([])
|
||||
from numpy.random import choice
|
||||
|
||||
qw = 'QtCurve'
|
||||
while qw == 'QtCurve':
|
||||
qw = choice(QtWidgets.QStyleFactory.keys())
|
||||
print(qw)
|
||||
app.setStyle(QtWidgets.QStyleFactory.create(qw))
|
||||
|
||||
mplQt = InterpolDialog()
|
||||
mplQt.show()
|
||||
|
||||
sys.exit(app.exec())
|
@ -45,13 +45,3 @@ class QSmooth(QtWidgets.QDialog, Ui_SmoothDialog):
|
||||
def close(self):
|
||||
self.disconnect()
|
||||
super().close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication([])
|
||||
|
||||
w = QSmooth()
|
||||
w.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -67,11 +67,3 @@ class QCoupCalcDialog(QtWidgets.QDialog, Ui_coupling_calc_dialog):
|
||||
kw.update(pp.value)
|
||||
|
||||
self.label.setText('Coupling constant: %.8g' % self.cp[self.comboBox.currentIndex()].relax(*p))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
w = QCoupCalcDialog()
|
||||
w.show()
|
||||
sys.exit(app.exec())
|
||||
|
@ -1,7 +1,7 @@
|
||||
from typing import List, Tuple
|
||||
|
||||
from ...nmr.coupling import *
|
||||
from ...distributions import ColeCole, ColeDavidson, HavriliakNegami, KWW
|
||||
from ...distributions import ColeCole, ColeDavidson, HavriliakNegami, KWW, LogGaussian
|
||||
from ...utils import pi
|
||||
from ...utils.text import convert
|
||||
|
||||
@ -20,7 +20,7 @@ class QRelaxCalc(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.graphs = {}
|
||||
|
||||
self.specdens = [ColeCole, ColeDavidson, HavriliakNegami, KWW]
|
||||
self.coupling = [Quadrupolar, Czjzek, HomoDipolar]
|
||||
self.coupling = [Quadrupolar, HomoDipolar, Czjzek]
|
||||
self.tau_parameter = []
|
||||
|
||||
for line_edit in [self.ea_lineEdit, self.tau0_lineEdit, self.start_lineEdit, self.stop_lineEdit,
|
||||
@ -199,13 +199,3 @@ class QRelaxCalc(QtWidgets.QDialog, Ui_Dialog):
|
||||
def accept(self):
|
||||
self.calc_relaxation()
|
||||
super().accept()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
w = QRelaxCalc()
|
||||
w.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
@ -386,14 +386,3 @@ class FCReader:
|
||||
@staticmethod
|
||||
def kww(x, m0, off, t1, beta):
|
||||
return m0 * np.exp(-(x/t1)**beta) + off
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test = ['/autohome/dominik/nmreval/testdata/fc_test/abc298K.h5',
|
||||
'/autohome/dominik/nmreval/testdata/fc_test/abc.h5']
|
||||
|
||||
fc_reader = FCReader(test)
|
||||
fc_reader.load_magnetization(region=(90e-6, 120e-6), overwrite=True)
|
||||
fc_reader.fit(save_fits=True, save_fig=True)
|
||||
fc_reader.get_parameter(path='/autohome/dominik/nmreval/testdata/fc_test', kind='temp', write=True, plot=True)
|
||||
fc_reader.get_parameter(path='/autohome/dominik/nmreval/testdata/fc_test', kind='freq', write=True, plot=True)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import sys
|
||||
import logging.handlers
|
||||
|
||||
from nmreval.configs import config_paths
|
||||
from ..configs import config_paths
|
||||
|
||||
ERROR_LOG = config_paths() / 'errors.log'
|
||||
# initialize logger stuff
|
||||
|
@ -256,11 +256,3 @@ def optimum_unbounded_region(phi_s_j, pj, log_epsilon):
|
||||
h_j = 0
|
||||
|
||||
return mu_j, h_j, n_j
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import matplotlib.pyplot as plt
|
||||
xvalue = np.geomspace(1e-3, 100, num=20) # np.array([1+1j])
|
||||
# plt.semilogx(xvalue, mlf(-xvalue, a=0.8, b=0.3, flag=False))
|
||||
plt.semilogx(xvalue, mlf(-xvalue, a=0.8, b=0.3))
|
||||
plt.show()
|
||||
|
@ -139,35 +139,3 @@ def xyz_to_spherical(x, y, z):
|
||||
ph = np.arctan2(y, x)
|
||||
|
||||
return r, th, ph
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import matplotlib.pyplot as plt
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
|
||||
if True:
|
||||
fig2, (ax2, ax3, ax4) = plt.subplots(3, 1, sharex=True)
|
||||
for i in [alderman]: # sophe, grid_planar, grid_spherical, random_planar, random_spherical, zcw_planar, zcw_spherical
|
||||
fig = plt.figure(str(i))
|
||||
ax = fig.add_subplot(211, projection='3d')
|
||||
|
||||
ax5 = fig.add_subplot(212)
|
||||
|
||||
a, b, wt = i(150)
|
||||
x, y, z = spherical_to_xyz(a, b)
|
||||
ax.scatter(xs=x, ys=y, zs=z)
|
||||
ax2.plot(np.linspace(0, 1, num=len(a)), a)
|
||||
ax3.plot(np.linspace(0, 1, num=len(a)), b)
|
||||
ax4.plot(np.linspace(0, 1, num=len(a)), wt)
|
||||
|
||||
ax5.plot(a*180/pi, b*180/pi, 'o')
|
||||
|
||||
ax5.set_xticks([0., 90, 180, 270, 360])
|
||||
ax5.set_xticklabels(['0', '90', '180', '270', '360'])
|
||||
ax5.set_yticks([0., 90, 180])
|
||||
ax5.set_yticklabels(['0', '90', '180'])
|
||||
|
||||
ax5.set_xlim([0, 360])
|
||||
ax5.set_ylim([0, 180])
|
||||
|
||||
plt.show()
|
||||
|
@ -355,29 +355,3 @@ def sec_order(p, x, spin=2.5):
|
||||
ret_val = s
|
||||
|
||||
return ret_val / trapz(ret_val, x)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pass
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
||||
dw0 = 4e-6
|
||||
xxx = np.arange(0, 8192) * dw0
|
||||
|
||||
freq = np.fft.fftshift(np.fft.fftfreq(len(xxx), d=dw0))[500:-1000]
|
||||
|
||||
p0 = [6.66e6, 0.935, 2e3, 50e6, 1/dw0]
|
||||
spec = sec_order(p0, freq)
|
||||
ax.plot(freq, spec)
|
||||
|
||||
p1 = [20e3, 0.2, 2e3, 1/dw0]
|
||||
spec1 = pake(p1, freq)
|
||||
ax.plot(freq, spec1)
|
||||
|
||||
p2 = [20e3, 0.2, 20e3, 2e3, 1/dw0]
|
||||
spec2 = csa(p2, freq)
|
||||
ax.plot(freq, spec2)
|
||||
|
||||
plt.show()
|
||||
|
@ -112,13 +112,3 @@ class KWWDipolar(_AbstractFCDipolar):
|
||||
params = _AbstractFCDipolar.params + [r'\beta']
|
||||
bounds = _AbstractFCDipolar.bounds + [(0, 1)]
|
||||
relax = Relaxation(distribution=KWW)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
w = np.logspace(-3, 3, num=31)
|
||||
|
||||
plt.loglog(w, FFHSFC.func(w, 10, 1, xaxis='omega'), '-')
|
||||
|
||||
plt.show()
|
@ -1,4 +1,3 @@
|
||||
|
||||
import numpy as np
|
||||
from scipy.special import gammaln
|
||||
from ..math.logfourier import logft
|
||||
@ -267,32 +266,3 @@ def g1(p, x):
|
||||
fkt2 = glnbeta_td(xval, p[5], p[6], p[7])
|
||||
ret_val[i] = p[0] * (fkt1 * ((1 - p[4]) + p[4] * fkt2)) + np.abs(p[8]) * np.exp(-(xval / p[9]) ** p[10])
|
||||
return ret_val
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import matplotlib.pyplot as plt
|
||||
import time
|
||||
|
||||
x = np.logspace(-5, 5, num=260)
|
||||
tau0 = 100
|
||||
alpha = 2
|
||||
beta = 0.7
|
||||
gamma = 0.1
|
||||
sigma = 1000
|
||||
tau1 = 1
|
||||
a = 0.8
|
||||
b = 0.6
|
||||
r = 0
|
||||
start = time.time()
|
||||
y = GeneralGamma.ggaew_b(x, tau0, alpha, beta, sigma, gamma, tau1, a, b, r)
|
||||
print('gg_time', time.time()-start)
|
||||
start = time.time()
|
||||
yy = g2([r, tau0, alpha, beta, sigma, gamma, tau1, a, b], x)
|
||||
print('g2', time.time()-start)
|
||||
|
||||
plt.semilogx(x, y)
|
||||
plt.semilogx(x, yy, 'x')
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
|
@ -14,8 +14,8 @@ import numpy as np
|
||||
from scipy.interpolate import interp1d, Akima1DInterpolator
|
||||
from scipy.optimize import minimize
|
||||
|
||||
from nmreval.lib.utils import ArrayLike
|
||||
from .coupling import Coupling
|
||||
from ..lib.utils import ArrayLike
|
||||
from ..distributions.base import Distribution
|
||||
from ..distributions.debye import Debye as Debye
|
||||
from ..utils import gamma_full
|
||||
@ -29,7 +29,7 @@ class Relaxation:
|
||||
def __init__(self, distribution: Type[Distribution] = None):
|
||||
self.distribution = distribution
|
||||
self.dist_parameter = ()
|
||||
self._dist_kw = {}
|
||||
self.dist_kw = {}
|
||||
|
||||
self.coupling = None
|
||||
self.coup_parameter = []
|
||||
@ -67,9 +67,13 @@ class Relaxation:
|
||||
|
||||
if parameter is not None:
|
||||
self.dist_parameter = parameter
|
||||
else:
|
||||
self.dist_parameter = ()
|
||||
|
||||
if keywords is not None:
|
||||
self._dist_kw = keywords
|
||||
self.dist_kw = keywords
|
||||
else:
|
||||
self.dist_kw = {}
|
||||
|
||||
def t1(self, omega: ArrayLike, tau: ArrayLike, *specdens_args: Any,
|
||||
mode: str = 'bpp', **kwargs) -> np.ndarray | float:
|
||||
|
Loading…
Reference in New Issue
Block a user