configuration dialog fpr YAFF (tau distrib., time points)

This commit is contained in:
Markus Rosenstihl 2014-04-15 15:44:15 +02:00
parent 9da511b92a
commit 39374ab17a
19 changed files with 1503 additions and 55 deletions

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ConductivityGroupBox.ui'
#
# Created: Mon Apr 14 14:36:45 2014
# Created: Tue Apr 15 15:17:02 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!

View File

@ -6,7 +6,7 @@ import numpy as np
import pyqtgraph as pg
import ContainerWidgets
import libyaff
from mathlib import Functions, id_to_color
from Mathlib import Functions, id_to_color
__author__ = 'markusro'
@ -213,6 +213,7 @@ class YAFF(BaseObject):
super(YAFF, self).__init__(plt_real=plt_real, plt_imag=plt_imag, limits=limits)
self.widget = ContainerWidgets.YaffWidget()
self.widget.on_model_changed.connect(self.change_model)
self.widget.configuration_changed.connect(self.change_configuration)
self.color = QColor(32, 120, 29, int(255*0.82))
self._libyaff = libyaff.Yaff(self.widget.getYaffType())
self.id_label = self._libyaff.label
@ -228,6 +229,11 @@ class YAFF(BaseObject):
def param_number(self, num=None):
self._param_number = self._libyaff.params
def change_configuration(self, t_list, tau_list):
self._libyaff.dist_tau = tau_list
self._libyaff.time_points = t_list
self.updateData()
def change_model(self):
self._libyaff = libyaff.Yaff(self.widget.getYaffType())
self._selector_mask = self.widget.selector_mask

View File

