* moved math functions (fit, hn, etc.) to mathlib.py
* fitresults are stored in a better format * started gracedriver to sva data in grace file
This commit is contained in:
parent
784393a21a
commit
9ce80f13b5
@ -4,14 +4,12 @@ __author__ = 'markusro'
|
|||||||
from PyQt4.QtGui import QColor
|
from PyQt4.QtGui import QColor
|
||||||
from PyQt4.QtCore import QObject, pyqtSignal, QThread, pyqtSlot
|
from PyQt4.QtCore import QObject, pyqtSignal, QThread, pyqtSlot
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy import optimize as opt, odr
|
from scipy import optimize as opt, odr
|
||||||
|
|
||||||
import libyaff
|
import libyaff
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def id_to_color( id ):
|
def id_to_color( id ):
|
||||||
colors = [
|
colors = [
|
||||||
QColor(54, 22, 115),
|
QColor(54, 22, 115),
|
||||||
@ -26,7 +24,6 @@ def id_to_color(id):
|
|||||||
return colors[id%len(colors)]
|
return colors[id%len(colors)]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FitFunctionCreator(QObject):
|
class FitFunctionCreator(QObject):
|
||||||
new_data = pyqtSignal(np.ndarray, np.ndarray)
|
new_data = pyqtSignal(np.ndarray, np.ndarray)
|
||||||
|
|
||||||
@ -83,6 +80,7 @@ class FitRoutine(QObject):
|
|||||||
self._fitter = self.fit_odr_cmplx
|
self._fitter = self.fit_odr_cmplx
|
||||||
self._odr_fit = None
|
self._odr_fit = None
|
||||||
self._start_parameter = None
|
self._start_parameter = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def start_parameter( self ):
|
def start_parameter( self ):
|
||||||
return self._start_parameter
|
return self._start_parameter
|
||||||
@ -90,6 +88,7 @@ class FitRoutine(QObject):
|
|||||||
@start_parameter.setter
|
@start_parameter.setter
|
||||||
def start_paramter( self, p0 ):
|
def start_paramter( self, p0 ):
|
||||||
self._start_parameter = p0
|
self._start_parameter = p0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def fitter( self ):
|
def fitter( self ):
|
||||||
return self._fitter
|
return self._fitter
|
||||||
@ -123,7 +122,6 @@ class FitRoutine(QObject):
|
|||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def fit( self ):
|
def fit( self ):
|
||||||
#print "TID in FitRoutine", QThread.thread()
|
|
||||||
try:
|
try:
|
||||||
self._odr_fit.run()
|
self._odr_fit.run()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
@ -162,7 +160,6 @@ class FunctionRegister:
|
|||||||
return self.registry
|
return self.registry
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ############# deprecated #####################
|
# ############# deprecated #####################
|
||||||
def fit_odr_cmplx( x, y, p0, fixed, fcns ):
|
def fit_odr_cmplx( x, y, p0, fixed, fcns ):
|
||||||
f = FitFunctionCreator()
|
f = FitFunctionCreator()
|
||||||
@ -182,6 +179,7 @@ def fit_odr_cmplx(x, y, p0, fixed, fcns):
|
|||||||
#print fit.output.pprint()
|
#print fit.output.pprint()
|
||||||
return fit.output
|
return fit.output
|
||||||
|
|
||||||
|
|
||||||
### define funcs here
|
### define funcs here
|
||||||
class Functions(QObject):
|
class Functions(QObject):
|
||||||
def __init__( self ):
|
def __init__( self ):
|
||||||
@ -311,7 +309,6 @@ def hn(p, nu):
|
|||||||
return e_loss # 2* oder nicht?
|
return e_loss # 2* oder nicht?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def mini_func( p, x, y ):
|
def mini_func( p, x, y ):
|
||||||
res = y-multi_hn(p, x)
|
res = y-multi_hn(p, x)
|
||||||
# apply weights
|
# apply weights
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'ConductivityGroupBox.ui'
|
# Form implementation generated from reading ui file 'ConductivityGroupBox.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Jun 2 19:55:32 2014
|
# Created: Tue Jul 29 08:56:48 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.11.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,12 +17,14 @@ except AttributeError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
|
|
||||||
class Ui_ConductivityGroupBox(object):
|
class Ui_ConductivityGroupBox(object):
|
||||||
def setupUi( self, ConductivityGroupBox ):
|
def setupUi( self, ConductivityGroupBox ):
|
||||||
ConductivityGroupBox.setObjectName(_fromUtf8("ConductivityGroupBox"))
|
ConductivityGroupBox.setObjectName(_fromUtf8("ConductivityGroupBox"))
|
||||||
@ -139,14 +141,21 @@ class Ui_ConductivityGroupBox(object):
|
|||||||
ConductivityGroupBox.setWindowTitle(_translate("ConductivityGroupBox", "GroupBox", None))
|
ConductivityGroupBox.setWindowTitle(_translate("ConductivityGroupBox", "GroupBox", None))
|
||||||
ConductivityGroupBox.setTitle(_translate("ConductivityGroupBox", "Conductivity", None))
|
ConductivityGroupBox.setTitle(_translate("ConductivityGroupBox", "Conductivity", None))
|
||||||
self.pwrSigma_sd.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
self.pwrSigma_sd.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_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.label.setText(_translate("ConductivityGroupBox", "Fix", None))
|
||||||
self.removeButton.setText(_translate("ConductivityGroupBox", "Remove", None))
|
self.removeButton.setText(_translate("ConductivityGroupBox", "Remove", None))
|
||||||
self.label_4.setText(_translate("ConductivityGroupBox", "α", None))
|
self.label_4.setText(_translate("ConductivityGroupBox", "α", None))
|
||||||
self.rSigma_sd.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
self.rSigma_sd.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
||||||
self.rSigma.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.rSigma.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.subtractConductivityButton.setText(_translate("ConductivityGroupBox", "Hide", None))
|
||||||
self.label_3.setText(_translate("ConductivityGroupBox", "<html><head/><body><p>σ"</p></body></html>", None))
|
self.label_3.setText(
|
||||||
self.iSigma.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))
|
_translate("ConductivityGroupBox", "<html><head/><body><p>σ"</p></body></html>", None))
|
||||||
|
self.iSigma.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.iSigma_sd.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
self.iSigma_sd.setText(_translate("ConductivityGroupBox", "TextLabel", None))
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import numpy as np
|
|||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
import ContainerWidgets
|
import ContainerWidgets
|
||||||
import libyaff
|
import libyaff
|
||||||
from Mathlib import Functions, id_to_color
|
from BDSMathlib import Functions, id_to_color
|
||||||
|
|
||||||
__author__ = 'markusro'
|
__author__ = 'markusro'
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'PeakGroupBox.ui'
|
# Form implementation generated from reading ui file 'PeakGroupBox.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Jun 2 19:55:32 2014
|
# Created: Tue Jul 29 08:56:47 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.11.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,12 +17,14 @@ except AttributeError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
|
|
||||||
class Ui_PeakGroupBox(object):
|
class Ui_PeakGroupBox(object):
|
||||||
def setupUi( self, PeakGroupBox ):
|
def setupUi( self, PeakGroupBox ):
|
||||||
PeakGroupBox.setObjectName(_fromUtf8("PeakGroupBox"))
|
PeakGroupBox.setObjectName(_fromUtf8("PeakGroupBox"))
|
||||||
@ -169,9 +171,13 @@ class Ui_PeakGroupBox(object):
|
|||||||
self.label_6.setText(_translate("PeakGroupBox", "TextLabel", None))
|
self.label_6.setText(_translate("PeakGroupBox", "TextLabel", None))
|
||||||
self.removeButton.setText(_translate("PeakGroupBox", "Remove", None))
|
self.removeButton.setText(_translate("PeakGroupBox", "Remove", None))
|
||||||
self.label_1.setText(_translate("PeakGroupBox", "Δε", None))
|
self.label_1.setText(_translate("PeakGroupBox", "Δε", None))
|
||||||
self.label_3.setText(_translate("PeakGroupBox", "<html><head/><body><p>γ<span style=\" vertical-align:sub;\">CC</span></p></body></html>", None))
|
self.label_3.setText(_translate("PeakGroupBox",
|
||||||
|
"<html><head/><body><p>γ<span style=\" vertical-align:sub;\">CC</span></p></body></html>",
|
||||||
|
None))
|
||||||
self.label_8.setText(_translate("PeakGroupBox", "TextLabel", None))
|
self.label_8.setText(_translate("PeakGroupBox", "TextLabel", None))
|
||||||
self.label_4.setText(_translate("PeakGroupBox", "<html><head/><body><p>β<span style=\" vertical-align:sub;\">CD</span></p></body></html>", None))
|
self.label_4.setText(_translate("PeakGroupBox",
|
||||||
|
"<html><head/><body><p>β<span style=\" vertical-align:sub;\">CD</span></p></body></html>",
|
||||||
|
None))
|
||||||
self.label_2.setText(_translate("PeakGroupBox", "τ", None))
|
self.label_2.setText(_translate("PeakGroupBox", "τ", None))
|
||||||
self.comboBox.setItemText(0, _translate("PeakGroupBox", "H-N", None))
|
self.comboBox.setItemText(0, _translate("PeakGroupBox", "H-N", None))
|
||||||
self.comboBox.setItemText(1, _translate("PeakGroupBox", "C-C", None))
|
self.comboBox.setItemText(1, _translate("PeakGroupBox", "C-C", None))
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'PowerLawGroupBox.ui'
|
# Form implementation generated from reading ui file 'PowerLawGroupBox.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Jun 2 19:55:33 2014
|
# Created: Tue Jul 29 08:56:48 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.11.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,12 +17,14 @@ except AttributeError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
|
|
||||||
class Ui_PowerLawGroupBox(object):
|
class Ui_PowerLawGroupBox(object):
|
||||||
def setupUi( self, PowerLawGroupBox ):
|
def setupUi( self, PowerLawGroupBox ):
|
||||||
PowerLawGroupBox.setObjectName(_fromUtf8("PowerLawGroupBox"))
|
PowerLawGroupBox.setObjectName(_fromUtf8("PowerLawGroupBox"))
|
||||||
|
55
QDS.py
55
QDS.py
@ -19,20 +19,18 @@ import pyqtgraph as pg
|
|||||||
|
|
||||||
from Container import Conductivity, PowerComplex, Static, Peak, YAFF
|
from Container import Conductivity, PowerComplex, Static, Peak, YAFF
|
||||||
from ContainerWidgets import ParameterWidget
|
from ContainerWidgets import ParameterWidget
|
||||||
from Mathlib import FunctionRegister, FitRoutine
|
from BDSMathlib import FunctionRegister, FitRoutine
|
||||||
from Data import Data
|
from Data import Data
|
||||||
|
|
||||||
import QDSMain
|
import QDSMain
|
||||||
import ExtraDifferentialWidget
|
import ExtraDifferentialWidget
|
||||||
|
|
||||||
class AppWindow(QMainWindow):
|
class AppWindow(QMainWindow):
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, files=[], parent=None):
|
def __init__(self, files=[], parent=None):
|
||||||
super(AppWindow, self).__init__(parent)
|
super(AppWindow, self).__init__(parent)
|
||||||
self.ui = QDSMain.Ui_MainWindow()
|
self.ui = QDSMain.Ui_MainWindow()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
self._file_paths = QStringList(files)
|
self._file_paths = self._sortInputFiles(files)
|
||||||
self._last_written_header = None
|
self._last_written_header = None
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
@ -69,8 +67,8 @@ class AppWindow(QMainWindow):
|
|||||||
self.ui.pgPlotWidget_imag.addItem(self.fit_boundary_imag)
|
self.ui.pgPlotWidget_imag.addItem(self.fit_boundary_imag)
|
||||||
self.ui.pgPlotWidget_real.addItem(self.fit_boundary_real)
|
self.ui.pgPlotWidget_real.addItem(self.fit_boundary_real)
|
||||||
|
|
||||||
self.fit_boundary_imag.sigRegionChanged.connect(self._update_fit_boundary_real)
|
self.fit_boundary_imag.sigRegionChanged.connect(self._update_fit_boundary)
|
||||||
self.fit_boundary_real.sigRegionChanged.connect(self._update_fit_boundary_imag)
|
self.fit_boundary_real.sigRegionChanged.connect(self._update_fit_boundary)
|
||||||
|
|
||||||
for pltwidgt in (self.ui.pgPlotWidget_real, self.ui.pgPlotWidget_imag):
|
for pltwidgt in (self.ui.pgPlotWidget_real, self.ui.pgPlotWidget_imag):
|
||||||
pltwidgt.setLogMode(x=True, y=True)
|
pltwidgt.setLogMode(x=True, y=True)
|
||||||
@ -89,10 +87,6 @@ class AppWindow(QMainWindow):
|
|||||||
sc_imag.sigMouseClicked.connect(self.mousePress)
|
sc_imag.sigMouseClicked.connect(self.mousePress)
|
||||||
sc_imag.sigMouseMoved.connect(self.updateCrosshair)
|
sc_imag.sigMouseMoved.connect(self.updateCrosshair)
|
||||||
|
|
||||||
# process cmd line args
|
|
||||||
if files != []:
|
|
||||||
self.openFile(files[0])
|
|
||||||
self._current_file_index = 0
|
|
||||||
|
|
||||||
self._fit_thread = QThread()
|
self._fit_thread = QThread()
|
||||||
self._fit_method = FitRoutine()
|
self._fit_method = FitRoutine()
|
||||||
@ -101,6 +95,12 @@ class AppWindow(QMainWindow):
|
|||||||
self._fit_method.data_ready.connect(self.updateIntermediatePlot)
|
self._fit_method.data_ready.connect(self.updateIntermediatePlot)
|
||||||
self._fit_thread.started.connect(self._fit_method.fit)
|
self._fit_thread.started.connect(self._fit_method.fit)
|
||||||
|
|
||||||
|
|
||||||
|
# finally process cmd line args
|
||||||
|
if files != []:
|
||||||
|
self.openFile(unicode(self._file_paths[0]))
|
||||||
|
self._current_file_index = 0
|
||||||
|
|
||||||
def _init_menu(self):
|
def _init_menu(self):
|
||||||
fileMenu = self.menuBar().addMenu("File")
|
fileMenu = self.menuBar().addMenu("File")
|
||||||
|
|
||||||
@ -242,12 +242,15 @@ class AppWindow(QMainWindow):
|
|||||||
|
|
||||||
# prepare header
|
# prepare header
|
||||||
header="# T "
|
header="# T "
|
||||||
|
header = "{n1:13}{n2:13}".format(n1="# 0T", n2="1invT")
|
||||||
pars = []
|
pars = []
|
||||||
bname = os.path.splitext(self.filepath)[0]
|
bname = os.path.splitext(self.filepath)[0]
|
||||||
|
# print "Registered Functions (saveFitResult): ",self.function_registry.get_registered_functions()
|
||||||
|
varnum = 2 # T, invT are the first two columns
|
||||||
for i_fcn, fcn in enumerate(self.function_registry.get_registered_functions()):
|
for i_fcn, fcn in enumerate(self.function_registry.get_registered_functions()):
|
||||||
for name in fcn.widget.names: # get variable names
|
for i, name in enumerate(fcn.widget.names): # get variable names
|
||||||
header += "{n:11}{n_sd:11}".format(n=name, n_sd=name+"_sd")
|
header += "{n:13}{n_sd:13}".format(n="%i%s"%(varnum, name), n_sd="%i%s_sd"%(varnum+1, name))
|
||||||
|
varnum += 2
|
||||||
# write for each function extra file
|
# write for each function extra file
|
||||||
name_fcn = "%s_%i.fit"%(bname, i_fcn)
|
name_fcn = "%s_%i.fit"%(bname, i_fcn)
|
||||||
f_fcn = open(name_fcn, 'w')
|
f_fcn = open(name_fcn, 'w')
|
||||||
@ -264,7 +267,8 @@ class AppWindow(QMainWindow):
|
|||||||
pars.extend([par])
|
pars.extend([par])
|
||||||
pars.extend([fcn._sd_beta[i]])
|
pars.extend([fcn._sd_beta[i]])
|
||||||
|
|
||||||
header += "%-11s%-11s\n"%("fit_xlow","fit_xhigh")
|
# append fit limits header
|
||||||
|
header += "%-13s%-13s\n"%("fit_xlow", "fit_xhigh")
|
||||||
|
|
||||||
# write new header if fit model changed
|
# write new header if fit model changed
|
||||||
if self._last_written_header != header:
|
if self._last_written_header != header:
|
||||||
@ -275,10 +279,11 @@ class AppWindow(QMainWindow):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
pars.insert(0, self.data.meta["T"])
|
pars.insert(0, self.data.meta["T"])
|
||||||
|
pars.insert(1, 1e3/self.data.meta["T"])
|
||||||
pars.append(self.data.fit_limits[0])
|
pars.append(self.data.fit_limits[0])
|
||||||
pars.append(self.data.fit_limits[1])
|
pars.append(self.data.fit_limits[1])
|
||||||
pars = np.array([pars])
|
pars = np.array([pars])
|
||||||
np.savetxt(f, pars, fmt = '%-10.3e', delimiter=" ")
|
np.savetxt(f, pars, fmt='%-12.3e', delimiter=" ")
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def _saveFitFigure(self):
|
def _saveFitFigure(self):
|
||||||
@ -308,7 +313,7 @@ class AppWindow(QMainWindow):
|
|||||||
#pyplot.savefig(os.path.splitext(self.filepath)[0]+".png")
|
#pyplot.savefig(os.path.splitext(self.filepath)[0]+".png")
|
||||||
pyplot.savefig(os.path.splitext(self.filepath)[0]+".pdf")
|
pyplot.savefig(os.path.splitext(self.filepath)[0]+".pdf")
|
||||||
fig.clear()
|
fig.clear()
|
||||||
fig.close()
|
del (fig)
|
||||||
|
|
||||||
def _saveFitFigureGrace(self):
|
def _saveFitFigureGrace(self):
|
||||||
#agrtemplate = open('template.agr').read()
|
#agrtemplate = open('template.agr').read()
|
||||||
@ -316,6 +321,8 @@ class AppWindow(QMainWindow):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
#TODO: need interface/method for adding function blocks, this is too repetitive
|
||||||
def addYaff(self, pos):
|
def addYaff(self, pos):
|
||||||
_yaff = YAFF(plt_real=self.ui.pgPlotWidget_real,
|
_yaff = YAFF(plt_real=self.ui.pgPlotWidget_real,
|
||||||
plt_imag=self.ui.pgPlotWidget_imag,
|
plt_imag=self.ui.pgPlotWidget_imag,
|
||||||
@ -343,7 +350,7 @@ class AppWindow(QMainWindow):
|
|||||||
cond_par = [0.0, 10**(pos.y() + pos.x())*2*np.pi , 1.0]
|
cond_par = [0.0, 10**(pos.y() + pos.x())*2*np.pi , 1.0]
|
||||||
_conductivity.setParameter(beta=cond_par)
|
_conductivity.setParameter(beta=cond_par)
|
||||||
self.parameterWidget.add(_conductivity.widget)
|
self.parameterWidget.add(_conductivity.widget)
|
||||||
self.function_registry.register_function(_conductivity) ##todo
|
self.function_registry.register_function(_conductivity)
|
||||||
self.updatePlot()
|
self.updatePlot()
|
||||||
_conductivity.blockSignals(False)
|
_conductivity.blockSignals(False)
|
||||||
|
|
||||||
@ -479,6 +486,10 @@ class AppWindow(QMainWindow):
|
|||||||
self.openFile(path)
|
self.openFile(path)
|
||||||
self.fit_boundary_imag.setRegion(lim)
|
self.fit_boundary_imag.setRegion(lim)
|
||||||
|
|
||||||
|
def _sortInputFiles( self, files ):
|
||||||
|
return QStringList(sorted(files, key=lambda x: re.findall("\d+\.\d+K", x)))
|
||||||
|
|
||||||
|
|
||||||
def openFile(self,path):
|
def openFile(self,path):
|
||||||
print "opening: %s"%path
|
print "opening: %s"%path
|
||||||
self.filepath=path
|
self.filepath=path
|
||||||
@ -534,7 +545,6 @@ class AppWindow(QMainWindow):
|
|||||||
|
|
||||||
p0,funcs = [],[]
|
p0,funcs = [],[]
|
||||||
for fcn in self.function_registry.get_registered_functions():
|
for fcn in self.function_registry.get_registered_functions():
|
||||||
print fcn
|
|
||||||
p0.extend(fcn.getParameter())
|
p0.extend(fcn.getParameter())
|
||||||
funcs.append(fcn)
|
funcs.append(fcn)
|
||||||
# calculate parametrized curve
|
# calculate parametrized curve
|
||||||
@ -543,9 +553,9 @@ class AppWindow(QMainWindow):
|
|||||||
# replot data and fit, TODO: replot only if measurement data changed
|
# replot data and fit, TODO: replot only if measurement data changed
|
||||||
self.data.data_curve_real.setData(self.data.frequency, self.data.epsilon.real)
|
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)
|
self.data.data_curve_imag.setData(self.data.frequency, self.data.epsilon.imag)
|
||||||
print "updatePlot: ",self.data.frequency_fit, self.data.epsilon_fit
|
#print "updatePlot: ",self.data.frequency_fit, self.data.epsilon_fit
|
||||||
if len(funcs) > 0:
|
if len(funcs) > 0:
|
||||||
print "funcs > 0:",self.data.frequency_fit, self.data.epsilon_fit
|
#print "funcs > 0:",self.data.frequency_fit, self.data.epsilon_fit
|
||||||
self.data.fitted_curve_real.setData(x=self.data.frequency_fit, y=self.data.epsilon_fit.real)
|
self.data.fitted_curve_real.setData(x=self.data.frequency_fit, y=self.data.epsilon_fit.real)
|
||||||
self.data.fitted_curve_imag.setData(x=self.data.frequency_fit, y=self.data.epsilon_fit.imag)
|
self.data.fitted_curve_imag.setData(x=self.data.frequency_fit, y=self.data.epsilon_fit.imag)
|
||||||
else:
|
else:
|
||||||
@ -557,12 +567,11 @@ class AppWindow(QMainWindow):
|
|||||||
self.data.fitted_curve_real.setData(freq, intermediate_data[0])
|
self.data.fitted_curve_real.setData(freq, intermediate_data[0])
|
||||||
self.data.fitted_curve_imag.setData(freq, intermediate_data[1])
|
self.data.fitted_curve_imag.setData(freq, intermediate_data[1])
|
||||||
|
|
||||||
def _update_fit_boundary_real(self):
|
def _update_fit_boundary( self ):
|
||||||
self.fit_boundary_real.setRegion(self.fit_boundary_imag.getRegion())
|
self.fit_boundary_real.setRegion(self.fit_boundary_imag.getRegion())
|
||||||
|
|
||||||
def _update_fit_boundary_imag(self):
|
|
||||||
self.fit_boundary_imag.setRegion(self.fit_boundary_real.getRegion())
|
self.fit_boundary_imag.setRegion(self.fit_boundary_real.getRegion())
|
||||||
|
|
||||||
|
|
||||||
def sigint_handler(*args):
|
def sigint_handler(*args):
|
||||||
"""
|
"""
|
||||||
Handler for the SIGINT signal (CTRL + C).
|
Handler for the SIGINT signal (CTRL + C).
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'QDSMain.ui'
|
# Form implementation generated from reading ui file 'QDSMain.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Jun 2 19:55:32 2014
|
# Created: Tue Jul 29 08:56:47 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.11.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,12 +17,14 @@ except AttributeError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi( self, MainWindow ):
|
def setupUi( self, MainWindow ):
|
||||||
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
||||||
@ -157,5 +159,6 @@ class Ui_MainWindow(object):
|
|||||||
self.actionActionAbortFit.setShortcut(_translate("MainWindow", "Ctrl+C", None))
|
self.actionActionAbortFit.setShortcut(_translate("MainWindow", "Ctrl+C", None))
|
||||||
self.actionShow_Derivative.setText(_translate("MainWindow", "Show Derivative", None))
|
self.actionShow_Derivative.setText(_translate("MainWindow", "Show Derivative", None))
|
||||||
|
|
||||||
|
|
||||||
from pyqtgraph import PlotWidget
|
from pyqtgraph import PlotWidget
|
||||||
import images_rc
|
import images_rc
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'StaticGroupBox.ui'
|
# Form implementation generated from reading ui file 'StaticGroupBox.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Jun 2 19:55:33 2014
|
# Created: Tue Jul 29 08:56:48 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.11.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,12 +17,14 @@ except AttributeError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
|
|
||||||
class Ui_StaticGroupBox(object):
|
class Ui_StaticGroupBox(object):
|
||||||
def setupUi( self, StaticGroupBox ):
|
def setupUi( self, StaticGroupBox ):
|
||||||
StaticGroupBox.setObjectName(_fromUtf8("StaticGroupBox"))
|
StaticGroupBox.setObjectName(_fromUtf8("StaticGroupBox"))
|
||||||
@ -96,5 +98,7 @@ class Ui_StaticGroupBox(object):
|
|||||||
self.label.setText(_translate("StaticGroupBox", "Fix", None))
|
self.label.setText(_translate("StaticGroupBox", "Fix", None))
|
||||||
self.removeButton.setText(_translate("StaticGroupBox", "Remove", None))
|
self.removeButton.setText(_translate("StaticGroupBox", "Remove", None))
|
||||||
self.label_4.setText(_translate("StaticGroupBox", "TextLabel", None))
|
self.label_4.setText(_translate("StaticGroupBox", "TextLabel", None))
|
||||||
self.label_1.setText(_translate("StaticGroupBox", "<html><head/><body><p>ε<span style=\" vertical-align:sub;\">infty</span></p></body></html>", None))
|
self.label_1.setText(_translate("StaticGroupBox",
|
||||||
|
"<html><head/><body><p>ε<span style=\" vertical-align:sub;\">infty</span></p></body></html>",
|
||||||
|
None))
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'YAFFConfig.ui'
|
# Form implementation generated from reading ui file 'YAFFConfig.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Jun 2 19:55:33 2014
|
# Created: Tue Jul 29 08:56:48 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.11.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,12 +17,14 @@ except AttributeError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
|
|
||||||
class Ui_Dialog(object):
|
class Ui_Dialog(object):
|
||||||
def setupUi( self, Dialog ):
|
def setupUi( self, Dialog ):
|
||||||
Dialog.setObjectName(_fromUtf8("Dialog"))
|
Dialog.setObjectName(_fromUtf8("Dialog"))
|
||||||
@ -97,11 +99,19 @@ class Ui_Dialog(object):
|
|||||||
def retranslateUi( self, Dialog ):
|
def retranslateUi( self, Dialog ):
|
||||||
Dialog.setWindowTitle(_translate("Dialog", "YAFF Configuration", None))
|
Dialog.setWindowTitle(_translate("Dialog", "YAFF Configuration", None))
|
||||||
self.groupBox_time.setTitle(_translate("Dialog", "Time values (log10[t])", None))
|
self.groupBox_time.setTitle(_translate("Dialog", "Time values (log10[t])", None))
|
||||||
self.label.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">min</span></p></body></html>", None))
|
self.label.setText(_translate("Dialog",
|
||||||
self.label_2.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">max</span></p></body></html>", None))
|
"<html><head/><body><p>t<span style=\" vertical-align:sub;\">min</span></p></body></html>",
|
||||||
|
None))
|
||||||
|
self.label_2.setText(_translate("Dialog",
|
||||||
|
"<html><head/><body><p>t<span style=\" vertical-align:sub;\">max</span></p></body></html>",
|
||||||
|
None))
|
||||||
self.label_3.setText(_translate("Dialog", "N", None))
|
self.label_3.setText(_translate("Dialog", "N", None))
|
||||||
self.groupBox_tau.setTitle(_translate("Dialog", "τ-Distribution (log10[τ])", None))
|
self.groupBox_tau.setTitle(_translate("Dialog", "τ-Distribution (log10[τ])", None))
|
||||||
self.label_7.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">min</span></p></body></html>", None))
|
self.label_7.setText(_translate("Dialog",
|
||||||
self.label_8.setText(_translate("Dialog", "<html><head/><body><p>t<span style=\" vertical-align:sub;\">max</span></p></body></html>", None))
|
"<html><head/><body><p>t<span style=\" vertical-align:sub;\">min</span></p></body></html>",
|
||||||
|
None))
|
||||||
|
self.label_8.setText(_translate("Dialog",
|
||||||
|
"<html><head/><body><p>t<span style=\" vertical-align:sub;\">max</span></p></body></html>",
|
||||||
|
None))
|
||||||
self.label_9.setText(_translate("Dialog", "N", None))
|
self.label_9.setText(_translate("Dialog", "N", None))
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'YAFFparameters.ui'
|
# Form implementation generated from reading ui file 'YAFFparameters.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Jun 2 19:55:33 2014
|
# Created: Tue Jul 29 08:56:48 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.11.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,12 +17,14 @@ except AttributeError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _translate( context, text, disambig ):
|
def _translate( context, text, disambig ):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
|
|
||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def setupUi( self, Form ):
|
def setupUi( self, Form ):
|
||||||
Form.setObjectName(_fromUtf8("Form"))
|
Form.setObjectName(_fromUtf8("Form"))
|
||||||
@ -281,13 +283,17 @@ class Ui_Form(object):
|
|||||||
self.label_huh.setText(_translate("Form", "TextLabel", None))
|
self.label_huh.setText(_translate("Form", "TextLabel", None))
|
||||||
self.label_2.setText(_translate("Form", "TextLabel", None))
|
self.label_2.setText(_translate("Form", "TextLabel", None))
|
||||||
self.label_102.setText(_translate("Form", "g", None))
|
self.label_102.setText(_translate("Form", "g", None))
|
||||||
self.label_222.setText(_translate("Form", "<html><head/><body><p>τ<span style=\" vertical-align:sub;\">α</span></p></body></html>", None))
|
self.label_222.setText(
|
||||||
|
_translate("Form", "<html><head/><body><p>τ<span style=\" vertical-align:sub;\">α</span></p></body></html>",
|
||||||
|
None))
|
||||||
self.label_322.setText(_translate("Form", "α", None))
|
self.label_322.setText(_translate("Form", "α", None))
|
||||||
self.label_8.setText(_translate("Form", "TextLabel", None))
|
self.label_8.setText(_translate("Form", "TextLabel", None))
|
||||||
self.label_1.setText(_translate("Form", "TextLabel", None))
|
self.label_1.setText(_translate("Form", "TextLabel", None))
|
||||||
self.label_3.setText(_translate("Form", "TextLabel", None))
|
self.label_3.setText(_translate("Form", "TextLabel", None))
|
||||||
self.label_82.setText(_translate("Form", "b", None))
|
self.label_82.setText(_translate("Form", "b", None))
|
||||||
self.label_622.setText(_translate("Form", "<html><head/><body><p>τ<span style=\" vertical-align:sub;\">β</span></p></body></html>", None))
|
self.label_622.setText(
|
||||||
|
_translate("Form", "<html><head/><body><p>τ<span style=\" vertical-align:sub;\">β</span></p></body></html>",
|
||||||
|
None))
|
||||||
self.label_7.setText(_translate("Form", "TextLabel", None))
|
self.label_7.setText(_translate("Form", "TextLabel", None))
|
||||||
self.label_72.setText(_translate("Form", "a", None))
|
self.label_72.setText(_translate("Form", "a", None))
|
||||||
self.label_23.setText(_translate("Form", "Fix", None))
|
self.label_23.setText(_translate("Form", "Fix", None))
|
||||||
|
4
data.py
4
data.py
@ -3,9 +3,7 @@ from PyQt4.QtGui import QColor
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
|
|
||||||
from Mathlib import FitFunctionCreator
|
from BDSMathlib import FitFunctionCreator
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Data:
|
class Data:
|
||||||
def __init__(self, frequency=np.zeros(1), die_real=np.zeros(1), die_imag=np.zeros(1)):
|
def __init__(self, frequency=np.zeros(1), die_real=np.zeros(1), die_imag=np.zeros(1)):
|
||||||
|
19
gracedriver.py
Normal file
19
gracedriver.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
__author__ = 'markusro'
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
def plot( x, y, **kwds ):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def xlabel( label ):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def ylabel( label ):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def legend( ):
|
||||||
|
pass
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 9.1 KiB |
1586
images_rc.py
1586
images_rc.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user