diff --git a/ConductivityGroupBox.py b/ConductivityGroupBox.py
index d20de70..812176a 100644
--- a/ConductivityGroupBox.py
+++ b/ConductivityGroupBox.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ConductivityGroupBox.ui'
#
-# Created: Thu Mar 20 00:40:00 2014
+# Created: Thu Mar 20 13:41:01 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
diff --git a/CustomWidgets.py b/CustomWidgets.py
index f213540..970cd57 100644
--- a/CustomWidgets.py
+++ b/CustomWidgets.py
@@ -78,7 +78,7 @@ class BaseWidget(QGroupBox):
def getTable(self):
tmp = [i.value() # selects the number, ignores the status
for i in self.inputs]
- #print "peakParams:", tmp
+ #print "getTable:", tmp
return tmp
def update(self):
@@ -116,9 +116,8 @@ class PeakWidget(BaseWidget,QGroupBox):
BaseWidget.__init__(self)
super(PeakWidget, self).__init__(parent)
self.ui = PeakGroupBox.Ui_PeakGroupBox()
- # replace eps and tau with LogFSpinBox
-
self.ui.setupUi(self)
+ # replace eps and tau with LogFSpinBox
self.ui.doubleSpinBox_1.setParent(None)
self.ui.doubleSpinBox_1 = LogFSpinBox(self)
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_1,1,1)
@@ -126,6 +125,8 @@ class PeakWidget(BaseWidget,QGroupBox):
self.ui.doubleSpinBox_2 = LogFSpinBox(self)
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,2,1)
+ self.ui.removeButton.clicked.connect(self.remove)
+
self.inputs = [
self.ui.doubleSpinBox_1,
self.ui.doubleSpinBox_2,
@@ -153,7 +154,6 @@ class PeakWidget(BaseWidget,QGroupBox):
# self.ui.checkBox_4.stateChanged.connect(self._distrib_cd)
self.ui.comboBox.currentIndexChanged.connect(self._distrib_select)
- self.ui.removeButton.clicked.connect(self.remove)
def _distrib_select(self, dist):
if dist == 0: # hav-neg:
@@ -245,93 +245,6 @@ class PeakWidget(BaseWidget,QGroupBox):
self.errors[i].setText(sd)
-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()
- self.ui.setupUi(self)
-
- # eps_static
- #self.ui.doubleSpinBox_1.setParent(None)
- #self.ui.doubleSpinBox_1 = LogFSpinBox(self)
- #self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_1,1,1)
-
- # dc_conductivity
- self.ui.doubleSpinBox_2.setParent(None)
- self.ui.doubleSpinBox_2 = LogFSpinBox(self)
- self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,2,1)
-
- self.errors = [
- self.ui.label_4,
- self.ui.label_5,
- self.ui.label_6,
- ]
-
-
-
- self.inputs = [self.ui.doubleSpinBox_1,
- self.ui.doubleSpinBox_2,
- self.ui.doubleSpinBox_3]
- self.fixedCheckBoxes = [self.ui.checkBox_1,
- self.ui.checkBox_2,
- self.ui.checkBox_3]
- for dsb in self.inputs:
- dsb.valueChanged.connect(self.changeValues)
-
- self.ui.removeButton.clicked.connect(self.remove)
-
- 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 (1,) and sd_beta is not None:
- sd = "+/- %.3e"%(sd_beta[i])
- elif i in (0,2) 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 StaticWidget(BaseWidget, QGroupBox):
def __init__(self, parent=None):
@@ -376,20 +289,20 @@ class StaticWidget(BaseWidget, QGroupBox):
-class ConductivityWidget( BaseWidget, QGroupBox):
+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 = ConductivityGroupBox.Ui_ConductivityGroupBox()
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.ui.removeButton.clicked.connect(self.remove)
self.errors = [self.ui.label_5,
@@ -403,9 +316,8 @@ class ConductivityWidget( BaseWidget, QGroupBox):
for dsb in self.inputs:
dsb.valueChanged.connect(self.changeValues)
- self.ui.removeButton.clicked.connect(self.remove)
-class PowerLawWidget( BaseWidget, QGroupBox):
+class PowerLawWidget(BaseWidget, QGroupBox):
def __init__(self, parent=None):
QGroupBox.__init__(self)
@@ -418,7 +330,7 @@ class PowerLawWidget( BaseWidget, QGroupBox):
self.ui.doubleSpinBox_2.setParent(None)
self.ui.doubleSpinBox_2 = LogFSpinBox(self)
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,1,1)
-
+ self.ui.removeButton.clicked.connect(self.remove)
self.errors = [self.ui.label_5,
self.ui.label_6]
@@ -431,4 +343,3 @@ class PowerLawWidget( BaseWidget, QGroupBox):
for dsb in self.inputs:
dsb.valueChanged.connect(self.changeValues)
- self.ui.removeButton.clicked.connect(self.remove)
\ No newline at end of file
diff --git a/PeakGroupBox.py b/PeakGroupBox.py
index e9c00f5..0daf6fd 100644
--- a/PeakGroupBox.py
+++ b/PeakGroupBox.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'PeakGroupBox.ui'
#
-# Created: Thu Mar 20 00:40:00 2014
+# Created: Thu Mar 20 13:41:01 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
diff --git a/PowerLawGroupBox.py b/PowerLawGroupBox.py
index 403f45f..a571f96 100644
--- a/PowerLawGroupBox.py
+++ b/PowerLawGroupBox.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'PowerLawGroupBox.ui'
#
-# Created: Thu Mar 20 00:40:00 2014
+# Created: Thu Mar 20 13:41:01 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
diff --git a/QDS.py b/QDS.py
index 0532eda..307cf4b 100755
--- a/QDS.py
+++ b/QDS.py
@@ -106,10 +106,11 @@ class AppWindow(QMainWindow):
self.data = Data()
self.fit_boundary = pg.LinearRegionItem(brush=QColor(0,127,254,15))
- self.ui.graphicsView.addItem(self.data.data_curve_imag)
- self.ui.graphicsView.addItem(self.data.data_curve_real)
- self.ui.graphicsView.addItem(self.data.fitted_curve_imag)
- self.ui.graphicsView.addItem(self.data.fitted_curve_real)
+
+ self.ui.pgPlotWidget_imag.addItem(self.data.data_curve_imag)
+ self.ui.pgPlotWidget_real.addItem(self.data.data_curve_real)
+ self.ui.pgPlotWidget_imag.addItem(self.data.fitted_curve_imag)
+ self.ui.pgPlotWidget_real.addItem(self.data.fitted_curve_real)
# cross hair
if USE_CROSSH:
@@ -117,30 +118,50 @@ class AppWindow(QMainWindow):
self.horizontalLine = pg.InfiniteLine(angle=0)
self.verticalLine = pg.InfiniteLine(angle=90)
- #self.ui.graphicsView.plotItem.addItem(self.poslabel)
- self.ui.graphicsView.addItem(self.horizontalLine)
- self.ui.graphicsView.addItem(self.verticalLine)
+ #self.ui.pgPlotWidget_imag.plotItem.addItem(self.poslabel)
+ self.ui.pgPlotWidget_imag.addItem(self.horizontalLine)
+ self.ui.pgPlotWidget_imag.addItem(self.verticalLine)
- self.ui.graphicsView.addItem(self.fit_boundary)
- self.ui.graphicsView.setLogMode(x=True, y=True)
- self.ui.graphicsView.showGrid(x=True, y=True)
- self.ui.graphicsView.setLabel("bottom","Frequency",units="Hz")
- self.ui.graphicsView.setLabel("left", "Dielectric loss", units="Debye")
- self.ui.graphicsView.disableAutoRange()
+ self.ui.pgPlotWidget_imag.addItem(self.fit_boundary)
+
+ for pltwidgt in (self.ui.pgPlotWidget_real, self.ui.pgPlotWidget_imag):
+ pltwidgt.setLogMode(x=True, y=True)
+ pltwidgt.showGrid(x=True, y=True)
+ pltwidgt.disableAutoRange()
+ pltwidgt.setLabel("bottom","Frequency",units="Hz")
+
+ self.ui.pgPlotWidget_imag.setLabel("left", "(I) Dielectric loss", units="Debye")
+ self.ui.pgPlotWidget_real.setLabel("left", "(R) Dielectric loss", units="Debye")
#self.peak_box_layout = QGridLayout()
#self.ui.scrollAreaWidgetContents.setLayout(self.peak_box_layout)
##self.huh = pg.SignalProxy(, slot=self.mPE)
- sc = self.ui.graphicsView.scene()
- sc.sigMouseClicked.connect(self.mousePress)
+ sc_real = self.ui.pgPlotWidget_real.scene()
+ sc_real.sigMouseClicked.connect(self.mousePress)
+
+ sc_real.sigMouseMoved.connect(self.updateCrosshair)
+
+ sc_imag = self.ui.pgPlotWidget_imag.scene()
+ sc_imag.sigMouseClicked.connect(self.mousePress)
+
+ sc_imag.sigMouseMoved.connect(self.updateCrosshair)
- sc.sigMouseMoved.connect(self.updateCrosshair)
def updateCrosshair(self,evt):
- vb = self.ui.graphicsView.getPlotItem().vb
- pos = vb.mapSceneToView(evt)
+
+ vb_real = self.ui.pgPlotWidget_real.getPlotItem().vb
+ vb_imag = self.ui.pgPlotWidget_imag.getPlotItem().vb
+
+ if self.ui.pgPlotWidget_imag.underMouse():
+ pos = vb_imag.mapSceneToView(evt)
+ elif self.ui.pgPlotWidget_real.underMouse():
+ pos = vb_real.mapSceneToView(evt)
+ else:
+ pos = QPointF(1.0,1.0)
+
self.last_pos = pos
+
if USE_CROSSH:
self.horizontalLine.setBounds([self.data.frequency.min(), self.data.frequency.max()])
self.horizontalLine.setPos(pos.y())
@@ -151,21 +172,43 @@ class AppWindow(QMainWindow):
def mousePress(self, evt):
data_pos = self.last_pos
+ mouse_in_imag = self.ui.pgPlotWidget_imag.underMouse()
+ mouse_in_real = self.ui.pgPlotWidget_real.underMouse()
+
+ msgBox = QMessageBox()
+
if self.ui.actionAdd_Peak.isChecked():
- self.addPeak(data_pos)
- self.ui.actionAdd_Peak.setChecked(False)
+ if mouse_in_imag:
+ self.addPeak(data_pos)
+ self.ui.actionAdd_Peak.setChecked(False)
+ else:
+ msgBox.setText("Click in imaginary part")
+ msgBox.exec_()
if self.ui.actionAdd_Cond.isChecked():
- self.addCond(data_pos)
- self.ui.actionAdd_Cond.setChecked(False)
+ if mouse_in_imag:
+ self.addCond(data_pos)
+ self.ui.actionAdd_Cond.setChecked(False)
+ else:
+ msgBox.setText("Click in imaginary part")
+ msgBox.exec_()
+
if self.ui.actionAdd_PowerLaw.isChecked():
- self.addPowerComplex(data_pos)
- self.ui.actionAdd_PowerLaw.setChecked(False)
+ if mouse_in_imag:
+ self.addPowerComplex(data_pos)
+ self.ui.actionAdd_PowerLaw.setChecked(False)
+ else:
+ msgBox.setText("Click in imaginary part")
+ msgBox.exec_()
if self.ui.actionAdd_Eps_Infty.isChecked():
- self.addEpsInfty(data_pos)
- self.ui.actionAdd_Eps_Infty.setChecked(False)
+ if mouse_in_real:
+ self.addEpsInfty(data_pos)
+ self.ui.actionAdd_Eps_Infty.setChecked(False)
+ else:
+ msgBox.setText("Click in real part")
+ msgBox.exec_()
def saveFitResult(self):
@@ -234,8 +277,9 @@ class AppWindow(QMainWindow):
def addCond(self, pos):
- self.statusBar().showMessage("Click on graph")
- _conductivity = Conductivity(pgPlotWidget=self.ui.graphicsView, limits=self.data.fit_limits)
+ _conductivity = Conductivity(plt_real=self.ui.pgPlotWidget_real,
+ plt_imag=self.ui.pgPlotWidget_imag,
+ limits=self.data.fit_limits)
_conductivity.changedData.connect(self.updatePlot)
_conductivity.removeObj.connect(self.delParamterObject)
@@ -247,9 +291,26 @@ class AppWindow(QMainWindow):
self.parameterWidget.vlayout.update()
self.updatePlot()
+
+ def addPowerComplex(self, pos):
+ _power_complex = PowerComplex(plt_imag=self.ui.pgPlotWidget_imag,
+ plt_real=self.ui.pgPlotWidget_real,
+ 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)
+ self.function_registry.register_function(_power_complex)
+ self.parameterWidget.vlayout.update()
+ 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 = Static(plt_imag=self.ui.pgPlotWidget_imag,
+ plt_real=self.ui.pgPlotWidget_real,
+ limits=self.data.fit_limits)
_eps_infty.changedData.connect(self.updatePlot)
_eps_infty.removeObj.connect(self.delParamterObject)
@@ -262,23 +323,9 @@ class AppWindow(QMainWindow):
self.updatePlot()
- def addPowerComplex(self, pos):
- self.statusBar().showMessage("Click on graph")
-
- _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)
- self.function_registry.register_function(_power_complex)
- self.parameterWidget.vlayout.update()
- 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()
@@ -286,15 +333,16 @@ class AppWindow(QMainWindow):
def addPeak(self, pos):
- self.statusBar().showMessage("Select Peak Position")
+ id_list = [ key.id_num for key in
+ self.function_registry.get_registered_functions().keys()
+ if key.id_string == 'hn']
- id_list = [ self.peakBoxes[key] for key in self.peakBoxes.keys()]
self.peakId = 1
while self.peakId in id_list:
self.peakId += 1
-
- _peak = Peak(id=self.peakId, mpl=self.ui.graphicsView, limits=self.data.fit_limits)
+ _peak = Peak(id_num=self.peakId, plt_real=self.ui.pgPlotWidget_real, plt_imag=self.ui.pgPlotWidget_imag,
+ limits=self.data.fit_limits)
_peak.changedData.connect(self.updatePlot)
_peak.removeObj.connect(self.delParamterObject)
@@ -314,7 +362,7 @@ class AppWindow(QMainWindow):
def delPeak(self):
for i, peak in enumerate(self.peakBoxes.keys()):
if peak.widget.isHidden():
- self.ui.graphicsView.removeItem(peak.mpl_line)
+ self.ui.pgPlotWidget_imag.removeItem(peak.mpl_line)
self.parameterWidget.vlayout.removeWidget(peak.widget)
self.function_registry.unregister_function(peak)
@@ -327,8 +375,6 @@ class AppWindow(QMainWindow):
self.data.set_fit_xlimits(10**log10fmin, 10**log10fmax)
fit_methods = [fit_odr_cmplx, fit_lbfgsb, fit_anneal]
-# print "Limits (xmin, xmax, ymin, ymax)", self.data.fit_limits
-
# build function list
p0,funcs,fixed_params = [],[],[]
for fcn in self.function_registry.get_registered_functions():
@@ -379,9 +425,11 @@ class AppWindow(QMainWindow):
self.data.set_data(_freq, _die_stor, _die_loss)
self.data.meta["T"] = Temp
self.fit_boundary.setRegion([N.log10(_freq.min()), N.log10(_freq.max())])
- self.ui.graphicsView.enableAutoRange()
+ self.ui.pgPlotWidget_imag.enableAutoRange()
+ self.ui.pgPlotWidget_real.enableAutoRange()
self.updatePlot()
- self.ui.graphicsView.disableAutoRange()
+ self.ui.pgPlotWidget_imag.disableAutoRange()
+ self.ui.pgPlotWidget_real.disableAutoRange()
def updatePlot(self):
@@ -400,6 +448,9 @@ class AppWindow(QMainWindow):
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)
+ else:
+ self.data.fitted_curve_real.setData([N.nan],[N.nan])
+ self.data.fitted_curve_imag.setData([N.nan],[N.nan])
def sigint_handler(*args):
"""Handler for the SIGINT signal (CTRL + C).
"""
diff --git a/QDSMain.py b/QDSMain.py
index 0a21c5d..75e3dad 100644
--- a/QDSMain.py
+++ b/QDSMain.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'QDSMain.ui'
#
-# Created: Thu Mar 20 00:39:59 2014
+# Created: Thu Mar 20 13:41:01 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
@@ -41,14 +41,26 @@ class Ui_MainWindow(object):
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
- self.graphicsView = PlotWidget(self.centralwidget)
+ self.splitter = QtGui.QSplitter(self.centralwidget)
+ self.splitter.setOrientation(QtCore.Qt.Horizontal)
+ self.splitter.setObjectName(_fromUtf8("splitter"))
+ self.pgPlotWidget_imag = PlotWidget(self.splitter)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(3)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth())
- self.graphicsView.setSizePolicy(sizePolicy)
- self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
- self.verticalLayout.addWidget(self.graphicsView)
+ sizePolicy.setHeightForWidth(self.pgPlotWidget_imag.sizePolicy().hasHeightForWidth())
+ self.pgPlotWidget_imag.setSizePolicy(sizePolicy)
+ self.pgPlotWidget_imag.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.CrossCursor))
+ self.pgPlotWidget_imag.setObjectName(_fromUtf8("pgPlotWidget_imag"))
+ self.pgPlotWidget_real = PlotWidget(self.splitter)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(3)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.pgPlotWidget_real.sizePolicy().hasHeightForWidth())
+ self.pgPlotWidget_real.setSizePolicy(sizePolicy)
+ self.pgPlotWidget_real.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.CrossCursor))
+ self.pgPlotWidget_real.setObjectName(_fromUtf8("pgPlotWidget_real"))
+ self.verticalLayout.addWidget(self.splitter)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 956, 22))
diff --git a/QDSMain.ui b/QDSMain.ui
index b703b04..e243dc6 100644
--- a/QDSMain.ui
+++ b/QDSMain.ui
@@ -26,15 +26,34 @@
0
-
+
-
-
-
-
- 3
- 0
-
+
+
+ Qt::Horizontal
+
+
+
+ 3
+ 0
+
+
+
+ CrossCursor
+
+
+
+
+
+ 3
+ 0
+
+
+
+ CrossCursor
+
+
diff --git a/StaticGroupBox.py b/StaticGroupBox.py
index a22335c..8bebfbf 100644
--- a/StaticGroupBox.py
+++ b/StaticGroupBox.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'StaticGroupBox.ui'
#
-# Created: Thu Mar 20 00:40:00 2014
+# Created: Thu Mar 20 13:41:01 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
@@ -92,7 +92,7 @@ class Ui_StaticGroupBox(object):
def retranslateUi(self, StaticGroupBox):
StaticGroupBox.setWindowTitle(_translate("StaticGroupBox", "GroupBox", None))
- StaticGroupBox.setTitle(_translate("StaticGroupBox", "Static", None))
+ StaticGroupBox.setTitle(_translate("StaticGroupBox", "e\'_infty", None))
self.label.setText(_translate("StaticGroupBox", "Fix", None))
self.removeButton.setText(_translate("StaticGroupBox", "Remove", None))
self.label_4.setText(_translate("StaticGroupBox", "TextLabel", None))
diff --git a/StaticGroupBox.ui b/StaticGroupBox.ui
index 7a55c1e..01865fe 100644
--- a/StaticGroupBox.ui
+++ b/StaticGroupBox.ui
@@ -26,7 +26,7 @@
GroupBox
- Static
+ e'_infty
-
diff --git a/data.py b/data.py
index f108276..d8131f8 100644
--- a/data.py
+++ b/data.py
@@ -16,7 +16,8 @@ class Data:
self.epsilon = die_real + 1j * die_imag
self.epsilon_fit = die_real*0 + 1j * die_imag*0
myPen_imag = pg.mkPen(width=3, color=(255,255,127))
- myPen_real = pg.mkPen(width=3, color=(255,127,127))
+ myPen_real = pg.mkPen(width=3, color=(51,255,127))
+ #33FF00
self.data_curve_imag = pg.PlotDataItem(x=[N.nan], y=[N.nan],pen=QColor(0,0,0,0), symbol='o',
symbolBrush=(255,127,0,127))
@@ -79,21 +80,26 @@ class Data:
class Conductivity(QObject):
changedData = pyqtSignal()
removeObj = pyqtSignal(QObject)
- def __init__(self, pgPlotWidget=None, limits=None):
+
+ def __init__( self, plt_imag=None, plt_real=None, limits=None ):
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.DashLine, width=1)
+ myPen = pg.mkPen( style=Qt.DashLine, width=2.5)
self.color=QColor("black")
+ self.plt_imag = plt_imag
+ 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.pgPlotWidget = pgPlotWidget
- self.pgPlotWidget.addItem(self.data_curve_imag)
+ self.plt_imag.addItem(self.data_curve_imag)
+ self.plt_real.addItem(self.data_curve_real)
self.limits = limits
self.frequency = None
@@ -117,14 +123,15 @@ class Conductivity(QObject):
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), 1024)
- sigma, sigma_N = self.getParameter()
+ self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 254)
+ p = self.getParameter()
- y = self.f.cond_cmplx([sigma, sigma_N], self.frequency)
+ y = self.f.cond_cmplx(p, self.frequency)
+ print p
+ self.conductivity = y # imaginary part
- self.conductivity = y[1] # imaginary part
-
- self.data_curve_imag.setData(x=self.frequency, y=self.conductivity, label="Cond.")
+ 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()
@@ -138,7 +145,8 @@ class Conductivity(QObject):
return self.frequency, self.epsilon_static
def removeMe(self):
- self.pg_plot_widget.removeItem(self.data_curve_imag)
+ self.plt_imag.removeItem(self.data_curve_imag)
+ self.plt_real.removeItem(self.data_curve_real)
self.removeObj.emit(self)
self.changedData.emit()
@@ -147,18 +155,21 @@ class PowerComplex(QObject):
changedData = pyqtSignal()
removeObj = pyqtSignal(QObject)
- def __init__(self, pgPlotWidget=None, limits=None):
+ def __init__( self, plt_real=None, plt_imag=None, limits=None ):
QObject.__init__(self)
super(PowerComplex, self)
self.widget = CustomWidgets.PowerLawWidget()
self.widget.changedTable.connect(self.updateData)
self.widget.removeMe.connect(self.removeMe)
- myPen = pg.mkPen( style=Qt.DashLine, width=1.5)
+ 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.pg_plot_widget = pgPlotWidget
- self.pg_plot_widget.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_real = plt_real
+ self.plt_imag.addItem(self.data_curve_imag)
+ self.plt_real.addItem(self.data_curve_real)
self.limits = limits
@@ -169,7 +180,8 @@ class PowerComplex(QObject):
self.id_string = 'power'
def removeMe(self):
- self.pg_plot_widget.removeItem(self.data_curve_real)
+ self.plt_real.removeItem(self.data_curve_real)
+ self.plt_imag.removeItem(self.data_curve_imag)
self.removeObj.emit(self)
self.changedData.emit()
@@ -192,8 +204,9 @@ class PowerComplex(QObject):
p = self.getParameter()
self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 1024)
- self.powerlaw = self.f.power_cmplx(p, self.frequency) [1] # imaginary part
- self.data_curve_real.setData(x=self.frequency, y=self.powerlaw, label="Power Law")
+ self.powerlaw = self.f.power_cmplx(p, self.frequency) # imaginary part
+ self.data_curve_real.setData(x=self.frequency, y=self.powerlaw[0], label="Power Law")
+ self.data_curve_imag.setData(x=self.frequency, y=self.powerlaw[1], label="Power Law")
self.changedData.emit()
@@ -209,18 +222,19 @@ class Static(QObject):
changedData = pyqtSignal()
removeObj = pyqtSignal(QObject)
- def __init__(self, pgPlotWidget=None, limits=None):
+ 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
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)
+ 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.pg_plot_widget = pgPlotWidget
- self.pg_plot_widget.addItem(self.data_curve_real)
+ self.plt_real.addItem(self.data_curve_real)
self.limits = limits
@@ -231,7 +245,7 @@ class Static(QObject):
self.id_string = 'static'
def removeMe(self):
- self.pg_plot_widget.removeItem(self.data_curve_real)
+ self.plt_real.removeItem(self.data_curve_real)
self.removeObj.emit(self)
self.changedData.emit()
@@ -275,23 +289,28 @@ class Peak(QObject):
changedData = pyqtSignal()
removeObj = pyqtSignal(QObject)
- def __init__(self, id=None, mpl=None, limits=None):
+ def __init__( self, id_num=None, plt_real=None, plt_imag=None, limits=None ):
QObject.__init__(self)
super(Peak, self).__init__()
self.widget = CustomWidgets.PeakWidget()
- self.widget.setId(id)
- self.color = id_to_color(id)
+ 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.removeMe.connect(self.removeMe)
- self.pg_plot_widget = mpl
+ self.plt_real = plt_real
+ self.plt_imag = plt_imag
self.limits = limits
- myPen = pg.mkPen( style=Qt.DashLine, width=2, color=self.color)
+ 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.pg_plot_widget.addItem(self.data_curve_imag)
+ 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):
@@ -308,19 +327,11 @@ class Peak(QObject):
self.updatePeak()
def updatePeak(self):
- # get current axis limits
-# x_min, x_max = self.mpl.canvas.axes.get_xlim()
-# y_min, y_max = self.mpl.canvas.axes.get_ylim()
x_min,x_max, y_min, y_max = self.limits
- nu = N.logspace(N.log10(x_min), N.log10(x_max), 1024)
- y = hn(self.getParameter(), nu)
- # clip data to axes limits
- #mask = (y < y_max) & (y > y_min)
- #y = y[mask]
- #nu = nu[mask]
- self.frequency = nu[:]
- self.epsilon = y[:]
- self.data_curve_imag.setData(x=nu, y=y)
+ self.frequency = N.logspace(N.log10(x_min), N.log10(x_max), 1024)
+ self.epsilon = self.f.hn_cmplx(self.getParameter(), 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()
def get_color(self):
@@ -330,6 +341,7 @@ class Peak(QObject):
return self.frequency,self.epsilon
def removeMe(self):
- self.pg_plot_widget.removeItem(self.data_curve_imag)
+ self.plt_imag.removeItem(self.data_curve_imag)
+ self.plt_real.removeItem(self.data_curve_real)
self.removeObj.emit(self)
self.changedData.emit()
\ No newline at end of file
diff --git a/images_rc.py b/images_rc.py
index 3962f1c..0dfd9f8 100644
--- a/images_rc.py
+++ b/images_rc.py
@@ -2,7 +2,7 @@
# Resource object code
#
-# Created: Do. Mär. 20 00:39:59 2014
+# Created: Do. Mär. 20 13:41:01 2014
# by: The Resource Compiler for PyQt (Qt v4.8.5)
#
# WARNING! All changes made in this file will be lost!
diff --git a/mathlib.py b/mathlib.py
index b3e9770..b2bb0b2 100644
--- a/mathlib.py
+++ b/mathlib.py
@@ -137,7 +137,7 @@ class Functions:
self.list = {
# provides functions: "id_string":(function, number_of_parameters)
"hn":(self.hn_cmplx,4),
- "conductivity":(self.cond_cmplx,1),
+ "conductivity":(self.cond_cmplx,2),
"power":(self.power_cmplx,2),
"static":(self.static_cmplx,1),
}
@@ -152,8 +152,8 @@ class Functions:
def cond_cmplx(self, p, x):
om = 2*N.pi*x
- sgma = p[0]
- cond = sgma/(1j*om)
+ sgma, n = p
+ cond = sgma/(1j*om)**n
cplx = N.array([cond.real, -cond.imag])
return cplx