Refactored base class for parameter widgets
This commit is contained in:
parent
cea97a475e
commit
d356585a7e
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ConductivityGroupBox.ui'
|
||||
#
|
||||
# Created: Thu Mar 20 17:08:04 2014
|
||||
# Created: Thu Mar 27 13:33:39 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -26,7 +26,7 @@ except AttributeError:
|
||||
class Ui_ConductivityGroupBox(object):
|
||||
def setupUi(self, ConductivityGroupBox):
|
||||
ConductivityGroupBox.setObjectName(_fromUtf8("ConductivityGroupBox"))
|
||||
ConductivityGroupBox.resize(204, 129)
|
||||
ConductivityGroupBox.resize(253, 156)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
@ -40,18 +40,9 @@ class Ui_ConductivityGroupBox(object):
|
||||
self.gridLayout.setSpacing(1)
|
||||
self.gridLayout.setContentsMargins(0, 0, -1, -1)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.label_2 = QtGui.QLabel(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
||||
self.label_2.setSizePolicy(sizePolicy)
|
||||
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
||||
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
|
||||
self.label_6 = QtGui.QLabel(ConductivityGroupBox)
|
||||
self.label_6.setObjectName(_fromUtf8("label_6"))
|
||||
self.gridLayout.addWidget(self.label_6, 2, 2, 1, 1)
|
||||
self.gridLayout.addWidget(self.label_6, 3, 2, 1, 1)
|
||||
self.checkBox_2 = QtGui.QCheckBox(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
@ -60,7 +51,26 @@ class Ui_ConductivityGroupBox(object):
|
||||
self.checkBox_2.setSizePolicy(sizePolicy)
|
||||
self.checkBox_2.setText(_fromUtf8(""))
|
||||
self.checkBox_2.setObjectName(_fromUtf8("checkBox_2"))
|
||||
self.gridLayout.addWidget(self.checkBox_2, 1, 3, 1, 1, QtCore.Qt.AlignHCenter)
|
||||
self.gridLayout.addWidget(self.checkBox_2, 2, 3, 1, 1, QtCore.Qt.AlignHCenter)
|
||||
self.checkBox_3 = QtGui.QCheckBox(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.checkBox_3.sizePolicy().hasHeightForWidth())
|
||||
self.checkBox_3.setSizePolicy(sizePolicy)
|
||||
self.checkBox_3.setText(_fromUtf8(""))
|
||||
self.checkBox_3.setChecked(True)
|
||||
self.checkBox_3.setObjectName(_fromUtf8("checkBox_3"))
|
||||
self.gridLayout.addWidget(self.checkBox_3, 3, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
|
||||
self.label_2 = QtGui.QLabel(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
||||
self.label_2.setSizePolicy(sizePolicy)
|
||||
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
||||
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
|
||||
self.label = QtGui.QLabel(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
@ -73,28 +83,18 @@ class Ui_ConductivityGroupBox(object):
|
||||
self.removeButton = QtGui.QPushButton(ConductivityGroupBox)
|
||||
self.removeButton.setObjectName(_fromUtf8("removeButton"))
|
||||
self.gridLayout.addWidget(self.removeButton, 0, 1, 1, 1)
|
||||
self.checkBox_3 = QtGui.QCheckBox(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.checkBox_3.sizePolicy().hasHeightForWidth())
|
||||
self.checkBox_3.setSizePolicy(sizePolicy)
|
||||
self.checkBox_3.setText(_fromUtf8(""))
|
||||
self.checkBox_3.setChecked(True)
|
||||
self.checkBox_3.setObjectName(_fromUtf8("checkBox_3"))
|
||||
self.gridLayout.addWidget(self.checkBox_3, 2, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
|
||||
self.label_3 = QtGui.QLabel(ConductivityGroupBox)
|
||||
self.label_4 = QtGui.QLabel(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
|
||||
self.label_3.setSizePolicy(sizePolicy)
|
||||
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
||||
self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1)
|
||||
sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
|
||||
self.label_4.setSizePolicy(sizePolicy)
|
||||
self.label_4.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_4.setObjectName(_fromUtf8("label_4"))
|
||||
self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1)
|
||||
self.label_5 = QtGui.QLabel(ConductivityGroupBox)
|
||||
self.label_5.setObjectName(_fromUtf8("label_5"))
|
||||
self.gridLayout.addWidget(self.label_5, 1, 2, 1, 1)
|
||||
self.gridLayout.addWidget(self.label_5, 2, 2, 1, 1)
|
||||
self.doubleSpinBox_3 = QtGui.QDoubleSpinBox(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
@ -104,7 +104,7 @@ class Ui_ConductivityGroupBox(object):
|
||||
self.doubleSpinBox_3.setSingleStep(0.05)
|
||||
self.doubleSpinBox_3.setProperty("value", 1.0)
|
||||
self.doubleSpinBox_3.setObjectName(_fromUtf8("doubleSpinBox_3"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_3, 2, 1, 1, 1)
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_3, 3, 1, 1, 1)
|
||||
self.doubleSpinBox_2 = QtGui.QDoubleSpinBox(ConductivityGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
@ -112,7 +112,23 @@ class Ui_ConductivityGroupBox(object):
|
||||
sizePolicy.setHeightForWidth(self.doubleSpinBox_2.sizePolicy().hasHeightForWidth())
|
||||
self.doubleSpinBox_2.setSizePolicy(sizePolicy)
|
||||
self.doubleSpinBox_2.setObjectName(_fromUtf8("doubleSpinBox_2"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_2, 1, 1, 1, 1)
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_2, 2, 1, 1, 1)
|
||||
self.subtractConductivityButton = QtGui.QPushButton(ConductivityGroupBox)
|
||||
self.subtractConductivityButton.setObjectName(_fromUtf8("subtractConductivityButton"))
|
||||
self.gridLayout.addWidget(self.subtractConductivityButton, 0, 2, 1, 1)
|
||||
self.label_3 = QtGui.QLabel(ConductivityGroupBox)
|
||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
||||
self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1, QtCore.Qt.AlignHCenter)
|
||||
self.doubleSpinBox_1 = QtGui.QDoubleSpinBox(ConductivityGroupBox)
|
||||
self.doubleSpinBox_1.setObjectName(_fromUtf8("doubleSpinBox_1"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_1, 1, 1, 1, 1)
|
||||
self.label_7 = QtGui.QLabel(ConductivityGroupBox)
|
||||
self.label_7.setObjectName(_fromUtf8("label_7"))
|
||||
self.gridLayout.addWidget(self.label_7, 1, 2, 1, 1)
|
||||
self.checkBox_1 = QtGui.QCheckBox(ConductivityGroupBox)
|
||||
self.checkBox_1.setText(_fromUtf8(""))
|
||||
self.checkBox_1.setObjectName(_fromUtf8("checkBox_1"))
|
||||
self.gridLayout.addWidget(self.checkBox_1, 1, 3, 1, 1, QtCore.Qt.AlignHCenter)
|
||||
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(ConductivityGroupBox)
|
||||
@ -122,10 +138,15 @@ class Ui_ConductivityGroupBox(object):
|
||||
def retranslateUi(self, ConductivityGroupBox):
|
||||
ConductivityGroupBox.setWindowTitle(_translate("ConductivityGroupBox", "GroupBox", None))
|
||||
ConductivityGroupBox.setTitle(_translate("ConductivityGroupBox", "Conductivity", None))
|
||||
self.label_2.setText(_translate("ConductivityGroupBox", "σ", None))
|
||||
self.label_6.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
||||
self.label_2.setText(_translate("ConductivityGroupBox", "<html><head/><body><p>σ\'<span style=\" vertical-align:sub;\">(DC)</span></p></body></html>", None))
|
||||
self.label.setText(_translate("ConductivityGroupBox", "Fix", None))
|
||||
self.removeButton.setText(_translate("ConductivityGroupBox", "Remove", None))
|
||||
self.label_3.setText(_translate("ConductivityGroupBox", "α", None))
|
||||
self.label_4.setText(_translate("ConductivityGroupBox", "α", None))
|
||||
self.label_5.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
||||
self.doubleSpinBox_2.setToolTip(_translate("ConductivityGroupBox", "<html><head/><body><p>DC conductivity, should only be seen in the imaginary permitivity. If there is a Jonscher type of U<span style=\" font-style:italic;\">niversal Dielectric Response, </span>the ratio of σ"/σ\'<span style=\" vertical-align:sub;\">(DC)</span> is a constant</p></body></html>", None))
|
||||
self.subtractConductivityButton.setText(_translate("ConductivityGroupBox", "Hide", None))
|
||||
self.label_3.setText(_translate("ConductivityGroupBox", "<html><head/><body><p>σ"</p></body></html>", None))
|
||||
self.doubleSpinBox_1.setToolTip(_translate("ConductivityGroupBox", "<html><head/><body><p>If there is a Jonscher type of U<span style=\" font-style:italic;\">niversal Dielectric Response, </span>the ratio of σ"/σ\'<span style=\" vertical-align:sub;\">(DC)</span> is a constant</p></body></html>", None))
|
||||
self.label_7.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>204</width>
|
||||
<height>129</height>
|
||||
<width>253</width>
|
||||
<height>156</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -43,30 +43,14 @@
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>σ</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" alignment="Qt::AlignHCenter">
|
||||
<item row="2" column="3" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
@ -79,6 +63,38 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
|
||||
<widget class="QCheckBox" name="checkBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>σ'<span style=" vertical-align:sub;">(DC)</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
@ -102,24 +118,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
|
||||
<widget class="QCheckBox" name="checkBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -134,14 +134,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
@ -157,7 +157,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
@ -165,6 +165,44 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>DC conductivity, should only be seen in the imaginary permitivity. If there is a Jonscher type of U<span style=" font-style:italic;">niversal Dielectric Response, </span>the ratio of σ&quot;/σ'<span style=" vertical-align:sub;">(DC)</span> is a constant</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="subtractConductivityButton">
|
||||
<property name="text">
|
||||
<string>Hide</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>σ&quot;</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_1">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If there is a Jonscher type of U<span style=" font-style:italic;">niversal Dielectric Response, </span>the ratio of σ&quot;/σ'<span style=" vertical-align:sub;">(DC)</span> is a constant</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="checkBox_1">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -21,8 +21,8 @@ class LogFSpinBox(QDoubleSpinBox):
|
||||
|
||||
def __init__(self, parent = None):
|
||||
super(LogFSpinBox, self).__init__(parent)
|
||||
self.setRange(1e-16,1e16)
|
||||
self.setMinimum(1e-16)
|
||||
self.setRange(0.0,1e18)
|
||||
self.setMinimum(0)
|
||||
self.setDecimals(17)
|
||||
self.setValue(1.0)
|
||||
|
||||
@ -58,6 +58,7 @@ if __name__ == "__main__":
|
||||
class BaseWidget(QGroupBox):
|
||||
changedTable = pyqtSignal()
|
||||
removeMe = pyqtSignal()
|
||||
subtract = pyqtSignal()
|
||||
def __init__(self, parent=None):
|
||||
super(BaseWidget, self).__init__(parent)
|
||||
self.fixedCheckBoxes = []
|
||||
@ -67,6 +68,9 @@ class BaseWidget(QGroupBox):
|
||||
def remove(self):
|
||||
self.removeMe.emit()
|
||||
|
||||
def subtract(self):
|
||||
self.subtract.emit()
|
||||
|
||||
def changeValues(self, num):
|
||||
self.changedTable.emit()
|
||||
|
||||
@ -288,19 +292,27 @@ class ConductivityWidget(BaseWidget, QGroupBox):
|
||||
self.ui = ConductivityGroupBox.Ui_ConductivityGroupBox()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.ui.doubleSpinBox_1.setParent(None)
|
||||
self.ui.doubleSpinBox_1 = LogFSpinBox(self)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_1,1,1)
|
||||
|
||||
self.ui.doubleSpinBox_2.setParent(None)
|
||||
self.ui.doubleSpinBox_2 = LogFSpinBox(self)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,1,1)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,2,1)
|
||||
|
||||
self.ui.removeButton.clicked.connect(self.remove)
|
||||
#self.ui.subtractConductivityButton.connect(self.subtract)
|
||||
|
||||
|
||||
self.errors = [self.ui.label_5,
|
||||
self.errors = [self.ui.label_7,
|
||||
self.ui.label_5,
|
||||
self.ui.label_6]
|
||||
|
||||
self.inputs = [self.ui.doubleSpinBox_2,
|
||||
self.inputs = [self.ui.doubleSpinBox_1,
|
||||
self.ui.doubleSpinBox_2,
|
||||
self.ui.doubleSpinBox_3]
|
||||
|
||||
self.fixedCheckBoxes = [ self.ui.checkBox_2,
|
||||
self.fixedCheckBoxes = [self.ui.checkBox_1,
|
||||
self.ui.checkBox_2,
|
||||
self.ui.checkBox_3]
|
||||
for dsb in self.inputs:
|
||||
dsb.valueChanged.connect(self.changeValues)
|
||||
@ -345,15 +357,15 @@ class YaffWidget(BaseWidget, QGroupBox):
|
||||
|
||||
self.ui.doubleSpinBox_1.setParent(None)
|
||||
self.ui.doubleSpinBox_1 = LogFSpinBox(self)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_1, 1, 1)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_1, 2, 1)
|
||||
|
||||
self.ui.doubleSpinBox_2.setParent(None)
|
||||
self.ui.doubleSpinBox_2 = LogFSpinBox(self)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2, 2, 1)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2, 3, 1)
|
||||
|
||||
self.ui.doubleSpinBox_6.setParent(None)
|
||||
self.ui.doubleSpinBox_6 = LogFSpinBox(self)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_6, 6, 1)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_6, 9, 1)
|
||||
|
||||
self.ui.removeButton.clicked.connect(self.remove)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'PeakGroupBox.ui'
|
||||
#
|
||||
# Created: Thu Mar 20 17:08:04 2014
|
||||
# Created: Thu Mar 27 13:33:39 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'PowerLawGroupBox.ui'
|
||||
#
|
||||
# Created: Thu Mar 20 17:08:04 2014
|
||||
# Created: Thu Mar 27 13:33:39 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
31
QDS.py
31
QDS.py
@ -22,12 +22,12 @@ import numpy as N
|
||||
|
||||
import QDSMain
|
||||
|
||||
from data import Data, Conductivity, Peak, PowerComplex, Static
|
||||
from data import Data, Conductivity, Peak, PowerComplex, Static, YAFF
|
||||
import pyqtgraph as pg
|
||||
|
||||
#import yaff
|
||||
|
||||
from CustomWidgets import ParameterWidget
|
||||
from CustomWidgets import ParameterWidget, YaffWidget
|
||||
|
||||
USE_CROSSH=False
|
||||
|
||||
@ -183,6 +183,15 @@ class AppWindow(QMainWindow):
|
||||
msgBox.setText("Click in imaginary part")
|
||||
msgBox.exec_()
|
||||
|
||||
if self.ui.actionYAFF.isChecked():
|
||||
if mouse_in_imag:
|
||||
self.addYaff(data_pos)
|
||||
self.ui.actionYAFF.setChecked(False)
|
||||
else:
|
||||
msgBox.setText("Click in imaginary part")
|
||||
msgBox.exec_()
|
||||
|
||||
|
||||
|
||||
if self.ui.actionAdd_PowerLaw.isChecked():
|
||||
if mouse_in_imag:
|
||||
@ -268,15 +277,15 @@ class AppWindow(QMainWindow):
|
||||
|
||||
def addYaff(self, pos):
|
||||
|
||||
_yaff = Conductivity(plt_real=self.ui.pgPlotWidget_real,
|
||||
plt_imag=self.ui.pgPlotWidget_imag,
|
||||
limits=self.data.fit_limits)
|
||||
_yaff = YAFF(plt_real=self.ui.pgPlotWidget_real,
|
||||
plt_imag=self.ui.pgPlotWidget_imag,
|
||||
limits=self.data.fit_limits)
|
||||
_yaff.changedData.connect(self.updatePlot)
|
||||
_yaff.removeObj.connect(self.delParamterObject)
|
||||
|
||||
# cond_par = [10**(pos.y() + pos.x())*2*N.pi , 1.0]
|
||||
# _yaff.setParameter(beta=cond_par)
|
||||
|
||||
gg_y = 10**pos.y()
|
||||
gg_x = 10**pos.x()*2*N.pi
|
||||
yaff_par = [ gg_y, gg_x , 1.0, 1.0, 0.5, gg_x/10, 1.0, 1.0]
|
||||
_yaff.setParameter(beta=yaff_par)
|
||||
self.parameterWidget.add(_yaff.widget)
|
||||
self.function_registry.register_function(_yaff)
|
||||
self.updatePlot()
|
||||
@ -289,7 +298,7 @@ class AppWindow(QMainWindow):
|
||||
_conductivity.changedData.connect(self.updatePlot)
|
||||
_conductivity.removeObj.connect(self.delParamterObject)
|
||||
|
||||
cond_par = [10**(pos.y() + pos.x())*2*N.pi , 1.0]
|
||||
cond_par = [0.0, 10**(pos.y() + pos.x())*2*N.pi , 1.0]
|
||||
_conductivity.setParameter(beta=cond_par)
|
||||
|
||||
self.parameterWidget.add(_conductivity.widget)
|
||||
@ -434,7 +443,7 @@ class AppWindow(QMainWindow):
|
||||
for fcn in self.function_registry.get_registered_functions():
|
||||
p0.extend(fcn.getParameter())
|
||||
funcs.append(fcn.id_string)
|
||||
# calculate parameterized curve
|
||||
# calculate parametrized curve
|
||||
self.data.set_fit(p0, funcs)
|
||||
|
||||
# replot data and fit, TODO: replot only if data changed
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'QDSMain.ui'
|
||||
#
|
||||
# Created: Thu Mar 20 17:08:04 2014
|
||||
# Created: Thu Mar 27 13:33:39 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'StaticGroupBox.ui'
|
||||
#
|
||||
# Created: Thu Mar 20 17:08:04 2014
|
||||
# Created: Thu Mar 27 13:33:39 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'YAFFparameters.ui'
|
||||
#
|
||||
# Created: Thu Mar 20 17:08:05 2014
|
||||
# Created: Thu Mar 27 13:33:39 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -26,9 +26,10 @@ except AttributeError:
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName(_fromUtf8("Form"))
|
||||
Form.resize(270, 396)
|
||||
Form.resize(263, 320)
|
||||
self.gridLayout = QtGui.QGridLayout(Form)
|
||||
self.gridLayout.setMargin(1)
|
||||
self.gridLayout.setMargin(0)
|
||||
self.gridLayout.setSpacing(1)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.checkBox_2 = QtGui.QCheckBox(Form)
|
||||
self.checkBox_2.setText(_fromUtf8(""))
|
||||
@ -38,18 +39,18 @@ class Ui_Form(object):
|
||||
self.checkBox_1.setText(_fromUtf8(""))
|
||||
self.checkBox_1.setObjectName(_fromUtf8("checkBox_1"))
|
||||
self.gridLayout.addWidget(self.checkBox_1, 2, 3, 1, 1)
|
||||
self.label_4 = QtGui.QLabel(Form)
|
||||
self.label_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_4.setObjectName(_fromUtf8("label_4"))
|
||||
self.gridLayout.addWidget(self.label_4, 7, 0, 1, 1)
|
||||
self.label_21 = QtGui.QLabel(Form)
|
||||
self.label_422 = QtGui.QLabel(Form)
|
||||
self.label_422.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_422.setObjectName(_fromUtf8("label_422"))
|
||||
self.gridLayout.addWidget(self.label_422, 7, 0, 1, 1)
|
||||
self.label_10 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_21.sizePolicy().hasHeightForWidth())
|
||||
self.label_21.setSizePolicy(sizePolicy)
|
||||
self.label_21.setObjectName(_fromUtf8("label_21"))
|
||||
self.gridLayout.addWidget(self.label_21, 13, 2, 1, 1)
|
||||
sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth())
|
||||
self.label_10.setSizePolicy(sizePolicy)
|
||||
self.label_10.setObjectName(_fromUtf8("label_10"))
|
||||
self.gridLayout.addWidget(self.label_10, 13, 2, 1, 1)
|
||||
self.doubleSpinBox_1 = QtGui.QDoubleSpinBox(Form)
|
||||
self.doubleSpinBox_1.setObjectName(_fromUtf8("doubleSpinBox_1"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_1, 2, 1, 1, 1)
|
||||
@ -57,53 +58,53 @@ class Ui_Form(object):
|
||||
self.doubleSpinBox_4.setSingleStep(0.05)
|
||||
self.doubleSpinBox_4.setObjectName(_fromUtf8("doubleSpinBox_4"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_4, 7, 1, 1, 1)
|
||||
self.label_1 = QtGui.QLabel(Form)
|
||||
self.label_1.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_1.setObjectName(_fromUtf8("label_1"))
|
||||
self.gridLayout.addWidget(self.label_1, 2, 0, 1, 1)
|
||||
self.label_16 = QtGui.QLabel(Form)
|
||||
self.label_111 = QtGui.QLabel(Form)
|
||||
self.label_111.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_111.setObjectName(_fromUtf8("label_111"))
|
||||
self.gridLayout.addWidget(self.label_111, 2, 0, 1, 1)
|
||||
self.label_4 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_16.sizePolicy().hasHeightForWidth())
|
||||
self.label_16.setSizePolicy(sizePolicy)
|
||||
self.label_16.setObjectName(_fromUtf8("label_16"))
|
||||
self.gridLayout.addWidget(self.label_16, 7, 2, 1, 1)
|
||||
sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
|
||||
self.label_4.setSizePolicy(sizePolicy)
|
||||
self.label_4.setObjectName(_fromUtf8("label_4"))
|
||||
self.gridLayout.addWidget(self.label_4, 7, 2, 1, 1)
|
||||
self.doubleSpinBox_6 = QtGui.QDoubleSpinBox(Form)
|
||||
self.doubleSpinBox_6.setObjectName(_fromUtf8("doubleSpinBox_6"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_6, 9, 1, 1, 1)
|
||||
self.label_18 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_18.sizePolicy().hasHeightForWidth())
|
||||
self.label_18.setSizePolicy(sizePolicy)
|
||||
self.label_18.setObjectName(_fromUtf8("label_18"))
|
||||
self.gridLayout.addWidget(self.label_18, 8, 2, 1, 1)
|
||||
self.label_5 = QtGui.QLabel(Form)
|
||||
self.label_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth())
|
||||
self.label_5.setSizePolicy(sizePolicy)
|
||||
self.label_5.setObjectName(_fromUtf8("label_5"))
|
||||
self.gridLayout.addWidget(self.label_5, 8, 0, 1, 1)
|
||||
self.label_11 = QtGui.QLabel(Form)
|
||||
self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_11.setObjectName(_fromUtf8("label_11"))
|
||||
self.gridLayout.addWidget(self.label_11, 12, 0, 1, 1)
|
||||
self.label_14 = QtGui.QLabel(Form)
|
||||
self.gridLayout.addWidget(self.label_5, 8, 2, 1, 1)
|
||||
self.label_522 = QtGui.QLabel(Form)
|
||||
self.label_522.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_522.setObjectName(_fromUtf8("label_522"))
|
||||
self.gridLayout.addWidget(self.label_522, 8, 0, 1, 1)
|
||||
self.label_112 = QtGui.QLabel(Form)
|
||||
self.label_112.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_112.setObjectName(_fromUtf8("label_112"))
|
||||
self.gridLayout.addWidget(self.label_112, 12, 0, 1, 1)
|
||||
self.label_9 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_14.sizePolicy().hasHeightForWidth())
|
||||
self.label_14.setSizePolicy(sizePolicy)
|
||||
self.label_14.setObjectName(_fromUtf8("label_14"))
|
||||
self.gridLayout.addWidget(self.label_14, 12, 2, 1, 1)
|
||||
self.label_17 = QtGui.QLabel(Form)
|
||||
sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth())
|
||||
self.label_9.setSizePolicy(sizePolicy)
|
||||
self.label_9.setObjectName(_fromUtf8("label_9"))
|
||||
self.gridLayout.addWidget(self.label_9, 12, 2, 1, 1)
|
||||
self.label_6 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_17.sizePolicy().hasHeightForWidth())
|
||||
self.label_17.setSizePolicy(sizePolicy)
|
||||
self.label_17.setObjectName(_fromUtf8("label_17"))
|
||||
self.gridLayout.addWidget(self.label_17, 9, 2, 1, 1)
|
||||
sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth())
|
||||
self.label_6.setSizePolicy(sizePolicy)
|
||||
self.label_6.setObjectName(_fromUtf8("label_6"))
|
||||
self.gridLayout.addWidget(self.label_6, 9, 2, 1, 1)
|
||||
self.label_type = QtGui.QLabel(Form)
|
||||
self.label_type.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_type.setObjectName(_fromUtf8("label_type"))
|
||||
@ -115,77 +116,77 @@ class Ui_Form(object):
|
||||
self.label_huh = QtGui.QLabel(Form)
|
||||
self.label_huh.setObjectName(_fromUtf8("label_huh"))
|
||||
self.gridLayout.addWidget(self.label_huh, 1, 0, 1, 1)
|
||||
self.label_19 = QtGui.QLabel(Form)
|
||||
self.label_2 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_19.sizePolicy().hasHeightForWidth())
|
||||
self.label_19.setSizePolicy(sizePolicy)
|
||||
self.label_19.setObjectName(_fromUtf8("label_19"))
|
||||
self.gridLayout.addWidget(self.label_19, 3, 2, 1, 1)
|
||||
self.label_10 = QtGui.QLabel(Form)
|
||||
self.label_10.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_10.setObjectName(_fromUtf8("label_10"))
|
||||
self.gridLayout.addWidget(self.label_10, 13, 0, 1, 1)
|
||||
self.label_2 = QtGui.QLabel(Form)
|
||||
self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
||||
self.label_2.setSizePolicy(sizePolicy)
|
||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
||||
self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
|
||||
self.label_3 = QtGui.QLabel(Form)
|
||||
self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
||||
self.gridLayout.addWidget(self.label_3, 5, 0, 1, 1)
|
||||
self.gridLayout.addWidget(self.label_2, 3, 2, 1, 1)
|
||||
self.label_102 = QtGui.QLabel(Form)
|
||||
self.label_102.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_102.setObjectName(_fromUtf8("label_102"))
|
||||
self.gridLayout.addWidget(self.label_102, 13, 0, 1, 1)
|
||||
self.label_222 = QtGui.QLabel(Form)
|
||||
self.label_222.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_222.setObjectName(_fromUtf8("label_222"))
|
||||
self.gridLayout.addWidget(self.label_222, 3, 0, 1, 1)
|
||||
self.label_322 = QtGui.QLabel(Form)
|
||||
self.label_322.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_322.setObjectName(_fromUtf8("label_322"))
|
||||
self.gridLayout.addWidget(self.label_322, 5, 0, 1, 1)
|
||||
self.doubleSpinBox_9 = QtGui.QDoubleSpinBox(Form)
|
||||
self.doubleSpinBox_9.setObjectName(_fromUtf8("doubleSpinBox_9"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_9, 12, 1, 1, 1)
|
||||
self.label_13 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_13.sizePolicy().hasHeightForWidth())
|
||||
self.label_13.setSizePolicy(sizePolicy)
|
||||
self.label_13.setObjectName(_fromUtf8("label_13"))
|
||||
self.gridLayout.addWidget(self.label_13, 11, 2, 1, 1)
|
||||
self.label_22 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_22.sizePolicy().hasHeightForWidth())
|
||||
self.label_22.setSizePolicy(sizePolicy)
|
||||
self.label_22.setObjectName(_fromUtf8("label_22"))
|
||||
self.gridLayout.addWidget(self.label_22, 2, 2, 1, 1)
|
||||
self.label_15 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_15.sizePolicy().hasHeightForWidth())
|
||||
self.label_15.setSizePolicy(sizePolicy)
|
||||
self.label_15.setObjectName(_fromUtf8("label_15"))
|
||||
self.gridLayout.addWidget(self.label_15, 5, 2, 1, 1)
|
||||
self.label_8 = QtGui.QLabel(Form)
|
||||
self.label_8.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth())
|
||||
self.label_8.setSizePolicy(sizePolicy)
|
||||
self.label_8.setObjectName(_fromUtf8("label_8"))
|
||||
self.gridLayout.addWidget(self.label_8, 11, 0, 1, 1)
|
||||
self.label_6 = QtGui.QLabel(Form)
|
||||
self.label_6.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_6.setObjectName(_fromUtf8("label_6"))
|
||||
self.gridLayout.addWidget(self.label_6, 9, 0, 1, 1)
|
||||
self.gridLayout.addWidget(self.label_8, 11, 2, 1, 1)
|
||||
self.label_1 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_1.sizePolicy().hasHeightForWidth())
|
||||
self.label_1.setSizePolicy(sizePolicy)
|
||||
self.label_1.setObjectName(_fromUtf8("label_1"))
|
||||
self.gridLayout.addWidget(self.label_1, 2, 2, 1, 1)
|
||||
self.label_3 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
|
||||
self.label_3.setSizePolicy(sizePolicy)
|
||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
||||
self.gridLayout.addWidget(self.label_3, 5, 2, 1, 1)
|
||||
self.label_82 = QtGui.QLabel(Form)
|
||||
self.label_82.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_82.setObjectName(_fromUtf8("label_82"))
|
||||
self.gridLayout.addWidget(self.label_82, 11, 0, 1, 1)
|
||||
self.label_622 = QtGui.QLabel(Form)
|
||||
self.label_622.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_622.setObjectName(_fromUtf8("label_622"))
|
||||
self.gridLayout.addWidget(self.label_622, 9, 0, 1, 1)
|
||||
self.doubleSpinBox_7 = QtGui.QDoubleSpinBox(Form)
|
||||
self.doubleSpinBox_7.setSingleStep(0.05)
|
||||
self.doubleSpinBox_7.setObjectName(_fromUtf8("doubleSpinBox_7"))
|
||||
self.gridLayout.addWidget(self.doubleSpinBox_7, 10, 1, 1, 1)
|
||||
self.label_20 = QtGui.QLabel(Form)
|
||||
self.label_7 = QtGui.QLabel(Form)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_20.sizePolicy().hasHeightForWidth())
|
||||
self.label_20.setSizePolicy(sizePolicy)
|
||||
self.label_20.setObjectName(_fromUtf8("label_20"))
|
||||
self.gridLayout.addWidget(self.label_20, 10, 2, 1, 1)
|
||||
self.label_7 = QtGui.QLabel(Form)
|
||||
self.label_7.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth())
|
||||
self.label_7.setSizePolicy(sizePolicy)
|
||||
self.label_7.setObjectName(_fromUtf8("label_7"))
|
||||
self.gridLayout.addWidget(self.label_7, 10, 0, 1, 1)
|
||||
self.gridLayout.addWidget(self.label_7, 10, 2, 1, 1)
|
||||
self.label_72 = QtGui.QLabel(Form)
|
||||
self.label_72.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_72.setObjectName(_fromUtf8("label_72"))
|
||||
self.gridLayout.addWidget(self.label_72, 10, 0, 1, 1)
|
||||
self.doubleSpinBox_8 = QtGui.QDoubleSpinBox(Form)
|
||||
self.doubleSpinBox_8.setSingleStep(0.05)
|
||||
self.doubleSpinBox_8.setObjectName(_fromUtf8("doubleSpinBox_8"))
|
||||
@ -235,47 +236,51 @@ class Ui_Form(object):
|
||||
self.label_23 = QtGui.QLabel(Form)
|
||||
self.label_23.setObjectName(_fromUtf8("label_23"))
|
||||
self.gridLayout.addWidget(self.label_23, 1, 3, 1, 1)
|
||||
self.comboBox_2 = QtGui.QComboBox(Form)
|
||||
self.comboBox_2.setObjectName(_fromUtf8("comboBox_2"))
|
||||
self.gridLayout.addWidget(self.comboBox_2, 1, 1, 1, 1)
|
||||
self.comboBox = QtGui.QComboBox(Form)
|
||||
self.comboBox.setObjectName(_fromUtf8("comboBox"))
|
||||
self.comboBox.addItem(_fromUtf8(""))
|
||||
self.comboBox.addItem(_fromUtf8(""))
|
||||
self.comboBox.addItem(_fromUtf8(""))
|
||||
self.comboBox.addItem(_fromUtf8(""))
|
||||
self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 2)
|
||||
self.comboBox_2 = QtGui.QComboBox(Form)
|
||||
self.comboBox_2.setObjectName(_fromUtf8("comboBox_2"))
|
||||
self.gridLayout.addWidget(self.comboBox_2, 1, 1, 1, 1)
|
||||
self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
|
||||
self.removeButton = QtGui.QPushButton(Form)
|
||||
self.removeButton.setObjectName(_fromUtf8("removeButton"))
|
||||
self.gridLayout.addWidget(self.removeButton, 0, 2, 1, 1)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
Form.setWindowTitle(_translate("Form", "Form", None))
|
||||
self.label_4.setText(_translate("Form", "b", None))
|
||||
self.label_21.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_1.setText(_translate("Form", "eps", None))
|
||||
self.label_16.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_18.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_5.setText(_translate("Form", "lambda", None))
|
||||
self.label_11.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_14.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_17.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_422.setText(_translate("Form", "b", None))
|
||||
self.label_10.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_111.setText(_translate("Form", "eps", None))
|
||||
self.label_4.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_5.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_522.setText(_translate("Form", "lambda", None))
|
||||
self.label_112.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_9.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_6.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_type.setText(_translate("Form", "Type", None))
|
||||
self.label_huh.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_19.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_10.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_2.setText(_translate("Form", "tau_a", None))
|
||||
self.label_3.setText(_translate("Form", "a", None))
|
||||
self.label_13.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_22.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_15.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_8.setText(_translate("Form", "b", None))
|
||||
self.label_6.setText(_translate("Form", "tau_b", None))
|
||||
self.label_20.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_7.setText(_translate("Form", "a", None))
|
||||
self.label_2.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_102.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_222.setText(_translate("Form", "tau_a", None))
|
||||
self.label_322.setText(_translate("Form", "a", None))
|
||||
self.label_8.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_1.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_3.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_82.setText(_translate("Form", "b", None))
|
||||
self.label_622.setText(_translate("Form", "tau_b", None))
|
||||
self.label_7.setText(_translate("Form", "TextLabel", None))
|
||||
self.label_72.setText(_translate("Form", "a", None))
|
||||
self.label_23.setText(_translate("Form", "Fix", None))
|
||||
self.comboBox.setItemText(0, _translate("Form", "GG", None))
|
||||
self.comboBox.setItemText(1, _translate("Form", "GGe", None))
|
||||
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))
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>270</width>
|
||||
<height>396</height>
|
||||
<width>263</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -15,6 +15,9 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="3" column="3">
|
||||
@ -32,7 +35,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="label_422">
|
||||
<property name="text">
|
||||
<string>b</string>
|
||||
</property>
|
||||
@ -42,7 +45,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="2">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -65,7 +68,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<widget class="QLabel" name="label_111">
|
||||
<property name="text">
|
||||
<string>eps</string>
|
||||
</property>
|
||||
@ -75,7 +78,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -91,7 +94,7 @@
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_6"/>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -104,7 +107,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<widget class="QLabel" name="label_522">
|
||||
<property name="text">
|
||||
<string>lambda</string>
|
||||
</property>
|
||||
@ -114,7 +117,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<widget class="QLabel" name="label_112">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
@ -124,7 +127,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -137,7 +140,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -174,7 +177,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -187,7 +190,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<widget class="QLabel" name="label_102">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
@ -197,7 +200,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="label_222">
|
||||
<property name="text">
|
||||
<string>tau_a</string>
|
||||
</property>
|
||||
@ -207,7 +210,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="label_322">
|
||||
<property name="text">
|
||||
<string>a</string>
|
||||
</property>
|
||||
@ -220,7 +223,7 @@
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_9"/>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -233,7 +236,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -246,7 +249,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -259,7 +262,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<widget class="QLabel" name="label_82">
|
||||
<property name="text">
|
||||
<string>b</string>
|
||||
</property>
|
||||
@ -269,7 +272,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="label_622">
|
||||
<property name="text">
|
||||
<string>tau_b</string>
|
||||
</property>
|
||||
@ -286,7 +289,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -299,7 +302,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<widget class="QLabel" name="label_72">
|
||||
<property name="text">
|
||||
<string>a</string>
|
||||
</property>
|
||||
@ -391,7 +394,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_2"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -415,8 +421,12 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_2"/>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
247
data.py
247
data.py
@ -31,10 +31,12 @@ class Data:
|
||||
self.fit_limits = [frequency.min(), frequency.max(), die_imag.min(), die_imag.max()]
|
||||
|
||||
self.fit_param = None
|
||||
self.fit_funcs = None
|
||||
self.fit_funcs = None # list of fit functions
|
||||
self.hide_funcs = None # remove these func from the data
|
||||
|
||||
def set_fit(self, param, funcs):
|
||||
self.fit_funcs = funcs
|
||||
self.hide_funcs = []
|
||||
self.fit_param = param
|
||||
fit_real, fit_imag = FitFunctionCreator().fitfcn(param, self.frequency_fit, *funcs)
|
||||
self.epsilon_fit = fit_real + 1j*fit_imag
|
||||
@ -79,36 +81,40 @@ class Data:
|
||||
#if self.fitted_curve is not None: self.fitted_curve.remove()
|
||||
|
||||
|
||||
class Conductivity(QObject):
|
||||
class BaseObject(QObject):
|
||||
changedData = pyqtSignal()
|
||||
removeObj = pyqtSignal(QObject)
|
||||
|
||||
def __init__( self, plt_imag=None, plt_real=None, limits=None ):
|
||||
def __init__(self, plt_real=None, plt_imag=None, limits=None):
|
||||
super(BaseObject, self).__init__()
|
||||
|
||||
QObject.__init__(self)
|
||||
super(Conductivity, self)
|
||||
self.widget = CustomWidgets.ConductivityWidget()
|
||||
self.widget.changedTable.connect(self.updateData)
|
||||
self.widget.removeMe.connect(self.removeMe)
|
||||
self.f=Functions()
|
||||
myPen = pg.mkPen( style=Qt.DotLine,
|
||||
width=2.5)
|
||||
|
||||
myPen = pg.mkPen( style=Qt.DashLine, width=2.5)
|
||||
self.color=QColor("black")
|
||||
self.plt_imag = plt_imag
|
||||
self.data_curve_real = pg.PlotDataItem(x=N.array([N.nan]),y=N.array([N.nan]), pen=myPen)
|
||||
self.plt_real = plt_real
|
||||
|
||||
|
||||
self.data_curve_real = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
|
||||
self.data_curve_imag = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
|
||||
self.plt_imag.addItem(self.data_curve_imag)
|
||||
self.plt_real.addItem(self.data_curve_real)
|
||||
|
||||
self.data_curve_imag = pg.PlotDataItem(x=N.array([N.nan]),y=N.array([N.nan]), pen=myPen)
|
||||
self.plt_imag = plt_imag
|
||||
self.plt_imag.addItem(self.data_curve_imag)
|
||||
|
||||
self.limits = limits
|
||||
|
||||
self.frequency = None
|
||||
self.conductivity = None
|
||||
self.epsilon_static = None
|
||||
self.f=Functions()
|
||||
|
||||
self._color = QColor("white")
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
return self._color
|
||||
|
||||
@color.setter
|
||||
def color(self, c):
|
||||
self._color = c
|
||||
self.data_curve_real.setPen(c)
|
||||
self.data_curve_imag.setPen(c)
|
||||
|
||||
self.id_string = "conductivity"
|
||||
|
||||
def getParameter(self):
|
||||
p = self.widget.getTable()
|
||||
@ -122,22 +128,6 @@ class Conductivity(QObject):
|
||||
self.widget.updateTable(beta, sd_beta)
|
||||
self.updateData()
|
||||
|
||||
def updateData(self):
|
||||
# get current axis limits
|
||||
x_min, x_max, y_min, y_max = self.limits
|
||||
self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 254)
|
||||
p = self.getParameter()
|
||||
|
||||
y = self.f.cond_cmplx(p, self.frequency)
|
||||
self.conductivity = y # imaginary part
|
||||
|
||||
self.data_curve_real.setData(x=self.frequency, y=self.conductivity[0], label="Cond.")
|
||||
self.data_curve_imag.setData(x=self.frequency, y=self.conductivity[1], label="Cond.")
|
||||
self.changedData.emit()
|
||||
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def get_data(self):
|
||||
return self.frequency, self.conductivity
|
||||
@ -152,52 +142,49 @@ class Conductivity(QObject):
|
||||
self.changedData.emit()
|
||||
|
||||
|
||||
class PowerComplex(QObject):
|
||||
changedData = pyqtSignal()
|
||||
removeObj = pyqtSignal(QObject)
|
||||
class Conductivity(BaseObject):
|
||||
def __init__( self, plt_imag=None, plt_real=None, limits=None ):
|
||||
super(Conductivity, self).__init__(plt_real=plt_real, plt_imag=plt_imag, limits=limits)
|
||||
self.widget = CustomWidgets.ConductivityWidget()
|
||||
self.widget.changedTable.connect(self.updateData)
|
||||
self.widget.removeMe.connect(self.removeMe)
|
||||
|
||||
self.color = QColor("blue")
|
||||
|
||||
self.frequency = None
|
||||
self.conductivity = None
|
||||
|
||||
self.id_string = "conductivity"
|
||||
|
||||
|
||||
|
||||
def updateData(self):
|
||||
# get current axis limits
|
||||
x_min, x_max, y_min, y_max = self.limits
|
||||
self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 254)
|
||||
p = self.getParameter()
|
||||
|
||||
self.conductivity = self.f.cond_cmplx(p, self.frequency)
|
||||
|
||||
self.data_curve_real.setData(x=self.frequency, y=self.conductivity[0], label="Cond.")
|
||||
self.data_curve_imag.setData(x=self.frequency, y=self.conductivity[1], label="Cond.")
|
||||
self.changedData.emit()
|
||||
|
||||
|
||||
|
||||
class PowerComplex(BaseObject):
|
||||
def __init__( self, plt_real=None, plt_imag=None, limits=None ):
|
||||
QObject.__init__(self)
|
||||
super(PowerComplex, self)
|
||||
super(PowerComplex, self).__init__(plt_real=plt_real, plt_imag=plt_imag, limits=limits)
|
||||
self.widget = CustomWidgets.PowerLawWidget()
|
||||
self.widget.changedTable.connect(self.updateData)
|
||||
self.widget.removeMe.connect(self.removeMe)
|
||||
myPen = pg.mkPen( style=Qt.DashLine, width=2.5)
|
||||
self.color=QColor("black")
|
||||
|
||||
self.data_curve_real = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
|
||||
self.data_curve_imag = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
|
||||
self.plt_imag = plt_imag
|
||||
self.plt_real = plt_real
|
||||
self.plt_imag.addItem(self.data_curve_imag)
|
||||
self.plt_real.addItem(self.data_curve_real)
|
||||
|
||||
self.limits = limits
|
||||
|
||||
self.frequency = None
|
||||
self.powerlaw = None
|
||||
|
||||
self.f = Functions()
|
||||
self.color = QColor("#ff44c4")
|
||||
self.id_string = 'power'
|
||||
|
||||
def removeMe(self):
|
||||
self.plt_real.removeItem(self.data_curve_real)
|
||||
self.plt_imag.removeItem(self.data_curve_imag)
|
||||
self.removeObj.emit(self)
|
||||
self.changedData.emit()
|
||||
|
||||
def getParameter(self):
|
||||
p = self.widget.getTable()
|
||||
return p
|
||||
|
||||
def getFixed(self):
|
||||
p = self.widget.fixedParameter()
|
||||
return p
|
||||
|
||||
def setParameter(self, beta, sd_beta=None):
|
||||
self.widget.updateTable(beta, sd_beta)
|
||||
self.updateData()
|
||||
|
||||
def updateData(self):
|
||||
# get current axis limits
|
||||
x_min, x_max, y_min, y_max = self.limits
|
||||
@ -211,56 +198,21 @@ class PowerComplex(QObject):
|
||||
self.changedData.emit()
|
||||
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def get_data(self):
|
||||
return self.frequency, self.powerlaw
|
||||
|
||||
|
||||
|
||||
class Static(QObject):
|
||||
changedData = pyqtSignal()
|
||||
removeObj = pyqtSignal(QObject)
|
||||
|
||||
class Static(BaseObject):
|
||||
def __init__( self, plt_real=None, plt_imag=None, limits=None ):
|
||||
QObject.__init__(self)
|
||||
super(Static, self)
|
||||
self.plt_real = plt_real
|
||||
self.plt_imag = plt_imag
|
||||
super(Static, self).__init__(plt_real=plt_real, plt_imag=plt_imag, limits=limits)
|
||||
|
||||
self.widget = CustomWidgets.StaticWidget()
|
||||
self.widget.changedTable.connect(self.updateData)
|
||||
self.widget.removeMe.connect(self.removeMe)
|
||||
myPen = pg.mkPen( style=Qt.DashLine, width=2.5)
|
||||
self.color=QColor("black")
|
||||
|
||||
self.data_curve_real = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
|
||||
self.plt_real.addItem(self.data_curve_real)
|
||||
|
||||
self.limits = limits
|
||||
|
||||
self.frequency = None
|
||||
self.static = None
|
||||
|
||||
self.f = Functions()
|
||||
self.color = QColor('#FF0F13')
|
||||
self.id_string = 'static'
|
||||
|
||||
def removeMe(self):
|
||||
self.plt_real.removeItem(self.data_curve_real)
|
||||
self.removeObj.emit(self)
|
||||
self.changedData.emit()
|
||||
|
||||
def getParameter(self):
|
||||
p = self.widget.getTable()
|
||||
return p
|
||||
|
||||
def getFixed(self):
|
||||
p = self.widget.fixedParameter()
|
||||
return p
|
||||
|
||||
def setParameter(self, beta, sd_beta=None):
|
||||
self.widget.updateTable(beta, sd_beta)
|
||||
self.updateData()
|
||||
|
||||
def updateData(self):
|
||||
# get current axis limits
|
||||
@ -272,62 +224,22 @@ class Static(QObject):
|
||||
self.changedData.emit()
|
||||
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def get_data(self):
|
||||
return self.frequency, self.static
|
||||
|
||||
|
||||
|
||||
|
||||
#def conductivity(p, nu):
|
||||
# c = p[0] / (2 * N.pi * nu) ** p[1]
|
||||
# return c
|
||||
|
||||
|
||||
class Peak(QObject):
|
||||
changedData = pyqtSignal()
|
||||
removeObj = pyqtSignal(QObject)
|
||||
|
||||
class Peak(BaseObject):
|
||||
def __init__( self, id_num=None, plt_real=None, plt_imag=None, limits=None ):
|
||||
QObject.__init__(self)
|
||||
super(Peak, self).__init__()
|
||||
super(Peak, self).__init__(plt_real=plt_real, plt_imag=plt_imag, limits=limits)
|
||||
self.widget = CustomWidgets.PeakWidget()
|
||||
self.widget.setId(id_num)
|
||||
self.color = id_to_color(id_num)
|
||||
self.id_num = id_num
|
||||
self.widget.setColor(self.color)
|
||||
self.widget.changedTable.connect(self.updatePeak)
|
||||
self.widget.changedTable.connect(self.updateData)
|
||||
self.widget.removeMe.connect(self.removeMe)
|
||||
self.plt_real = plt_real
|
||||
self.plt_imag = plt_imag
|
||||
self.limits = limits
|
||||
|
||||
myPen = pg.mkPen( style=Qt.DashLine, width=3, color=self.color)
|
||||
self.data_curve_imag = pg.PlotDataItem(x=N.array([N.nan]),y=N.array([N.nan]), pen=myPen)
|
||||
self.data_curve_real = pg.PlotDataItem(x=N.array([N.nan]),y=N.array([N.nan]), pen=myPen)
|
||||
self.plt_imag.addItem(self.data_curve_imag)
|
||||
self.plt_real.addItem(self.data_curve_real)
|
||||
self.frequency = None
|
||||
self.epsilon = None
|
||||
self.f = Functions()
|
||||
self.id_string = "hn"
|
||||
|
||||
def getParameter(self):
|
||||
p = self.widget.getTable()
|
||||
return p
|
||||
|
||||
def getFixed(self):
|
||||
p = self.widget.fixedParameter()
|
||||
return p
|
||||
|
||||
def setParameter(self, beta, sd_beta=None):
|
||||
# delta_eps=None, tau=None, a=None, b=None
|
||||
self.widget.updateTable(beta=beta, sd_beta=sd_beta)
|
||||
self.updatePeak()
|
||||
|
||||
def updatePeak(self):
|
||||
def updateData(self):
|
||||
x_min,x_max, y_min, y_max = self.limits
|
||||
self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 1024)
|
||||
self.epsilon = self.f.hn_cmplx(self.getParameter(), self.frequency)
|
||||
@ -335,15 +247,24 @@ class Peak(QObject):
|
||||
self.data_curve_real.setData(x=self.frequency, y=self.epsilon[0])
|
||||
self.changedData.emit()
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def get_data(self):
|
||||
return self.frequency,self.epsilon
|
||||
class YAFF(BaseObject):
|
||||
def __init__( self, plt_real=None, plt_imag=None, limits=None ):
|
||||
super(YAFF, self).__init__(plt_real=plt_real, plt_imag=plt_imag, limits=limits)
|
||||
self.widget = CustomWidgets.YaffWidget()
|
||||
self.widget.changedTable.connect(self.updatePeak)
|
||||
self.widget.removeMe.connect(self.removeMe)
|
||||
self.frequency = None
|
||||
self.epsilon = None
|
||||
self.id_string = "yaff"
|
||||
|
||||
def removeMe(self):
|
||||
self.plt_imag.removeItem(self.data_curve_imag)
|
||||
self.plt_real.removeItem(self.data_curve_real)
|
||||
self.removeObj.emit(self)
|
||||
|
||||
def updatePeak(self):
|
||||
x_min,x_max, y_min, y_max = self.limits
|
||||
self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 1024)
|
||||
self.epsilon = self.f.hn_cmplx(self.getParameter()[:4], self.frequency)
|
||||
self.data_curve_imag.setData(x=self.frequency, y=self.epsilon[1])
|
||||
self.data_curve_real.setData(x=self.frequency, y=self.epsilon[0])
|
||||
self.changedData.emit()
|
||||
|
||||
|
||||
|
BIN
icons/add_yaff.png
Normal file
BIN
icons/add_yaff.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -2,7 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Do. Mär. 20 17:08:04 2014
|
||||
# Created: Do. Mär. 27 13:33:39 2014
|
||||
# by: The Resource Compiler for PyQt (Qt v4.8.5)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
28
libyaff.py
28
libyaff.py
@ -6,26 +6,28 @@ import mathlib
|
||||
import scipy.special
|
||||
import scipy.integrate
|
||||
|
||||
numpat = re.compile('\d+\.\d+')
|
||||
NUM_PROCESSES = 8
|
||||
|
||||
#define norm1(a,b) exp(gammln(b/a))/(a*pow(b/a,b/a))
|
||||
|
||||
#define glntau1(x,t,a,b) exp( -exp( (log(x)-log(t))*a )*b/a) * pow(x/t,b)
|
||||
|
||||
|
||||
def filon(oms, x,y):
|
||||
amps = N.zeros(len(oms), dtype='complex')
|
||||
def filon(oms, unsorted_x,unsorted_y):
|
||||
x = unsorted_x[unsorted_x.argsort()]
|
||||
y = unsorted_y[unsorted_x.argsort()]
|
||||
|
||||
|
||||
amps = zeros(oms.size, dtype='complex')
|
||||
for i,om in enumerate(oms):
|
||||
amps[i] = sum(diff(y)/diff(x)*(cos(om*x[1:])-cos(om*x[:-1])))/om**2
|
||||
amps[i] += 1j*(y[0]/om + N.sum(diff(y)/diff(x)*(sin(om*x[1:])-sin(om*x[:-1])))/om**2)
|
||||
amps[i] = sum(diff(y)/diff(x)*(cos(om*x[1:])-cos(om*x[:-1])))/om**2
|
||||
amps[i] += 1j*(y[0]/om + sum(diff(y)/diff(x)*(sin(om*x[1:])-sin(om*x[:-1])))/om**2)
|
||||
return amps
|
||||
|
||||
|
||||
class Yaff:
|
||||
def __init__(self, dist_type=0):
|
||||
self.dist_x = N.logspace(-10,4,512)
|
||||
self.dist_y = N.zeros(self.dist_x.size)
|
||||
self.dist_x = logspace(-10,5,512)
|
||||
self.dist_y = zeros(self.dist_x.size)
|
||||
self.dist_type = [self.yaff,
|
||||
self.yaff_gg,
|
||||
][dist_type]
|
||||
@ -74,7 +76,7 @@ class Yaff:
|
||||
def dist_to_relax(self, ts,dist_x,dist_y):
|
||||
phi = zeros(len(ts))
|
||||
for i,t in enumerate(ts):
|
||||
phi[i] = phi_t(t,dist_x,dist_y)
|
||||
phi[i] = self.phi_t(t,dist_x,dist_y)
|
||||
return phi
|
||||
|
||||
|
||||
@ -112,16 +114,16 @@ class Yaff:
|
||||
"""
|
||||
delta_eps, tau1, a1, b1, lambd, tau2, a2, b2 = p
|
||||
|
||||
dist_ggb = ggb(self.dist_x,tau2,a2,b2)
|
||||
dist_gg = gg(self.dist_x,tau1,a1,b1)
|
||||
dist_ggb = self.ggb(p=[tau2,a2,b2], tau=self.dist_x)
|
||||
dist_gg = self.gg(p=[tau1,a1,b1], tau=self.dist_x)
|
||||
|
||||
ts = logspace(-10,5,1024)
|
||||
ts = logspace(-10,5,768)
|
||||
phi_beta = self.dist_to_relax(ts, self.dist_x, dist_ggb).real
|
||||
phi_alpha = self.dist_to_relax(ts, self.dist_x, dist_gg).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 ).real
|
||||
epp = delta_eps*2*pi*x*filon(2*pi*x, ts, phi_tot )
|
||||
|
||||
if cb != None:
|
||||
cb.next(p,x,epp)
|
||||
|
39
mathlib.py
39
mathlib.py
@ -1,11 +1,13 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
import matplotlib
|
||||
import numpy as N
|
||||
from scipy import optimize as opt, optimize, odr
|
||||
#from QDS import mini_func, multi_hn
|
||||
from PyQt4.QtGui import QColor
|
||||
__author__ = 'markusro'
|
||||
|
||||
from PyQt4.QtGui import QColor
|
||||
|
||||
import numpy as N
|
||||
from scipy import optimize as opt, odr
|
||||
|
||||
import libyaff
|
||||
|
||||
|
||||
def fit_anneal(x, y, p0, fixed, funcs):
|
||||
raise NotImplementedError
|
||||
@ -82,11 +84,8 @@ def hn(p, nu):
|
||||
|
||||
|
||||
def id_to_color(id):
|
||||
"""
|
||||
|
||||
"""
|
||||
colors = ['b', 'r', 'g', 'c', 'm', 'y', 'k']
|
||||
colors = [QColor(54,22,115),
|
||||
colors = [
|
||||
QColor(54,22,115),
|
||||
QColor(160,16,36),
|
||||
QColor(45,142,15),
|
||||
QColor(168,149,17),
|
||||
@ -139,10 +138,12 @@ class Functions:
|
||||
self.list = {
|
||||
# provides functions: "id_string":(function, number_of_parameters)
|
||||
"hn":(self.hn_cmplx,4),
|
||||
"conductivity":(self.cond_cmplx,2),
|
||||
"conductivity":(self.cond_cmplx,3),
|
||||
"power":(self.power_cmplx,2),
|
||||
"static":(self.static_cmplx,1),
|
||||
"yaff":(self.yaff,8)
|
||||
}
|
||||
self.YAFF = libyaff.Yaff()
|
||||
|
||||
def hn_cmplx(self, p, x):
|
||||
om = 2*N.pi*x
|
||||
@ -154,8 +155,8 @@ class Functions:
|
||||
|
||||
def cond_cmplx(self, p, x):
|
||||
om = 2*N.pi*x
|
||||
sgma, n = p
|
||||
cond = sgma/(1j*om)**n
|
||||
sgma, isgma, n = p
|
||||
cond = sgma/(om**n) + isgma/(1j*om**n)# Jonscher (Universal Dielectric Response: e",e' prop sigma/omega**n
|
||||
cplx = N.array([cond.real, -cond.imag])
|
||||
return cplx
|
||||
|
||||
@ -173,6 +174,11 @@ class Functions:
|
||||
#cplx = N.array([static.real, static.imag])
|
||||
return static
|
||||
|
||||
def yaff(self,p,x):
|
||||
ya = self.YAFF.yaff(p,x)
|
||||
cplx = N.array([ya.imag[::-1], ya.real])
|
||||
return cplx
|
||||
|
||||
def get(self,name):
|
||||
return self.list[name]
|
||||
|
||||
@ -188,12 +194,13 @@ class FitFunctionCreator:
|
||||
else:
|
||||
self.data = N.zeros( (2,x.size) )
|
||||
ndx = 0
|
||||
for fn in funcs: # loop over functions and add the results up
|
||||
for fn in funcs: # loop over functions and add the results
|
||||
f,num_p = self.functions.get(fn)
|
||||
p = p0[ndx:ndx + num_p]
|
||||
if x.ndim == 2:
|
||||
x = x[0]
|
||||
self.data += f(p, x) # fit functions take only 1-dim x
|
||||
result = f(p, x)
|
||||
self.data += result # fit functions take only 1-dim x
|
||||
ndx += num_p
|
||||
return self.data
|
||||
|
||||
@ -207,7 +214,7 @@ def fit_odr_cmplx(x, y, p0, fixed, fcns):
|
||||
#we = 1/N.array([y.real**2, y.imag**2])
|
||||
y = N.array([y.real, y.imag])
|
||||
else:
|
||||
raise NotImplementedError,"need complex input for now"
|
||||
raise NotImplementedError, "need complex input for now"
|
||||
dat = odr.Data(x, y, we=we)
|
||||
mod = odr.Model(f.fitfcn, extra_args=fcns)
|
||||
fit = odr.ODR(dat, mod, p0, ifixx=(0,), ifixb=fixed, maxit=8000)
|
||||
|
Loading…
Reference in New Issue
Block a user