@ -7,7 +7,7 @@ import ConductivityGroupBox
import PeakGroupBox
import PowerLawGroupBox
import StaticGroupBox
import YAFFparameters
import YAFFparameters, YAFFConfig
from PyQt4.QtGui import *
@ -115,6 +115,12 @@ class BaseWidget(QGroupBox):
self.errors[i].setStyleSheet(sd_style)
self.errors[i].setText(sd)
def replaceDoubleSpinBox(self, layout, widget):
ndx = layout.indexOf(widget)
row, column, cols, rows = layout.getItemPosition(ndx)
widget.setParent(None)
widget = LogFSpinBox(self)
layout.addWidget(widget, row,column)
@ -329,10 +335,10 @@ class ConductivityWidget(BaseWidget, QGroupBox):
class PowerLawWidget(BaseWidget, QGroupBox):
class PowerLawWidget(BaseWidget):
def __init__(self, parent=None):
QGroupBox.__init__(self)
#QGroupBox.__init__(self)
BaseWidget.__init__(self)
super(PowerLawWidget, self).__init__(parent)
@ -359,6 +365,7 @@ class PowerLawWidget(BaseWidget, QGroupBox):
class YaffWidget(BaseWidget):
on_model_changed = pyqtSignal()
configuration_changed = pyqtSignal(list,list)
def __init__(self, parent=None):
#QGroupBox.__init__(self)
@ -381,6 +388,7 @@ class YaffWidget(BaseWidget):
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_9, 12, 1)
self.ui.removeButton.clicked.connect(self.remove)
self.ui.configButton.clicked.connect(self.configure)
self.ui.comboBox.currentIndexChanged.connect(self.change_model)
self._names = [
@ -446,6 +454,17 @@ class YaffWidget(BaseWidget):
for dsb in self.inputs:
dsb.valueChanged.connect(self.changeValues)
self.change_model(0)
self._t_list, self._tau_list = None, None
def configure(self):
qd = YaffConfigWidget(t_list = self._t_list, tau_list = self._tau_list)
qd.configuration_changed.connect(self._store_config)
qd.exec_()
#qd.show()
def _store_config(self,t_list,tau_list):
self._t_list = t_list
self._tau_list = tau_list
self.configuration_changed.emit(t_list,tau_list)
def getYaffType(self):
return self.ui.comboBox.currentIndex()
@ -477,3 +496,74 @@ class YaffWidget(BaseWidget):
if mask[ndx][i]==0: self.names.append(self._names[i])
self.selector_mask = [not i for i in mask[ndx] ]
self.on_model_changed.emit()
class YaffConfigWidget(QDialog):
configuration_changed = pyqtSignal(list,list)
def __init__(self, parent=None, t_list=None, tau_list=None):
super(YaffConfigWidget,self).__init__(parent)
self.ui = YAFFConfig.Ui_Dialog()
self.ui.setupUi(self)
# not working; cannot set values
#self.replaceDoubleSpinBox(self.ui.gridLayout_time, self.ui.doubleSpinBox_tmin)
#self.replaceDoubleSpinBox(self.ui.gridLayout_time, self.ui.doubleSpinBox_tmax)
#self.replaceDoubleSpinBox(self.ui.gridLayout_tau, self.ui.doubleSpinBox_taumin)
#self.replaceDoubleSpinBox(self.ui.gridLayout_tau, self.ui.doubleSpinBox_taumax)
ndx = self.ui.gridLayout_time.indexOf(self.ui.doubleSpinBox_tmin)
row, column, cols, rows = self.ui.gridLayout_time.getItemPosition(ndx)
self.ui.doubleSpinBox_tmin.setParent(None)
self.ui.doubleSpinBox_tmin = LogFSpinBox(self)
self.ui.gridLayout_time.addWidget(self.ui.doubleSpinBox_tmin, row,column)
ndx = self.ui.gridLayout_time.indexOf(self.ui.doubleSpinBox_tmax)
row, column, cols, rows = self.ui.gridLayout_time.getItemPosition(ndx)
self.ui.doubleSpinBox_tmax.setParent(None)
self.ui.doubleSpinBox_tmax = LogFSpinBox(self)
self.ui.gridLayout_time.addWidget(self.ui.doubleSpinBox_tmax, row,column)
ndx = self.ui.gridLayout_tau.indexOf(self.ui.doubleSpinBox_taumin)
row, column, cols, rows = self.ui.gridLayout_tau.getItemPosition(ndx)
self.ui.doubleSpinBox_taumin.setParent(None)
self.ui.doubleSpinBox_taumin = LogFSpinBox(self)
self.ui.gridLayout_tau.addWidget(self.ui.doubleSpinBox_taumin, row,column)
ndx = self.ui.gridLayout_tau.indexOf(self.ui.doubleSpinBox_taumax)
row, column, cols, rows = self.ui.gridLayout_tau.getItemPosition(ndx)
self.ui.doubleSpinBox_taumax.setParent(None)
self.ui.doubleSpinBox_taumax = LogFSpinBox(self)
self.ui.gridLayout_tau.addWidget(self.ui.doubleSpinBox_taumax, row,column)
if t_list is not None:
self.ui.doubleSpinBox_tmin.setValue(t_list[0])
self.ui.doubleSpinBox_tmax.setValue(t_list[1])
else:
self.ui.doubleSpinBox_tmin.setValue(1e-10)
self.ui.doubleSpinBox_tmax.setValue(1e5)
if tau_list is not None:
self.ui.doubleSpinBox_taumin.setValue(tau_list[0])
self.ui.doubleSpinBox_taumax.setValue(tau_list[1])
else:
self.ui.doubleSpinBox_taumin.setValue(1e-10)
self.ui.doubleSpinBox_taumax.setValue(1e5)
values = [self.ui.doubleSpinBox_tmin,
self.ui.doubleSpinBox_tmax,
self.ui.spinBox_tn,
self.ui.doubleSpinBox_taumin,
self.ui.doubleSpinBox_taumax,
self.ui.spinBox_taun]
for val in values: val.valueChanged.connect(self.changedConfiguration)
def changedConfiguration(self):
t_list = [self.ui.doubleSpinBox_tmin.value(),
self.ui.doubleSpinBox_tmax.value(),
self.ui.spinBox_tn.value()]
tau_list = [self.ui.doubleSpinBox_taumin.value(),
self.ui.doubleSpinBox_taumax.value(),
self.ui.spinBox_taun.value()]
self.configuration_changed.emit(t_list,tau_list)

View File

@ -6,5 +6,6 @@ all:
pyuic4 PowerLawGroupBox.ui -o PowerLawGroupBox.py
pyuic4 StaticGroupBox.ui -o StaticGroupBox.py
pyuic4 YAFFparameters.ui -o YAFFparameters.py
pyuic4 YAFFConfig.ui -o YAFFConfig.py
stats:
wc -l QDS.py ContainerWidgets.py Container.py libyaff.py mathlib.py data.py

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'PeakGroupBox.ui'
#
# Created: Mon Apr 14 14:36:45 2014
# Created: Tue Apr 15 15:17:02 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'PowerLawGroupBox.ui'
#
# Created: Mon Apr 14 14:36:45 2014
# Created: Tue Apr 15 15:17:02 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!

36
QDS.py
View File

@ -1,33 +1,28 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import os
import sys
import re
import signal
_author_ = "Markus Rosenstihl"
import os,sys,re,signal
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import matplotlib
from Container import Conductivity, PowerComplex, Static, Peak, YAFF
from mathlib import FunctionRegister, FitRoutine
matplotlib.use('agg')
from matplotlib import pyplot
from matplotlib.colors import hex2color
#matplotlib.rc_file("default.mplrc")
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import numpy as np
import QDSMain
from data import Data
import pyqtgraph as pg
from Container import Conductivity, PowerComplex, Static, Peak, YAFF
from ContainerWidgets import ParameterWidget
from Mathlib import FunctionRegister, FitRoutine
from Data import Data
import QDSMain
class AppWindow(QMainWindow):
@ -141,6 +136,8 @@ class AppWindow(QMainWindow):
fit_annealAction = QAction("&Simulated Annealing", self)
fitMenu.addAction(fit_annealAction)
self.ui.actionActionAbortFit.triggered.connect(self.abortFit)
self.signalMapper = QSignalMapper(self)
for i, fit_action in enumerate([fit_lmAction, fit_lbfgsbAction, fit_annealAction
]):
@ -208,6 +205,9 @@ class AppWindow(QMainWindow):
msgBox.exec_()
def abortFit(self):
self._fit_thread.quit()
def saveFitResult(self):
"""
Saving fit parameters to fitresults.log
@ -505,7 +505,8 @@ class AppWindow(QMainWindow):
self.fit_boundary_imag.setRegion(self.fit_boundary_real.getRegion())
def sigint_handler(*args):
"""Handler for the SIGINT signal (CTRL + C).
"""
Handler for the SIGINT signal (CTRL + C).
"""
sys.stderr.write('\r')
if QMessageBox.question(None, '', "Are you sure you want to quit?",
@ -513,6 +514,7 @@ def sigint_handler(*args):
QMessageBox.Yes) == QMessageBox.Yes:
QApplication.quit()
if __name__ == '__main__':
signal.signal(signal.SIGINT, sigint_handler)
files = sys.argv[1:]

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'QDSMain.ui'
#
# Created: Mon Apr 14 14:36:45 2014
# Created: Tue Apr 15 15:17:02 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
@ -70,6 +70,7 @@ class Ui_MainWindow(object):
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.toolBar = QtGui.QToolBar(MainWindow)
self.toolBar.setIconSize(QtCore.QSize(48, 48))
self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
self.toolBar.setObjectName(_fromUtf8("toolBar"))
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
@ -113,6 +114,11 @@ class Ui_MainWindow(object):
icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/add_yaff.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionYAFF.setIcon(icon4)
self.actionYAFF.setObjectName(_fromUtf8("actionYAFF"))
self.actionActionAbortFit = QtGui.QAction(MainWindow)
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/qds_fit_abort.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionActionAbortFit.setIcon(icon5)
self.actionActionAbortFit.setObjectName(_fromUtf8("actionActionAbortFit"))
self.toolBar.addAction(self.actionAdd_Peak)
self.toolBar.addAction(self.actionAdd_Cond)
self.toolBar.addAction(self.actionAdd_PowerLaw)
@ -121,6 +127,7 @@ class Ui_MainWindow(object):
self.toolBar.addAction(self.actionYAFF)
self.toolBar.addSeparator()
self.toolBar.addAction(self.actionSave_FitResult)
self.toolBar.addAction(self.actionActionAbortFit)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
@ -139,6 +146,8 @@ class Ui_MainWindow(object):
self.actionAdd_Eps_Infty.setToolTip(_translate("MainWindow", "Add eps_infty", None))
self.actionYAFF.setText(_translate("MainWindow", "YAFF", None))
self.actionYAFF.setToolTip(_translate("MainWindow", "Fit with YAFF", None))
self.actionActionAbortFit.setText(_translate("MainWindow", "Abort Fit", None))
self.actionActionAbortFit.setShortcut(_translate("MainWindow", "Ctrl+C", None))
from pyqtgraph import PlotWidget
import images_rc

View File

@ -73,6 +73,12 @@
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
@ -90,6 +96,7 @@
<addaction name="actionYAFF"/>
<addaction name="separator"/>
<addaction name="actionSave_FitResult"/>
<addaction name="actionActionAbortFit"/>
</widget>
<widget class="QDockWidget" name="dockWidget_3">
<property name="features">
@ -184,6 +191,18 @@
<string>Fit with YAFF</string>
</property>
</action>
<action name="actionActionAbortFit">
<property name="icon">
<iconset resource="icons/images.qrc">
<normaloff>:/icons/qds_fit_abort.png</normaloff>:/icons/qds_fit_abort.png</iconset>
</property>
<property name="text">
<string>Abort Fit</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'StaticGroupBox.ui'
#
# Created: Mon Apr 14 14:36:45 2014
# Created: Tue Apr 15 15:17:03 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!

107
YAFFConfig.py Normal file
View File

@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'YAFFConfig.ui'
#
# Created: Tue Apr 15 15:17:03 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(250, 229)
self.gridLayout_3 = QtGui.QGridLayout(Dialog)
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
self.groupBox_time = QtGui.QGroupBox(Dialog)
self.groupBox_time.setObjectName(_fromUtf8("groupBox_time"))
self.gridLayout_time = QtGui.QGridLayout(self.groupBox_time)
self.gridLayout_time.setObjectName(_fromUtf8("gridLayout_time"))
self.label = QtGui.QLabel(self.groupBox_time)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout_time.addWidget(self.label, 0, 0, 1, 1)
self.label_2 = QtGui.QLabel(self.groupBox_time)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout_time.addWidget(self.label_2, 0, 1, 1, 1)
self.label_3 = QtGui.QLabel(self.groupBox_time)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout_time.addWidget(self.label_3, 0, 2, 1, 1)
self.doubleSpinBox_tmin = QtGui.QDoubleSpinBox(self.groupBox_time)
self.doubleSpinBox_tmin.setObjectName(_fromUtf8("doubleSpinBox_tmin"))
self.gridLayout_time.addWidget(self.doubleSpinBox_tmin, 1, 0, 1, 1)
self.doubleSpinBox_tmax = QtGui.QDoubleSpinBox(self.groupBox_time)
self.doubleSpinBox_tmax.setObjectName(_fromUtf8("doubleSpinBox_tmax"))
self.gridLayout_time.addWidget(self.doubleSpinBox_tmax, 1, 1, 1, 1)
self.spinBox_tn = QtGui.QSpinBox(self.groupBox_time)
self.spinBox_tn.setMinimum(256)
self.spinBox_tn.setMaximum(8192)
self.spinBox_tn.setSingleStep(256)
self.spinBox_tn.setProperty("value", 512)
self.spinBox_tn.setObjectName(_fromUtf8("spinBox_tn"))
self.gridLayout_time.addWidget(self.spinBox_tn, 1, 2, 1, 1)
self.gridLayout_3.addWidget(self.groupBox_time, 0, 0, 1, 1)
self.groupBox_tau = QtGui.QGroupBox(Dialog)
self.groupBox_tau.setObjectName(_fromUtf8("groupBox_tau"))
self.gridLayout_tau = QtGui.QGridLayout(self.groupBox_tau)
self.gridLayout_tau.setObjectName(_fromUtf8("gridLayout_tau"))
self.label_7 = QtGui.QLabel(self.groupBox_tau)
self.label_7.setObjectName(_fromUtf8("label_7"))
self.gridLayout_tau.addWidget(self.label_7, 0, 0, 1, 1)
self.label_8 = QtGui.QLabel(self.groupBox_tau)
self.label_8.setObjectName(_fromUtf8("label_8"))
self.gridLayout_tau.addWidget(self.label_8, 0, 1, 1, 1)
self.label_9 = QtGui.QLabel(self.groupBox_tau)
self.label_9.setObjectName(_fromUtf8("label_9"))
self.gridLayout_tau.addWidget(self.label_9, 0, 2, 1, 1)
self.doubleSpinBox_taumin = QtGui.QDoubleSpinBox(self.groupBox_tau)
self.doubleSpinBox_taumin.setObjectName(_fromUtf8("doubleSpinBox_taumin"))
self.gridLayout_tau.addWidget(self.doubleSpinBox_taumin, 1, 0, 1, 1)
self.doubleSpinBox_taumax = QtGui.QDoubleSpinBox(self.groupBox_tau)
self.doubleSpinBox_taumax.setObjectName(_fromUtf8("doubleSpinBox_taumax"))
self.gridLayout_tau.addWidget(self.doubleSpinBox_taumax, 1, 1, 1, 1)
self.spinBox_taun = QtGui.QSpinBox(self.groupBox_tau)
self.spinBox_taun.setMinimum(256)
self.spinBox_taun.setMaximum(8192)
self.spinBox_taun.setSingleStep(256)
self.spinBox_taun.setProperty("value", 512)
self.spinBox_taun.setObjectName(_fromUtf8("spinBox_taun"))
self.gridLayout_tau.addWidget(self.spinBox_taun, 1, 2, 1, 1)
self.gridLayout_3.addWidget(self.groupBox_tau, 1, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout_3.addWidget(self.buttonBox, 2, 0, 1, 1)
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(_translate("Dialog", "YAFF Configuration", None))
self.groupBox_time.setTitle(_translate("Dialog", "Time values (log10[t])", None))
self.label.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">min</span></p></body></html>", None))
self.label_2.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">max</span></p></body></html>", None))
self.label_3.setText(_translate("Dialog", "N", None))
self.groupBox_tau.setTitle(_translate("Dialog", "τ-Distribution (log10[τ])", None))
self.label_7.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">min</span></p></body></html>", None))
self.label_8.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">max</span></p></body></html>", None))
self.label_9.setText(_translate("Dialog", "N", None))

