major parts work now after refactoring

This commit is contained in:
Markus Rosenstihl 2014-03-20 00:35:07 +01:00
parent 83b738c480
commit 6c2fdc470c
12 changed files with 1920 additions and 386 deletions

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ConductivityGroupBox.ui'
#
# Created: Wed Mar 19 20:57:16 2014
# Created: Thu Mar 20 00:32:53 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(218, 156)
ConductivityGroupBox.resize(204, 129)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@ -40,6 +40,27 @@ 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.checkBox_2 = QtGui.QCheckBox(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.checkBox_2.sizePolicy().hasHeightForWidth())
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.label = QtGui.QLabel(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
@ -61,22 +82,19 @@ class Ui_ConductivityGroupBox(object):
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_6 = QtGui.QLabel(ConductivityGroupBox)
self.label_6.setObjectName(_fromUtf8("label_6"))
self.gridLayout.addWidget(self.label_6, 3, 2, 1, 1)
self.label_4 = QtGui.QLabel(ConductivityGroupBox)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.gridLayout.addWidget(self.label_4, 1, 2, 1, 1)
self.doubleSpinBox_1 = QtGui.QDoubleSpinBox(ConductivityGroupBox)
self.gridLayout.addWidget(self.checkBox_3, 2, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.label_3 = QtGui.QLabel(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.doubleSpinBox_1.sizePolicy().hasHeightForWidth())
self.doubleSpinBox_1.setSizePolicy(sizePolicy)
self.doubleSpinBox_1.setSingleStep(0.05)
self.doubleSpinBox_1.setObjectName(_fromUtf8("doubleSpinBox_1"))
self.gridLayout.addWidget(self.doubleSpinBox_1, 1, 1, 1, 1)
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)
self.label_5 = QtGui.QLabel(ConductivityGroupBox)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.gridLayout.addWidget(self.label_5, 1, 2, 1, 1)
self.doubleSpinBox_3 = QtGui.QDoubleSpinBox(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
@ -86,19 +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, 3, 1, 1, 1)
self.label_5 = QtGui.QLabel(ConductivityGroupBox)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.gridLayout.addWidget(self.label_5, 2, 2, 1, 1)
self.label_1 = QtGui.QLabel(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_1.sizePolicy().hasHeightForWidth())
self.label_1.setSizePolicy(sizePolicy)
self.label_1.setAlignment(QtCore.Qt.AlignCenter)
self.label_1.setObjectName(_fromUtf8("label_1"))
self.gridLayout.addWidget(self.label_1, 1, 0, 1, 1)
self.gridLayout.addWidget(self.doubleSpinBox_3, 2, 1, 1, 1)
self.doubleSpinBox_2 = QtGui.QDoubleSpinBox(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
@ -106,45 +112,7 @@ 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, 2, 1, 1, 1)
self.label_3 = 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, 3, 0, 1, 1)
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.checkBox_2 = QtGui.QCheckBox(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.checkBox_2.sizePolicy().hasHeightForWidth())
self.checkBox_2.setSizePolicy(sizePolicy)
self.checkBox_2.setText(_fromUtf8(""))
self.checkBox_2.setObjectName(_fromUtf8("checkBox_2"))
self.gridLayout.addWidget(self.checkBox_2, 2, 3, 1, 1, QtCore.Qt.AlignHCenter)
self.checkBox_1 = QtGui.QCheckBox(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.checkBox_1.sizePolicy().hasHeightForWidth())
self.checkBox_1.setSizePolicy(sizePolicy)
self.checkBox_1.setLayoutDirection(QtCore.Qt.LeftToRight)
self.checkBox_1.setText(_fromUtf8(""))
self.checkBox_1.setChecked(True)
self.checkBox_1.setObjectName(_fromUtf8("checkBox_1"))
self.gridLayout.addWidget(self.checkBox_1, 1, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.gridLayout.addWidget(self.doubleSpinBox_2, 1, 1, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
self.retranslateUi(ConductivityGroupBox)
@ -154,12 +122,10 @@ 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.setText(_translate("ConductivityGroupBox", "Fix", None))
self.removeButton.setText(_translate("ConductivityGroupBox", "Remove", None))
self.label_6.setText(_translate("ConductivityGroupBox", "TextLabel", None))
self.label_4.setText(_translate("ConductivityGroupBox", "TextLabel", None))
self.label_5.setText(_translate("ConductivityGroupBox", "TextLabel", None))
self.label_1.setText(_translate("ConductivityGroupBox", "<html><head/><body><p>ε<span style=\" vertical-align:sub;\">infty</span></p></body></html>", None))
self.label_3.setText(_translate("ConductivityGroupBox", "α", None))
self.label_2.setText(_translate("ConductivityGroupBox", "σ", None))
self.label_5.setText(_translate("ConductivityGroupBox", "TextLabel", None))

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>218</width>
<height>156</height>
<width>204</width>
<height>129</height>
</rect>
</property>
<property name="sizePolicy">
@ -43,6 +43,42 @@
<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">
<widget class="QLabel" name="label_6">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="3" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="checkBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label">
<property name="sizePolicy">
@ -66,7 +102,7 @@
</property>
</widget>
</item>
<item row="3" column="3" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<item row="2" column="3" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QCheckBox" name="checkBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@ -82,83 +118,7 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;ε&lt;span style=&quot; vertical-align:sub;&quot;&gt;infty&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@ -174,52 +134,37 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<item row="1" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>σ</string>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="3" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="checkBox_2">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="3" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QCheckBox" name="checkBox_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

View File

@ -4,6 +4,7 @@ from PyQt4.QtGui import QGroupBox, QPalette, QColor
import ConductivityGroupBox
import PeakGroupBox
import PowerLawGroupBox
import StaticGroupBox
__author__ = 'markusro'
@ -23,8 +24,8 @@ class LogFSpinBox(QDoubleSpinBox):
self.setMinimum(1e-16)
self.setDecimals(17)
self.setValue(1.0)
def stepBy(self, up_down):
print self.minimum(),self.maximum()
if self.value() != 0.0:
self.setValue(self.value()*10**(up_down/9.0)) # 19 steps per decade
@ -50,12 +51,69 @@ if __name__ == "__main__":
app = QApplication([])
class PeakWidget(QGroupBox):
class BaseWidget(QGroupBox):
changedTable = pyqtSignal()
removeMe = pyqtSignal()
def __init__(self, parent=None):
super(BaseWidget, self).__init__(parent)
self.fixedCheckBoxes = []
self.inputs = []
self.errors = []
def remove(self):
self.removeMe.emit()
def changeValues(self, num):
self.changedTable.emit()
def fixedParameter(self):
return [0 if cb.isChecked() else 1 for cb in self.fixedCheckBoxes]
def setColor(self, color):
r, g, b = color
palette = self.palette()
palette.setColor(QPalette.Foreground, QColor(r, g, b))
self.setPalette(palette)
def getTable(self):
tmp = [i.value() # selects the number, ignores the status
for i in self.inputs]
#print "peakParams:", tmp
return tmp
def update(self):
self.changedTable.emit()
def updateTable(self, beta, sd_beta=None):
for i, arg in enumerate(beta):
self.inputs[i].setValue(arg)
sd_style=""
if i in (0,) and sd_beta is not None:
sd = "+/- %.3e"%(sd_beta[i])
elif i in (1,) and sd_beta is not None:
sd = "+/- %.2f"%(sd_beta[i])
if sd_beta is not None:
if 0.0 < sd_beta[i]/arg < 0.2:
sd_style="background-color: rgba(0, 255, 0, 64);"
if 0.2 < sd_beta[i]/arg < 1.0:
sd_style="background-color: rgba(255,255, 0, 64);"
elif sd_beta[i]/arg > 1.0:
sd_style="background-color: rgba(255, 0, 0, 64);"
else:
sd = "( --- )"
self.errors[i].setStyleSheet(sd_style)
self.errors[i].setText(sd)
class PeakWidget(BaseWidget,QGroupBox):
def __init__(self, parent=None):
QGroupBox.__init__(self)
BaseWidget.__init__(self)
super(PeakWidget, self).__init__(parent)
self.ui = PeakGroupBox.Ui_PeakGroupBox()
# replace eps and tau with LogFSpinBox
@ -97,14 +155,6 @@ class PeakWidget(QGroupBox):
self.ui.removeButton.clicked.connect(self.remove)
def remove(self):
self.removeMe.emit()
def changeValues(self):
self.changedTable.emit()
def _distrib_select(self, dist):
if dist == 0: # hav-neg:
self.ui.checkBox_3.setChecked(False)
@ -142,10 +192,6 @@ class PeakWidget(QGroupBox):
self.ui.doubleSpinBox_4.setDisabled(False)
def fixedParameter(self):
return [0 if cb.isChecked() else 1 for cb in self.fixedCheckBoxes]
def setId(self, id):
self.id = id
self.setTitle("Peak %i" % id)
@ -155,15 +201,10 @@ class PeakWidget(QGroupBox):
palette.setColor(QPalette.Foreground, color)
self.setPalette(palette)
def peakParameter(self):
tmp = [i.value() for i in self.inputs]
return tmp
def update(self):
self.changedTable.emit()
def updateTable(self, beta=None, sd_beta = None):
#print "updateTable", args
for i, arg in enumerate(beta):
self.inputs[i].setValue(arg)
@ -185,16 +226,13 @@ class PeakWidget(QGroupBox):
self.errors[i].setStyleSheet(sd_style)
self.errors[i].setText(sd)
def killme(self):
self.setParent(None)
class ConductivityWidget(QGroupBox):
changedTable = pyqtSignal()
removeMe = pyqtSignal()
class ConductivityWidgetDeprecated( BaseWidget, QGroupBox):
def __init__(self, parent=None):
QGroupBox.__init__(self)
BaseWidget.__init__(self)
super(ConductivityWidget, self).__init__(parent)
self.setTitle(u"Conductivity …")
self.ui = ConductivityGroupBox.Ui_ConductivityGroupBox()
@ -276,14 +314,59 @@ class ConductivityWidget(QGroupBox):
self.errors[i].setText(sd)
class PowerLawWidget(QGroupBox):
changedTable = pyqtSignal()
removeMe = pyqtSignal()
class StaticWidget(BaseWidget, QGroupBox):
def __init__(self, parent=None):
QGroupBox.__init__(self)
super(PowerLawWidget, self).__init__(parent)
BaseWidget.__init__(self)
super(StaticWidget, self).__init__(parent)
self.ui = StaticGroupBox.Ui_StaticGroupBox()
self.ui.setupUi(self)
#self.ui.doubleSpinBox_2.setParent(None)
#self.ui.doubleSpinBox_2 = LogFSpinBox(self)
#self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,1,1)
self.errors = [self.ui.label_4]
self.inputs = [self.ui.doubleSpinBox_1]
self.fixedCheckBoxes = [ self.ui.checkBox_1]
for dsb in self.inputs:
dsb.valueChanged.connect(self.changeValues)
self.ui.removeButton.clicked.connect(self.remove)
def updateTable(self, beta, sd_beta=None):
for i, arg in enumerate(beta):
self.inputs[i].setValue(arg)
sd_style=""
if sd_beta is not None:
sd = "+/- %.2f"%(sd_beta[i])
if 0.0 < sd_beta[i]/arg < 0.2:
sd_style="background-color: rgba(0, 255, 0, 64);"
if 0.2 < sd_beta[i]/arg < 1.0:
sd_style="background-color: rgba(255,255, 0, 64);"
elif sd_beta[i]/arg > 1.0:
sd_style="background-color: rgba(255, 0, 0, 64);"
else:
sd = "( --- )"
self.errors[i].setStyleSheet(sd_style)
self.errors[i].setText(sd)
class ConductivityWidget( BaseWidget, QGroupBox):
def __init__(self, parent=None):
QGroupBox.__init__(self)
BaseWidget.__init__(self)
super(ConductivityWidget, self).__init__(parent)
self.setTitle(u"Conductivity …")
self.ui = PowerLawGroupBox.Ui_PowerLawGroupBox()
self.ui = ConductivityGroupBox.Ui_ConductivityGroupBox()
self.ui.setupUi(self)
self.ui.doubleSpinBox_2.setParent(None)
@ -304,48 +387,30 @@ class PowerLawWidget(QGroupBox):
self.ui.removeButton.clicked.connect(self.remove)
def remove(self):
self.removeMe.emit()
class PowerLawWidget( BaseWidget, QGroupBox):
def __init__(self, parent=None):
QGroupBox.__init__(self)
BaseWidget.__init__(self)
super(PowerLawWidget, self).__init__(parent)
self.ui = PowerLawGroupBox.Ui_PowerLawGroupBox()
self.ui.setupUi(self)
self.ui.doubleSpinBox_2.setParent(None)
self.ui.doubleSpinBox_2 = LogFSpinBox(self)
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,1,1)
def changeValues(self, num):
self.changedTable.emit()
self.errors = [self.ui.label_5,
self.ui.label_6]
def fixedParameter(self):
return [0 if cb.isChecked() else 1 for cb in self.fixedCheckBoxes]
self.inputs = [self.ui.doubleSpinBox_2,
self.ui.doubleSpinBox_3]
def setColor(self, color):
r, g, b = color
palette = self.palette()
palette.setColor(QPalette.Foreground, QColor(r, g, b))
self.setPalette(palette)
self.fixedCheckBoxes = [ self.ui.checkBox_2,
self.ui.checkBox_3]
for dsb in self.inputs:
dsb.valueChanged.connect(self.changeValues)
def getTable(self):
tmp = [i.value() # selects the number, ignores the status
for i in self.inputs]
#print "peakParams:", tmp
return tmp
def update(self):
self.changedTable.emit()
def updateTable(self, beta, sd_beta=None):
for i, arg in enumerate(beta):
self.inputs[i].setValue(arg)
sd_style=""
if i in (0,) and sd_beta is not None:
sd = "+/- %.3e"%(sd_beta[i])
elif i in (1,) and sd_beta is not None:
sd = "+/- %.2f"%(sd_beta[i])
if sd_beta is not None:
if 0.0 < sd_beta[i]/arg < 0.2:
sd_style="background-color: rgba(0, 255, 0, 64);"
if 0.2 < sd_beta[i]/arg < 1.0:
sd_style="background-color: rgba(255,255, 0, 64);"
elif sd_beta[i]/arg > 1.0:
sd_style="background-color: rgba(255, 0, 0, 64);"
else:
sd = "( --- )"
self.errors[i].setStyleSheet(sd_style)
self.errors[i].setText(sd)
self.ui.removeButton.clicked.connect(self.remove)

View File

@ -4,3 +4,4 @@ all:
pyuic4 PeakGroupBox.ui -o PeakGroupBox.py
pyuic4 ConductivityGroupBox.ui -o ConductivityGroupBox.py
pyuic4 PowerLawGroupBox.ui -o PowerLawGroupBox.py
pyuic4 StaticGroupBox.ui -o StaticGroupBox.py

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'PeakGroupBox.ui'
#
# Created: Wed Mar 19 20:57:16 2014
# Created: Thu Mar 20 00:32:53 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!

191
QDS.py
View File

@ -22,7 +22,7 @@ import numpy as N
import QDSMain
from data import Data, Conductivity, Peak, PowerComplex
from data import Data, Conductivity, Peak, PowerComplex, Static
import pyqtgraph as pg
#import yaff
@ -42,7 +42,8 @@ class AppWindow(QMainWindow):
actions = {
self.ui.actionAdd_Peak:self.addPeak,
self.ui.actionAdd_Cond:self.addCond,
self.ui.actionAdd_PowerLaw:self.addPowerComplex
self.ui.actionAdd_PowerLaw:self.addPowerComplex,
self.ui.actionAdd_Eps_Infty:self.addEpsInfty
}
self.myActionGroup = QActionGroup(self)
for a in actions.keys(): self.myActionGroup.addAction(a)
@ -149,16 +150,23 @@ class AppWindow(QMainWindow):
def mousePress(self, evt):
data_pos = self.last_pos
if self.ui.actionAdd_Peak.isChecked():
self.addPeak(data_pos)
self.ui.actionAdd_Peak.setChecked(False)
if self.ui.actionAdd_Cond.isChecked():
self.addCond(data_pos)
self.ui.actionAdd_Cond.setChecked(False)
if self.ui.actionAdd_PowerLaw.isChecked():
self.addPowerComplex(data_pos)
self.ui.actionAdd_PowerLaw.setChecked(False)
if self.ui.actionAdd_Eps_Infty.isChecked():
self.addEpsInfty(data_pos)
self.ui.actionAdd_Eps_Infty.setChecked(False)
def saveFitResult(self):
"""
@ -226,89 +234,82 @@ class AppWindow(QMainWindow):
def addCond(self, pos):
#win = self.parameterWidget
#win.setWindowFlags(win.windowFlags() | Qt.WindowStaysOnTopHint)
if self.Conductivity != None:
return
self.statusBar().showMessage("Click on graph")
self.Conductivity = Conductivity(pgPlotWidget=self.ui.graphicsView, limits=self.data.fit_limits)
self.function_registry.register_function(self.Conductivity)
self.Conductivity.changedData.connect(self.updatePlot)
#print pos.x(), pos.y(),"test", 10**pos.x(),10**pos.y()
cond_par = [0, 10**(pos.y() + pos.x())*2*N.pi , 1.0]
self.Conductivity.setParameter(beta=cond_par)
self.parameterWidget.vlayout.insertWidget(1,self.Conductivity.widget)
self.Conductivity.widget.ui.removeButton.clicked.connect(self.delCond)
_conductivity = Conductivity(pgPlotWidget=self.ui.graphicsView, limits=self.data.fit_limits)
_conductivity.changedData.connect(self.updatePlot)
_conductivity.removeObj.connect(self.delParamterObject)
cond_par = [10**(pos.y() + pos.x())*2*N.pi , 1.0]
_conductivity.setParameter(beta=cond_par)
self.parameterWidget.vlayout.insertWidget(1,_conductivity.widget)
self.function_registry.register_function(_conductivity)
self.parameterWidget.vlayout.update()
self.parameterWidget.showNormal()
self.parameterWidget.raise_()
def delCond(self):
self.cond_param = None
self.cond = None
#self.ui.graphicsView.removeItem(self.Conductivity.data_curve_imag)
#self.ui.graphicsView.removeItem(self.Conductivity.mpl_line_static)
self.function_registry.unregister_function(self.Conductivity)
#del self.Conductivity
#self.Conductivity = None
self.updatePlot()
def addEpsInfty(self, pos):
self.statusBar().showMessage("Click on graph")
_eps_infty = Static(pgPlotWidget=self.ui.graphicsView, limits=self.data.fit_limits)
_eps_infty.changedData.connect(self.updatePlot)
_eps_infty.removeObj.connect(self.delParamterObject)
cond_par = [10**pos.y()]
_eps_infty.setParameter(beta=cond_par)
self.parameterWidget.vlayout.insertWidget(1,_eps_infty.widget)
self.function_registry.register_function(_eps_infty)
self.parameterWidget.vlayout.update()
self.updatePlot()
def addPowerComplex(self, pos):
#win = self.parameterWidget
#win.setWindowFlags(win.windowFlags() | Qt.WindowStaysOnTopHint)
self.statusBar().showMessage("Click on graph")
power_complex = PowerComplex(pgPlotWidget=self.ui.graphicsView, limits=self.data.fit_limits)
power_complex.changedData.connect(self.updatePlot)
self.function_registry.register_function(power_complex)
#print pos.x(), pos.y(),"test", 10**pos.x(),10**pos.y()
_power_complex = PowerComplex(pgPlotWidget=self.ui.graphicsView, limits=self.data.fit_limits)
_power_complex.changedData.connect(self.updatePlot)
_power_complex.removeObj.connect(self.delParamterObject)
cond_par = [10**(pos.y() + pos.x())*2*N.pi , 1.0]
power_complex.setParameter(beta=cond_par)
self.parameterWidget.vlayout.insertWidget(1,power_complex.widget)
#power_complex.widget.ui.removeButton.clicked.connect(self.delPowerComplex)
_power_complex.setParameter(beta=cond_par)
self.parameterWidget.vlayout.insertWidget(1,_power_complex.widget)
self.function_registry.register_function(_power_complex)
self.parameterWidget.vlayout.update()
self.parameterWidget.showNormal()
self.parameterWidget.raise_()
def delPowerComplex(self):
#self.ui.graphicsView.removeItem(self.PowerComplex.data_curve_real)
self.function_registry.unregister_function(self.PowerComplex)
#self.PowerComplex = None
self.updatePlot()
def delParamterObject(self, obj):
print "unregister",obj
#self.ui.graphicsView.removeItem(self.PowerComplex.data_curve_real)
self.function_registry.unregister_function(obj)
self.updatePlot()
def addPeak(self, pos):
self.statusBar().showMessage("Select Peak Position")
#win = self.parameterWidget
#win.setWindowFlags(win.windowFlags() | Qt.WindowStaysOnTopHint)
id_list = [ self.peakBoxes[key] for key in self.peakBoxes.keys()]
self.peakId = 1
while self.peakId in id_list:
self.peakId += 1
self.statusBar().showMessage("Select Peak Position")
peak = Peak(id=self.peakId, mpl=self.ui.graphicsView, limits=self.data.fit_limits)
# connect to delPeak
peak.widget.ui.removeButton.clicked.connect(self.delPeak)
self.function_registry.register_function(peak)
_peak = Peak(id=self.peakId, mpl=self.ui.graphicsView, limits=self.data.fit_limits)
_peak.changedData.connect(self.updatePlot)
_peak.removeObj.connect(self.delParamterObject)
#peak.widget.ui.removeButton.clicked.connect(self.delPeak)
peak.changedData.connect(self.updatePlot)
# delta_eps=(10**pos.y())*2, tau=1 / (2*N.pi*10**pos.x()), a=1, b=1
new_peak = [2*10**pos.y(), 1 / (2*N.pi*10**pos.x()), 1, 1]
peak.setParameter(beta = new_peak)
_peak.setParameter(beta = new_peak)
self.peakBoxes[peak] = self.peakId
self.function_registry.register_function(_peak)
self.peakBoxes[_peak] = self.peakId
for i,pb in enumerate(self.peakBoxes.keys()):
self.parameterWidget.vlayout.insertWidget(1,pb.widget)
self.parameterWidget.vlayout.update()
self.parameterWidget.showNormal()
self.parameterWidget.raise_()
self.updatePlot()
def delPeak(self):
for i, peak in enumerate(self.peakBoxes.keys()):
@ -322,47 +323,33 @@ class AppWindow(QMainWindow):
self.updatePlot()
def fitData(self, method):
if self.Conductivity != None:
start_parameter = list(self.Conductivity.getParameter())
fixed_params = [i for i in self.Conductivity.getFixed()]
else:
start_parameter = [0, 0, 1]
fixed_params = [0, 0, 0]
for pb in self.peakBoxes.keys():
[start_parameter.append(i) for i in pb.getParameter()]
[fixed_params.append(i) for i in pb.getFixed()]
log10fmin, log10fmax = self.fit_boundary.getRegion()
self.data.set_fit_xlimits(10**log10fmin, 10**log10fmax)
fit_methods = [fit_odr_cmplx, fit_lbfgsb, fit_anneal]
print "StartParameter", start_parameter
print "FixedParameter", fixed_params
print "Limits (xmin, xmax, ymin, ymax)", self.data.fit_limits
_freq, _fit = self.data.get_data()
# print "Limits (xmin, xmax, ymin, ymax)", self.data.fit_limits
# build function list
funcs = ["static","power"] if self.Conductivity != None else []
for pb in self.peakBoxes.keys():
funcs.append("hn")
newres = fit_methods[method](_freq, _fit, start_parameter, fixed_params, funcs)
print "Set fit data"
self.data.set_fit(newres.beta, funcs)
self.ui.statusbar.showMessage(" ".join(newres.stopreason))
result = newres.beta
p0,funcs,fixed_params = [],[],[]
for fcn in self.function_registry.get_registered_functions():
p0.extend(fcn.getParameter())
funcs.append(fcn.id_string)
fixed_params.extend(fcn.getFixed())
_freq, _fit = self.data.get_data()
odr_result = fit_methods[method](_freq, _fit, p0, fixed_params, funcs)
print "Set fit data"
self.data.set_fit(odr_result.beta, funcs)
self.ui.statusbar.showMessage(" ".join(odr_result.stopreason))
result = odr_result.beta
i=0
for fcn in self.function_registry.get_registered_functions():
num_p = len(fcn.getParameter())
beta = odr_result.beta[i:num_p+i]
sd_beta = odr_result.sd_beta[i:num_p+i]
fcn.setParameter(beta, sd_beta)
i += num_p
self.fitresult = result
for i, pb in enumerate(self.peakBoxes.keys()):
beta_peak = newres.beta [3 + i*4 : 3 + (i + 1)*4]
sd_beta_peak = newres.sd_beta[3 + i*4 : 3 + (i + 1)*4]
pb.setParameter(beta = beta_peak, sd_beta = sd_beta_peak)
if self.Conductivity != None:
self.Conductivity.setParameter(beta = newres.beta[:3], sd_beta = newres.sd_beta[:3])
#print "*** FIT RESULTS ***"
#print u"\u03c3"
#print u"\u0394\u03b5"
self.updatePlot()
def openFile(self):
@ -398,22 +385,18 @@ class AppWindow(QMainWindow):
def updatePlot(self):
print self.function_registry.get_registered_functions()
# assemble fit function
funcs = ["static", "power"]
p0 = self.Conductivity.getParameter() if self.Conductivity is not None else [0.0, 0.0, 1.0]
for peak in self.peakBoxes.keys():
params = peak.getParameter()
p0.extend(params)
funcs.append("hn")
# calculate fit
p0,funcs = [],[]
for fcn in self.function_registry.get_registered_functions():
p0.extend(fcn.getParameter())
funcs.append(fcn.id_string)
# calculate parameterized curve
self.data.set_fit(p0, funcs)
# replot data and fit, TODO: replot only if data changed
self.data.data_curve_real.setData(self.data.frequency, self.data.epsilon.real)
self.data.data_curve_imag.setData(self.data.frequency, self.data.epsilon.imag)
if len(self.peakBoxes) > 0 or self.Conductivity != None:
if len(funcs)> 0:
self.data.fitted_curve_real.setData(self.data.frequency, self.data.epsilon_fit.real)
self.data.fitted_curve_imag.setData(self.data.frequency, self.data.epsilon_fit.imag)

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'QDSMain.ui'
#
# Created: Wed Mar 19 20:57:16 2014
# Created: Thu Mar 20 00:32:53 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
@ -89,9 +89,16 @@ class Ui_MainWindow(object):
self.actionAdd_PowerLaw.setCheckable(True)
self.actionAdd_PowerLaw.setIcon(icon1)
self.actionAdd_PowerLaw.setObjectName(_fromUtf8("actionAdd_PowerLaw"))
self.actionAdd_Eps_Infty = QtGui.QAction(MainWindow)
self.actionAdd_Eps_Infty.setCheckable(True)
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/add_eps_infty.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionAdd_Eps_Infty.setIcon(icon3)
self.actionAdd_Eps_Infty.setObjectName(_fromUtf8("actionAdd_Eps_Infty"))
self.toolBar.addAction(self.actionAdd_Peak)
self.toolBar.addAction(self.actionAdd_Cond)
self.toolBar.addAction(self.actionAdd_PowerLaw)
self.toolBar.addAction(self.actionAdd_Eps_Infty)
self.toolBar.addAction(self.actionSave_FitResult)
self.retranslateUi(MainWindow)
@ -105,8 +112,10 @@ class Ui_MainWindow(object):
self.actionAdd_Cond.setToolTip(_translate("MainWindow", "Added Conductivity Term", None))
self.actionSave_FitResult.setText(_translate("MainWindow", "Save Fit", None))
self.actionSave_FitResult.setToolTip(_translate("MainWindow", "Save Fit Result", None))
self.actionAdd_PowerLaw.setText(_translate("MainWindow", "Power Law", None))
self.actionAdd_PowerLaw.setText(_translate("MainWindow", "Add Power Law", None))
self.actionAdd_PowerLaw.setToolTip(_translate("MainWindow", "Add (complex) Power Law", None))
self.actionAdd_Eps_Infty.setText(_translate("MainWindow", "Add e_infty", None))
self.actionAdd_Eps_Infty.setToolTip(_translate("MainWindow", "Add eps_infty", None))
from pyqtgraph import PlotWidget
import images_rc

View File

@ -66,6 +66,7 @@
<addaction name="actionAdd_Peak"/>
<addaction name="actionAdd_Cond"/>
<addaction name="actionAdd_PowerLaw"/>
<addaction name="actionAdd_Eps_Infty"/>
<addaction name="actionSave_FitResult"/>
</widget>
<widget class="QDockWidget" name="dockWidget_3">
@ -125,12 +126,27 @@
<normaloff>:/icons/add_cond.svg</normaloff>:/icons/add_cond.svg</iconset>
</property>
<property name="text">
<string>Power Law</string>
<string>Add Power Law</string>
</property>
<property name="toolTip">
<string>Add (complex) Power Law</string>
</property>
</action>
<action name="actionAdd_Eps_Infty">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="icons/images.qrc">
<normaloff>:/icons/add_eps_infty.png</normaloff>:/icons/add_eps_infty.png</iconset>
</property>
<property name="text">
<string>Add e_infty</string>
</property>
<property name="toolTip">
<string>Add eps_infty</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

100
data.py
View File

@ -78,6 +78,7 @@ class Data:
class Conductivity(QObject):
changedData = pyqtSignal()
removeObj = pyqtSignal(QObject)
def __init__(self, pgPlotWidget=None, limits=None):
QObject.__init__(self)
@ -91,10 +92,8 @@ class Conductivity(QObject):
self.color=QColor("black")
self.data_curve_imag = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
self.data_static_real = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
self.pgPlotWidget = pgPlotWidget
self.pgPlotWidget.addItem(self.data_curve_imag)
self.pgPlotWidget.addItem(self.data_static_real)
self.limits = limits
self.frequency = None
@ -119,15 +118,13 @@ class Conductivity(QObject):
# 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), 1024)
eps_static, sigma, sigma_N = self.getParameter()
sigma, sigma_N = self.getParameter()
y = self.f.cond_cmplx([sigma, sigma_N], self.frequency)
self.epsilon_static = N.ones(len(self.frequency)) * eps_static
self.conductivity = y[1] # imaginary part
self.data_curve_imag.setData(x=self.frequency, y=self.conductivity, label="Cond.")
self.data_static_real.setData(x=self.frequency, y=self.epsilon_static)
self.changedData.emit()
@ -142,11 +139,13 @@ class Conductivity(QObject):
def removeMe(self):
self.pg_plot_widget.removeItem(self.data_curve_imag)
self.pg_plot_widget.removeItem(self.data_static_real)
self.removeObj.emit(self)
self.changedData.emit()
class PowerComplex(QObject):
changedData = pyqtSignal()
removeObj = pyqtSignal(QObject)
def __init__(self, pgPlotWidget=None, limits=None):
QObject.__init__(self)
@ -171,6 +170,8 @@ class PowerComplex(QObject):
def removeMe(self):
self.pg_plot_widget.removeItem(self.data_curve_real)
self.removeObj.emit(self)
self.changedData.emit()
def getParameter(self):
p = self.widget.getTable()
@ -203,13 +204,76 @@ class PowerComplex(QObject):
return self.frequency, self.powerlaw
def conductivity(p, nu):
c = p[0] / (2 * N.pi * nu) ** p[1]
return c
class Static(QObject):
changedData = pyqtSignal()
removeObj = pyqtSignal(QObject)
def __init__(self, pgPlotWidget=None, limits=None):
QObject.__init__(self)
super(Static, self)
self.widget = CustomWidgets.StaticWidget()
self.widget.changedTable.connect(self.updateData)
self.widget.removeMe.connect(self.removeMe)
myPen = pg.mkPen( style=Qt.DashLine, width=1.5)
self.color=QColor("black")
self.data_curve_real = pg.PlotDataItem(x=N.array([N.nan]), y=N.array([N.nan]), pen=myPen)
self.pg_plot_widget = pgPlotWidget
self.pg_plot_widget.addItem(self.data_curve_real)
self.limits = limits
self.frequency = None
self.static = None
self.f = Functions()
self.id_string = 'static'
def removeMe(self):
self.pg_plot_widget.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
x_min, x_max, y_min, y_max = self.limits
p = self.getParameter()
self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 1024)
self.static = self.f.static_cmplx(p, self.frequency) [0] # real part
self.data_curve_real.setData(x=self.frequency, y=self.static, label="Power Law")
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)
def __init__(self, id=None, mpl=None, limits=None):
QObject.__init__(self)
@ -219,18 +283,19 @@ class Peak(QObject):
self.color = id_to_color(id)
self.widget.setColor(self.color)
self.widget.changedTable.connect(self.updatePeak)
self.mpl = mpl
self.widget.removeMe.connect(self.removeMe)
self.pg_plot_widget = mpl
self.limits = limits
myPen = pg.mkPen( style=Qt.DashLine, width=2, color=self.color)
self.mpl_line = pg.PlotDataItem(x=N.array([N.nan]),y=N.array([N.nan]), pen=myPen)
self.mpl.addItem(self.mpl_line)
self.data_curve_imag = pg.PlotDataItem(x=N.array([N.nan]),y=N.array([N.nan]), pen=myPen)
self.pg_plot_widget.addItem(self.data_curve_imag)
self.frequency = None
self.epsilon = None
self.id_string = "hn"
def getParameter(self):
p = self.widget.peakParameter()
p = self.widget.getTable()
return p
def getFixed(self):
@ -255,11 +320,16 @@ class Peak(QObject):
#nu = nu[mask]
self.frequency = nu[:]
self.epsilon = y[:]
self.mpl_line.setData(x=nu, y=y)
self.data_curve_imag.setData(x=nu, y=y)
self.changedData.emit()
def get_color(self):
return self.color
def get_data(self):
return self.frequency,self.epsilon
return self.frequency,self.epsilon
def removeMe(self):
self.pg_plot_widget.removeItem(self.data_curve_imag)
self.removeObj.emit(self)
self.changedData.emit()

View File

@ -1,8 +1,9 @@
<RCC>
<qresource prefix="icons">
<file>add_cond.svg</file>
<file>add_peak.svg</file>
<file>save_fit.svg</file>
<file>fit_limits.png</file>
</qresource>
<qresource prefix="icons">
<file>add_eps_infty.png</file>
<file>add_cond.svg</file>
<file>add_peak.svg</file>
<file>save_fit.svg</file>
<file>fit_limits.png</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -219,16 +219,20 @@ class FunctionRegister:
self.registry = {}
def register_function(self,obj):
print "FR: Registering:",obj
id_string = obj.id_string
if self.registry.has_key(obj):
raise AssertionError,"The object is already registered! This should NOT happen"
self.registry[obj]=id_string
print "FR: ",self.registry
def unregister_function(self, obj):
print "FR: UnRegistering:",obj
if self.registry.has_key(obj):
self.registry.pop(obj)
else:
raise AssertionError,"The object is not in the registry! This should NOT happen"
print "FR: ",self.registry
def get_registered_functions(self):
return self.registry