168
YAFFConfig.ui Normal file
View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>250</width>
<height>229</height>
</rect>
</property>
<property name="windowTitle">
<string>YAFF Configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_time">
<property name="title">
<string>Time values (log10[t])</string>
</property>
<layout class="QGridLayout" name="gridLayout_time">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;t&lt;span style=&quot; vertical-align:sub;&quot;&gt;min&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;t&lt;span style=&quot; vertical-align:sub;&quot;&gt;max&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>N</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_tmin"/>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_tmax"/>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="spinBox_tn">
<property name="minimum">
<number>256</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="singleStep">
<number>256</number>
</property>
<property name="value">
<number>512</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_tau">
<property name="title">
<string>τ-Distribution (log10[τ])</string>
</property>
<layout class="QGridLayout" name="gridLayout_tau">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;t&lt;span style=&quot; vertical-align:sub;&quot;&gt;min&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;t&lt;span style=&quot; vertical-align:sub;&quot;&gt;max&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>N</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_taumin"/>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_taumax"/>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="spinBox_taun">
<property name="minimum">
<number>256</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="singleStep">
<number>256</number>
</property>
<property name="value">
<number>512</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'YAFFparameters.ui'
#
# Created: Mon Apr 14 14:36:45 2014
# Created: Tue Apr 15 15:17:03 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
@ -26,7 +26,7 @@ except AttributeError:
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(263, 320)
Form.resize(271, 322)
self.gridLayout = QtGui.QGridLayout(Form)
self.gridLayout.setMargin(0)
self.gridLayout.setSpacing(1)
@ -259,6 +259,9 @@ class Ui_Form(object):
self.removeButton = QtGui.QPushButton(Form)
self.removeButton.setObjectName(_fromUtf8("removeButton"))
self.gridLayout.addWidget(self.removeButton, 0, 2, 1, 1)
self.configButton = QtGui.QPushButton(Form)
self.configButton.setObjectName(_fromUtf8("configButton"))
self.gridLayout.addWidget(self.configButton, 1, 2, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
@ -293,4 +296,5 @@ class Ui_Form(object):
self.comboBox.setItemText(2, _translate("Form", "GG + b", None))
self.comboBox.setItemText(3, _translate("Form", "GGe + b", None))
self.removeButton.setText(_translate("Form", "Remove", None))
self.configButton.setText(_translate("Form", "Configure", None))

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>263</width>
<height>320</height>
<width>271</width>
<height>322</height>
</rect>
</property>
<property name="windowTitle">
@ -460,6 +460,13 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="configButton">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -3,7 +3,8 @@ from PyQt4.QtGui import QColor
import numpy as np
import pyqtgraph as pg
from mathlib import FitFunctionCreator
from Mathlib import FitFunctionCreator
class Data:

View File

@ -3,6 +3,7 @@
<file>add_cond.svg</file>
<file>add_yaff.png</file>
<file>add_eps_infty.png</file>
<file>qds_fit_abort.png</file>
<file>add_peak.svg</file>
<file>fit_limits.png</file>
<file>save_fit.png</file>

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,10 @@ class Yaff(QObject):
step_signal = pyqtSignal(list)
def __init__(self, dist_type=0):
super(Yaff,self).__init__()
self.dist_x = logspace(-10,5,512)
self.dist_y = zeros(self.dist_x.size)
self._dist_tau = logspace(-12,6,512)
self.dist_y = zeros(self.dist_tau.size)
self._time_points = logspace(-10,5,512*2)
yaff = [
(self.yaff_gg, "GG"),
(self.yaff_gge, "GGe"),
@ -48,6 +50,29 @@ class Yaff(QObject):
]
self.loss, self.label = yaff[dist_type]
self.params = 10
@property
def time_points(self):
return self._time_points
@time_points.setter
def time_points(self, t_list):
tmin, tmax, num = t_list
tmi,tma = tmin, tmax
self._time_points = logspace(log10(tmi), log10(tma), num)
@property
def dist_tau(self):
return self._dist_tau
@dist_tau.setter
def dist_tau(self, tau_list):
tmin, tmax, num = tau_list
tmi,tma = tmin, tmax
self._dist_tau = logspace(log10(tmi), log10(tma), num)
def gg(self, p, tau):
tau0, a, b = p
"""
@ -136,21 +161,21 @@ class Yaff(QObject):
"""
delta_eps, tau1, a1, b1, lambd, tau2, a2, b2, s, g = p
dist_ggb = self.ggb(p=[tau2,a2,b2], tau=self.dist_x)
dist_gg = self.gg_hw (p=[tau1,a1,b1,s,g], tau=self.dist_x)
dist_ggb = self.ggb(p=[tau2,a2,b2], tau=self.dist_tau)
dist_gg = self.gg_hw (p=[tau1,a1,b1,s,g], tau=self.dist_tau)
ts = logspace(-10,5,512)
#ts = logspace(-10,5,512*2)
self.dist_y = dist_ggb
phi_beta = self.dist_to_relax(ts, self.dist_x, self.dist_y).real
phi_beta = self.dist_to_relax(self.time_points, self.dist_tau, self.dist_y).real
self.dist_y = dist_gg
phi_alpha = self.dist_to_relax(ts, self.dist_x, self.dist_y).real
phi_alpha = self.dist_to_relax(self.time_points, self.dist_tau, self.dist_y).real
# William-Watts-Ansatz
phi_tot = (1-lambd) + lambd*phi_beta
phi_tot *= phi_alpha
epp = delta_eps*2*pi*x*filon(2*pi*x, ts, phi_tot)
epp = delta_eps*2*pi*x*filon(2*pi*x, self.time_points, phi_tot)
self.step_signal.emit(list(p))
return epp
@ -161,21 +186,21 @@ class Yaff(QObject):
"""
delta_eps, tau1, a1, b1, lambd, tau2, a2, b2, s, g = p
dist_ggb = self.ggb(p=[tau2,a2,b2], tau=self.dist_x)
dist_gg = self.gg (p=[tau1,a1,b1], tau=self.dist_x)
dist_ggb = self.ggb(p=[tau2,a2,b2], tau=self.dist_tau)
dist_gg = self.gg (p=[tau1,a1,b1], tau=self.dist_tau)
ts = logspace(-10,5,512)
#ts = logspace(-10,5,512*2)
self.dist_y = dist_ggb
phi_beta = self.dist_to_relax(ts, self.dist_x, self.dist_y).real
phi_beta = self.dist_to_relax(self.time_points, self.dist_tau, self.dist_y).real
self.dist_y = dist_gg
phi_alpha = self.dist_to_relax(ts, self.dist_x, self.dist_y).real
phi_alpha = self.dist_to_relax(self.time_points, self.dist_tau, self.dist_y).real
# William-Watts-Ansatz
phi_tot = (1-lambd) + lambd*phi_beta
phi_tot *= phi_alpha
epp = delta_eps*2*pi*x*filon(2*pi*x, ts, phi_tot)
epp = delta_eps*2*pi*x*filon(2*pi*x, self.time_points, phi_tot)
self.step_signal.emit(list(p))
return epp
@ -185,11 +210,11 @@ class Yaff(QObject):
GG
"""
delta_eps, tau1, a1, b1, lambd, tau2, a2, b2, s, g = p
ts = logspace(-10,5,512)
dist_gg = self.gg(p=[tau1,a1,b1], tau=self.dist_x)
#ts = logspace(-10,5,512*2)
dist_gg = self.gg(p=[tau1,a1,b1], tau=self.dist_tau)
self.dist_y = dist_gg
phi_alpha = self.dist_to_relax(ts, self.dist_x, self.dist_y).real
epp = delta_eps*2*pi*x*filon(2*pi*x, ts, phi_alpha )
phi_alpha = self.dist_to_relax(self.time_points, self.dist_tau, self.dist_y).real
epp = delta_eps*2*pi*x*filon(2*pi*x, self.time_points, phi_alpha )
self.step_signal.emit(list(p))
return epp
@ -198,11 +223,11 @@ class Yaff(QObject):
GG
"""
delta_eps, tau1, a1, b1, lambd, tau2, a2, b2, s, g = p
ts = logspace(-10,5,512)
dist_gg = self.gg_hw(p=[tau1, a1, b1, s, g], tau=self.dist_x)
#ts = logspace(-10,5,512*2)
dist_gg = self.gg_hw(p=[tau1, a1, b1, s, g], tau=self.dist_tau)
self.dist_y = dist_gg
phi_alpha = self.dist_to_relax(ts, self.dist_x, self.dist_y).real
epp = delta_eps*2*pi*x*filon(2*pi*x, ts, phi_alpha )
phi_alpha = self.dist_to_relax(self.time_points, self.dist_tau, self.dist_y).real
epp = delta_eps*2*pi*x*filon(2*pi*x, self.time_points, phi_alpha )
self.step_signal.emit(list(p))
return epp