* 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:
Markus Rosenstihl 2014-09-17 09:46:14 +02:00
parent 784393a21a
commit 9ce80f13b5
14 changed files with 873 additions and 1226 deletions

View File

@ -2,8 +2,7 @@
__author__ = 'markusro' __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
@ -11,62 +10,60 @@ 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),
QColor(160,16,36), QColor(160, 16, 36),
QColor(45,142,15), QColor(45, 142, 15),
QColor(168,149,17), QColor(168, 149, 17),
QColor(36,10,85), QColor(36, 10, 85),
QColor(118,8,23), QColor(118, 8, 23),
QColor(31,105,7), QColor(31, 105, 7),
QColor(124,109,8), QColor(124, 109, 8),
] ]
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)
def __init__(self): def __init__( self ):
super(FitFunctionCreator,self).__init__() super(FitFunctionCreator, self).__init__()
self.data = None self.data = None
self.functions = Functions() self.functions = Functions()
def fitfcn(self, p0, x, *funcs): def fitfcn( self, p0, x, *funcs ):
if x.ndim == 2: if x.ndim == 2:
self.data = np.zeros( x.shape ) self.data = np.zeros(x.shape)
else: else:
self.data = np.zeros( (2,x.size) ) self.data = np.zeros((2, x.size))
ndx = 0 ndx = 0
for fn in funcs: # loop over functions and add the results for fn in funcs: # loop over functions and add the results
f, num_p = fn.function, fn.param_number f, num_p = fn.function, fn.param_number
p = p0[ndx:ndx + num_p] p = p0[ndx:ndx+num_p]
if x.ndim == 2: if x.ndim == 2:
x = x[0] x = x[0]
result = f(p, x) result = f(p, x)
#fn.widget.updateTable(p) # fn.widget.updateTable(p)
self.data += result # fit functions take only 1-dim x self.data += result # fit functions take only 1-dim x
ndx += num_p ndx += num_p
self.new_data.emit(x, self.data) self.new_data.emit(x, self.data)
return self.data return self.data
def fitfcn_imag(self, p0, x, *funcs): def fitfcn_imag( self, p0, x, *funcs ):
if x.ndim == 2: if x.ndim == 2:
self.data = np.zeros( x.shape ) self.data = np.zeros(x.shape)
else: else:
self.data = np.zeros( (2,x.size) ) self.data = np.zeros((2, x.size))
ndx = 0 ndx = 0
for fn in funcs: # loop over functions and add the results for fn in funcs: # loop over functions and add the results
f, num_p = fn.function, fn.param_number f, num_p = fn.function, fn.param_number
p = p0[ndx:ndx + num_p] p = p0[ndx:ndx+num_p]
if x.ndim == 2: if x.ndim == 2:
x = x[0] x = x[0]
result = f(p, x) result = f(p, x)
self.data += result # fit functions take only 1-dim x self.data += result # fit functions take only 1-dim x
ndx += num_p ndx += num_p
self.new_data.emit(x, self.data) self.new_data.emit(x, self.data)
return self.data[1] return self.data[1]
@ -76,34 +73,36 @@ class FitRoutine(QObject):
finished_fit = pyqtSignal() finished_fit = pyqtSignal()
data_ready = pyqtSignal(np.ndarray, np.ndarray) data_ready = pyqtSignal(np.ndarray, np.ndarray)
def __init__(self): def __init__( self ):
super(FitRoutine,self).__init__() super(FitRoutine, self).__init__()
self.f = FitFunctionCreator() self.f = FitFunctionCreator()
self.f.new_data.connect(self.data_ready.emit) self.f.new_data.connect(self.data_ready.emit)
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
@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
@fitter.setter @fitter.setter
def fitter(self, f): def fitter( self, f ):
self._fitter = f self._fitter = f
def fit_odr_cmplx(self, x, y, p0, fixed, fcns): def fit_odr_cmplx( self, x, y, p0, fixed, fcns ):
self._start_parameter = p0 self._start_parameter = p0
if np.iscomplexobj(y) and y.ndim == 1: if np.iscomplexobj(y) and y.ndim == 1:
weights = 1/np.abs(y)**2 weights = 1/np.abs(y)**2
we = np.resize(weights, (2, weights.size)) we = np.resize(weights, (2, weights.size))
#we = 1/N.array([y.real**2, y.imag**2]) # we = 1/N.array([y.real**2, y.imag**2])
y = np.array([y.real, y.imag]) y = np.array([y.real, y.imag])
else: else:
raise NotImplementedError, "need complex input for now" raise NotImplementedError, "need complex input for now"
@ -111,7 +110,7 @@ class FitRoutine(QObject):
mod = odr.Model(self.f.fitfcn, extra_args=fcns) mod = odr.Model(self.f.fitfcn, extra_args=fcns)
self._odr_fit = odr.ODR(dat, mod, p0, ifixx=(0,), ifixb=fixed, maxit=800) self._odr_fit = odr.ODR(dat, mod, p0, ifixx=(0,), ifixb=fixed, maxit=800)
def fit_odr_imag(self, x, y, p0, fixed, fcns): def fit_odr_imag( self, x, y, p0, fixed, fcns ):
self._start_parameter = p0 self._start_parameter = p0
if np.iscomplexobj(y) and y.ndim == 1: if np.iscomplexobj(y) and y.ndim == 1:
we = 1/np.imag(y)**2 we = 1/np.imag(y)**2
@ -122,49 +121,47 @@ class FitRoutine(QObject):
self._odr_fit = odr.ODR(dat, mod, p0, ifixx=(0,), ifixb=fixed, maxit=800) self._odr_fit = odr.ODR(dat, mod, p0, ifixx=(0,), ifixb=fixed, maxit=800)
@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:
print "muh" print "muh"
self.finished_fit.emit() self.finished_fit.emit()
def result(self): def result( self ):
if self._odr_fit.output is None: if self._odr_fit.output is None:
self._odr_fit.output = odr.Output([self.start_parameter, None, None ]) self._odr_fit.output = odr.Output([self.start_parameter, None, None])
self._odr_fit.output.stopreason = ["Aborted by user"] self._odr_fit.output.stopreason = ["Aborted by user"]
return self._odr_fit.output return self._odr_fit.output
class FunctionRegister: class FunctionRegister:
def __init__(self): def __init__( self ):
self.registry = {} self.registry = { }
def register_function(self, obj): def register_function( self, obj ):
#print "FR: Registering:",obj # print "FR: Registering:",obj
id_string = obj.id_label id_string = obj.id_label
if self.registry.has_key(obj): if self.registry.has_key(obj):
raise AssertionError,"The object is already registered! This should NOT happen" raise AssertionError, "The object is already registered! This should NOT happen"
self.registry[obj]=id_string self.registry[obj] = id_string
#print "FR: ",self.registry #print "FR: ",self.registry
def unregister_function(self, obj): def unregister_function( self, obj ):
#print "FR: UnRegistering:",obj # print "FR: UnRegistering:",obj
if self.registry.has_key(obj): if self.registry.has_key(obj):
self.registry.pop(obj) self.registry.pop(obj)
else: else:
obj.deleteLater() obj.deleteLater()
raise AssertionError,"The object is not in the registry! This should NOT happen" raise AssertionError, "The object is not in the registry! This should NOT happen"
#print "FR: ",self.registry #print "FR: ",self.registry
def get_registered_functions(self): def get_registered_functions( self ):
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()
#if x.ndim < 2: #if x.ndim < 2:
# x = N.resize(x, (2,x.size)) # x = N.resize(x, (2,x.size))
@ -182,69 +179,70 @@ 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 ):
super(Functions,self).__init__() super(Functions, self).__init__()
self.list = { self.list = {
# provides functions: "id_string":(function, number_of_parameters) # provides functions: "id_string":(function, number_of_parameters)
"hn":(self.hn_cmplx, 4), "hn": (self.hn_cmplx, 4),
"conductivity":(self.cond_cmplx, 3), "conductivity": (self.cond_cmplx, 3),
"power":(self.power_cmplx, 2), "power": (self.power_cmplx, 2),
"static":(self.static_cmplx, 1), "static": (self.static_cmplx, 1),
"yaff":(self.yaff, 8) "yaff": (self.yaff, 8)
} }
self.YAFF = libyaff.Yaff() self.YAFF = libyaff.Yaff()
def hn_cmplx(self, p, x): def hn_cmplx( self, p, x ):
om = 2*np.pi*x om = 2*np.pi*x
#hn = om*1j #hn = om*1j
eps,t,a,b = p eps, t, a, b = p
hn = eps/(1+(1j*om*t)**a)**b hn = eps/(1+(1j*om*t)**a)**b
cplx = np.array([hn.real, -hn.imag]) cplx = np.array([hn.real, -hn.imag])
return cplx return cplx
def cond_cmplx(self, p, x): def cond_cmplx( self, p, x ):
om = 2*np.pi*x om = 2*np.pi*x
sgma, isgma, n = p sgma, isgma, n = p
cond = sgma/(om**n) + isgma/(1j*om**n) # Jonscher (Universal Dielectric Response: e",e' prop sigma/omega**n cond = sgma/(om**n)+isgma/(1j*om**n) # Jonscher (Universal Dielectric Response: e",e' prop sigma/omega**n
cplx = np.array([cond.real, -cond.imag]) cplx = np.array([cond.real, -cond.imag])
return cplx return cplx
def power_cmplx(self, p, x): def power_cmplx( self, p, x ):
om = 2*np.pi*x om = 2*np.pi*x
sgma,n = p sgma, n = p
power = sgma/(om*1j)**n power = sgma/(om*1j)**n
cplx = np.array([power.real, -power.imag]) cplx = np.array([power.real, -power.imag])
return cplx return cplx
def static_cmplx(self, p, x): def static_cmplx( self, p, x ):
eps_inf = p[0] eps_inf = p[0]
static = np.ones( (2,x.size) )*eps_inf static = np.ones((2, x.size))*eps_inf
static[1,:] *= 0 # set imag part zero static[1, :] *= 0 # set imag part zero
#cplx = N.array([static.real, static.imag]) #cplx = N.array([static.real, static.imag])
return static return static
def yaff(self,p,x): def yaff( self, p, x ):
ya = self.YAFF.yaff(p[:8],x) ya = self.YAFF.yaff(p[:8], x)
cplx = np.array([ya.imag, ya.real]) cplx = np.array([ya.imag, ya.real])
return cplx return cplx
def get(self,name): def get( self, name ):
return self.list[name] return self.list[name]
def get_function(self,name): def get_function( self, name ):
return self.list[name][0] return self.list[name][0]
def fit_anneal(x, y, p0, fixed, funcs): def fit_anneal( x, y, p0, fixed, funcs ):
raise NotImplementedError raise NotImplementedError
bounds = [(0, 1e14), (0, 1)] bounds = [(0, 1e14), (0, 1)]
for i in xrange(len(p0[2:]) / 4): for i in xrange(len(p0[2:])/4):
bounds.append((1e-4, 1e12)) # delta_eps bounds.append((1e-4, 1e12)) # delta_eps
bounds.append((1e-12, 1e3)) # tau bounds.append((1e-12, 1e3)) # tau
bounds.append((0.1, 1)) # a bounds.append((0.1, 1)) # a
bounds.append((0.1, 1)) # b bounds.append((0.1, 1)) # b
ret = opt.anneal(mini_func, p0, ret = opt.anneal(mini_func, p0,
args=(x, y), args=(x, y),
maxeval=20000, maxeval=20000,
@ -268,15 +266,15 @@ def fit_anneal(x, y, p0, fixed, funcs):
return ret[0] return ret[0]
def fit_lbfgsb(x, y, p0, fixed, funcs): def fit_lbfgsb( x, y, p0, fixed, funcs ):
raise NotImplementedError raise NotImplementedError
# TODO fixed parameters… # TODO fixed parameters…
bounds = [(0, None), (0, 1)] bounds = [(0, None), (0, 1)]
for i in xrange(len(p0[3:]) / 4): for i in xrange(len(p0[3:])/4):
bounds.append((1e-4, 1e12)) # delta_eps bounds.append((1e-4, 1e12)) # delta_eps
bounds.append((1e-12, 1e3)) # tau bounds.append((1e-12, 1e3)) # tau
bounds.append((0.1, 1)) # a bounds.append((0.1, 1)) # a
bounds.append((0.1, 1)) # b bounds.append((0.1, 1)) # b
x, f_minvalue, info_dict = opt.fmin_l_bfgs_b(mini_func, p0, x, f_minvalue, info_dict = opt.fmin_l_bfgs_b(mini_func, p0,
fprime=None, fprime=None,
@ -300,48 +298,47 @@ def fit_lbfgsb(x, y, p0, fixed, funcs):
# return fit.output.beta # return fit.output.beta
def hn(p, nu): def hn( p, nu ):
delta_eps, tau, a, b = p delta_eps, tau, a, b = p
om = 2 * np.pi * nu om = 2*np.pi*nu
Phi = np.arctan((om * tau) ** a * np.sin(np.pi * a / 2.) / (1. + (om * tau) ** a * np.cos(np.pi * a / 2.))) Phi = np.arctan((om*tau)**a*np.sin(np.pi*a/2.)/(1.+(om*tau)**a*np.cos(np.pi*a/2.)))
e_loss = delta_eps * (1 + 2 * (om * tau) ** a * np.cos(np.pi * a / 2.) + (om * tau) ** (2. * a) ) ** ( e_loss = delta_eps*(1+2*(om*tau)**a*np.cos(np.pi*a/2.)+(om*tau)**(2.*a) )**(
-b / 2.) * np.sin(b * Phi) -b/2.)*np.sin(b*Phi)
e_stor = delta_eps * (1 + 2 * (om * tau) ** a * np.cos(np.pi * a / 2.) + (om * tau) ** (2. * a) ) ** ( e_stor = delta_eps*(1+2*(om*tau)**a*np.cos(np.pi*a/2.)+(om*tau)**(2.*a) )**(
-b / 2.) * np.cos(b * Phi) -b/2.)*np.cos(b*Phi)
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
res /= 1 / y res /= 1/y
return np.sqrt(np.dot(res, res)) return np.sqrt(np.dot(res, res))
def multi_hn(p, nu): def multi_hn( p, nu ):
conductivity = p[1] conductivity = p[1]
cond_beta = p[2] cond_beta = p[2]
om = 2 * np.pi * nu om = 2*np.pi*nu
e_loss = conductivity / om ** cond_beta e_loss = conductivity/om**cond_beta
e_loss += p[0] e_loss += p[0]
#for key, igroup in groupby(p[3:], lambda x: x//4): #for key, igroup in groupby(p[3:], lambda x: x//4):
for i in xrange(len(p[3:]) / 4): for i in xrange(len(p[3:])/4):
delta_eps, tau, a, b = p[3 + i * 4:3 + (i + 1) * 4] delta_eps, tau, a, b = p[3+i*4:3+(i+1)*4]
#delta_eps, tau, a, b = list(igroup) #delta_eps, tau, a, b = list(igroup)
#print delta_eps,tau,a,b #print delta_eps,tau,a,b
#a = 0.5 *(1 + N.tanh(a)) #a = 0.5 *(1 + N.tanh(a))
#b = 0.5 *(1 + N.tanh(b)) #b = 0.5 *(1 + N.tanh(b))
Phi = np.arctan((om * tau) ** a * np.sin(np.pi * a / 2.) / (1. + (om * tau) ** a * np.cos(np.pi * a / 2.))) Phi = np.arctan((om*tau)**a*np.sin(np.pi*a/2.)/(1.+(om*tau)**a*np.cos(np.pi*a/2.)))
e_loss += 2 * delta_eps * (1 + 2 * (om * tau) ** a * np.cos(np.pi * a / 2.) + (om * tau) ** (2. * a) ) ** ( e_loss += 2*delta_eps*(1+2*(om*tau)**a*np.cos(np.pi*a/2.)+(om*tau)**(2.*a) )**(
-b / 2.) * np.sin(b * Phi) -b/2.)*np.sin(b*Phi)
#e_stor = delta_eps * (1+ 2*(om*tau)**a * N.cos(N.pi*a/2.) + (om*tau)**(2.*a) )**(-b/2.)*N.cos(b*Phi) #e_stor = delta_eps * (1+ 2*(om*tau)**a * N.cos(N.pi*a/2.) + (om*tau)**(2.*a) )**(-b/2.)*N.cos(b*Phi)
return e_loss return e_loss
def tau_peak(f, a, b): def tau_peak( f, a, b ):
tau = (np.sin(np.pi * a / 2. / (b + 1)) / np.sin(np.pi * a * b / 2. / (b + 1))) ** (1 / a) tau = (np.sin(np.pi*a/2./(b+1))/np.sin(np.pi*a*b/2./(b+1)))**(1/a)
tau /= 2 * np.pi * f tau /= 2*np.pi*f
return tau return tau

View File

@ -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!
@ -12,19 +12,21 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
def _fromUtf8(s): def _fromUtf8( s ):
return s return s
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"))
ConductivityGroupBox.resize(253, 156) ConductivityGroupBox.resize(253, 156)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
@ -61,7 +63,7 @@ class Ui_ConductivityGroupBox(object):
self.checkBox_3.setText(_fromUtf8("")) self.checkBox_3.setText(_fromUtf8(""))
self.checkBox_3.setChecked(True) self.checkBox_3.setChecked(True)
self.checkBox_3.setObjectName(_fromUtf8("checkBox_3")) self.checkBox_3.setObjectName(_fromUtf8("checkBox_3"))
self.gridLayout.addWidget(self.checkBox_3, 3, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout.addWidget(self.checkBox_3, 3, 3, 1, 1, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
self.label_2 = QtGui.QLabel(ConductivityGroupBox) self.label_2 = QtGui.QLabel(ConductivityGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
@ -135,18 +137,25 @@ class Ui_ConductivityGroupBox(object):
QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), ConductivityGroupBox.hide) QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), ConductivityGroupBox.hide)
QtCore.QMetaObject.connectSlotsByName(ConductivityGroupBox) QtCore.QMetaObject.connectSlotsByName(ConductivityGroupBox)
def retranslateUi(self, ConductivityGroupBox): def retranslateUi( self, ConductivityGroupBox ):
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 σ&quot;/σ\'<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 σ&quot;/σ\'<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>σ&quot;</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 σ&quot;/σ\'<span style=\" vertical-align:sub;\">(DC)</span> is a constant</p></body></html>", None)) _translate("ConductivityGroupBox", "<html><head/><body><p>σ&quot;</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 σ&quot;/σ\'<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))

View File

@ -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'

View File

@ -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!
@ -12,19 +12,21 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
def _fromUtf8(s): def _fromUtf8( s ):
return s return s
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"))
PeakGroupBox.setEnabled(True) PeakGroupBox.setEnabled(True)
PeakGroupBox.resize(269, 179) PeakGroupBox.resize(269, 179)
@ -71,7 +73,7 @@ class Ui_PeakGroupBox(object):
self.removeButton.setSizePolicy(sizePolicy) self.removeButton.setSizePolicy(sizePolicy)
self.removeButton.setMinimumSize(QtCore.QSize(0, 0)) self.removeButton.setMinimumSize(QtCore.QSize(0, 0))
self.removeButton.setObjectName(_fromUtf8("removeButton")) self.removeButton.setObjectName(_fromUtf8("removeButton"))
self.gridLayout.addWidget(self.removeButton, 0, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout.addWidget(self.removeButton, 0, 1, 1, 1, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
self.label_1 = QtGui.QLabel(PeakGroupBox) self.label_1 = QtGui.QLabel(PeakGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
@ -153,14 +155,14 @@ class Ui_PeakGroupBox(object):
self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8(""))
self.gridLayout.addWidget(self.comboBox, 0, 2, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout.addWidget(self.comboBox, 0, 2, 1, 1, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
self.retranslateUi(PeakGroupBox) self.retranslateUi(PeakGroupBox)
QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), PeakGroupBox.hide) QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), PeakGroupBox.hide)
QtCore.QMetaObject.connectSlotsByName(PeakGroupBox) QtCore.QMetaObject.connectSlotsByName(PeakGroupBox)
def retranslateUi(self, PeakGroupBox): def retranslateUi( self, PeakGroupBox ):
PeakGroupBox.setWindowTitle(_translate("PeakGroupBox", "GroupBox", None)) PeakGroupBox.setWindowTitle(_translate("PeakGroupBox", "GroupBox", None))
PeakGroupBox.setTitle(_translate("PeakGroupBox", "GroupBox", None)) PeakGroupBox.setTitle(_translate("PeakGroupBox", "GroupBox", None))
self.label.setText(_translate("PeakGroupBox", "Fix", None)) self.label.setText(_translate("PeakGroupBox", "Fix", None))
@ -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))

View File

@ -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!
@ -12,19 +12,21 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
def _fromUtf8(s): def _fromUtf8( s ):
return s return s
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"))
PowerLawGroupBox.resize(206, 129) PowerLawGroupBox.resize(206, 129)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
@ -61,7 +63,7 @@ class Ui_PowerLawGroupBox(object):
self.checkBox_3.setText(_fromUtf8("")) self.checkBox_3.setText(_fromUtf8(""))
self.checkBox_3.setChecked(True) self.checkBox_3.setChecked(True)
self.checkBox_3.setObjectName(_fromUtf8("checkBox_3")) self.checkBox_3.setObjectName(_fromUtf8("checkBox_3"))
self.gridLayout.addWidget(self.checkBox_3, 2, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout.addWidget(self.checkBox_3, 2, 3, 1, 1, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
self.label_6 = QtGui.QLabel(PowerLawGroupBox) self.label_6 = QtGui.QLabel(PowerLawGroupBox)
self.label_6.setObjectName(_fromUtf8("label_6")) self.label_6.setObjectName(_fromUtf8("label_6"))
self.gridLayout.addWidget(self.label_6, 2, 2, 1, 1) self.gridLayout.addWidget(self.label_6, 2, 2, 1, 1)
@ -119,7 +121,7 @@ class Ui_PowerLawGroupBox(object):
QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), PowerLawGroupBox.hide) QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), PowerLawGroupBox.hide)
QtCore.QMetaObject.connectSlotsByName(PowerLawGroupBox) QtCore.QMetaObject.connectSlotsByName(PowerLawGroupBox)
def retranslateUi(self, PowerLawGroupBox): def retranslateUi( self, PowerLawGroupBox ):
PowerLawGroupBox.setWindowTitle(_translate("PowerLawGroupBox", "GroupBox", None)) PowerLawGroupBox.setWindowTitle(_translate("PowerLawGroupBox", "GroupBox", None))
PowerLawGroupBox.setTitle(_translate("PowerLawGroupBox", "Power Law", None)) PowerLawGroupBox.setTitle(_translate("PowerLawGroupBox", "Power Law", None))
self.label.setText(_translate("PowerLawGroupBox", "Fix", None)) self.label.setText(_translate("PowerLawGroupBox", "Fix", None))

61
QDS.py
View File

@ -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,14 +242,17 @@ 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')
f_fcn.write("# %s\n"%(fcn.id_string)) f_fcn.write("# %s\n"%(fcn.id_string))
f_fcn.flush() f_fcn.flush()
@ -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,26 +553,25 @@ 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:
self.data.fitted_curve_real.setData(x=np.array([np.nan]),y=np.array([np.nan])) self.data.fitted_curve_real.setData(x=np.array([np.nan]), y=np.array([np.nan]))
self.data.fitted_curve_imag.setData(x=np.array([np.nan]),y=np.array([np.nan])) self.data.fitted_curve_imag.setData(x=np.array([np.nan]), y=np.array([np.nan]))
def updateIntermediatePlot(self, freq, intermediate_data): def updateIntermediatePlot(self, freq, intermediate_data):
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).

View File

@ -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!
@ -12,19 +12,21 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
def _fromUtf8(s): def _fromUtf8( s ):
return s return s
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"))
MainWindow.resize(956, 699) MainWindow.resize(956, 699)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum)
@ -77,7 +79,7 @@ class Ui_MainWindow(object):
self.toolBar.setObjectName(_fromUtf8("toolBar")) self.toolBar.setObjectName(_fromUtf8("toolBar"))
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
self.dockWidget_3 = QtGui.QDockWidget(MainWindow) self.dockWidget_3 = QtGui.QDockWidget(MainWindow)
self.dockWidget_3.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable) self.dockWidget_3.setFeatures(QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetMovable)
self.dockWidget_3.setObjectName(_fromUtf8("dockWidget_3")) self.dockWidget_3.setObjectName(_fromUtf8("dockWidget_3"))
self.dockWidgetContents_4 = QtGui.QWidget() self.dockWidgetContents_4 = QtGui.QWidget()
self.dockWidgetContents_4.setObjectName(_fromUtf8("dockWidgetContents_4")) self.dockWidgetContents_4.setObjectName(_fromUtf8("dockWidgetContents_4"))
@ -138,7 +140,7 @@ class Ui_MainWindow(object):
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow): def retranslateUi( self, MainWindow ):
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
self.menuExtras.setTitle(_translate("MainWindow", "Extras", None)) self.menuExtras.setTitle(_translate("MainWindow", "Extras", None))
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar", None)) self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar", None))
@ -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

View File

@ -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!
@ -12,19 +12,21 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
def _fromUtf8(s): def _fromUtf8( s ):
return s return s
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"))
StaticGroupBox.resize(218, 102) StaticGroupBox.resize(218, 102)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
@ -83,18 +85,20 @@ class Ui_StaticGroupBox(object):
self.checkBox_1.setText(_fromUtf8("")) self.checkBox_1.setText(_fromUtf8(""))
self.checkBox_1.setChecked(True) self.checkBox_1.setChecked(True)
self.checkBox_1.setObjectName(_fromUtf8("checkBox_1")) 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.checkBox_1, 1, 3, 1, 1, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
self.retranslateUi(StaticGroupBox) self.retranslateUi(StaticGroupBox)
QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), StaticGroupBox.hide) QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL(_fromUtf8("clicked()")), StaticGroupBox.hide)
QtCore.QMetaObject.connectSlotsByName(StaticGroupBox) QtCore.QMetaObject.connectSlotsByName(StaticGroupBox)
def retranslateUi(self, StaticGroupBox): def retranslateUi( self, StaticGroupBox ):
StaticGroupBox.setWindowTitle(_translate("StaticGroupBox", "GroupBox", None)) StaticGroupBox.setWindowTitle(_translate("StaticGroupBox", "GroupBox", None))
StaticGroupBox.setTitle(_translate("StaticGroupBox", "e\'_infty", None)) StaticGroupBox.setTitle(_translate("StaticGroupBox", "e\'_infty", None))
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))

View File

@ -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!
@ -12,19 +12,21 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
def _fromUtf8(s): def _fromUtf8( s ):
return s return s
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"))
Dialog.resize(250, 229) Dialog.resize(250, 229)
self.gridLayout_3 = QtGui.QGridLayout(Dialog) self.gridLayout_3 = QtGui.QGridLayout(Dialog)
@ -85,7 +87,7 @@ class Ui_Dialog(object):
self.gridLayout_3.addWidget(self.groupBox_tau, 1, 0, 1, 1) self.gridLayout_3.addWidget(self.groupBox_tau, 1, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout_3.addWidget(self.buttonBox, 2, 0, 1, 1) self.gridLayout_3.addWidget(self.buttonBox, 2, 0, 1, 1)
@ -94,14 +96,22 @@ class Ui_Dialog(object):
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
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))

View File

@ -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!
@ -12,19 +12,21 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
def _fromUtf8(s): def _fromUtf8( s ):
return s return s
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"))
Form.resize(300, 322) Form.resize(300, 322)
self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout = QtGui.QGridLayout(Form)
@ -40,7 +42,7 @@ class Ui_Form(object):
self.checkBox_1.setObjectName(_fromUtf8("checkBox_1")) self.checkBox_1.setObjectName(_fromUtf8("checkBox_1"))
self.gridLayout.addWidget(self.checkBox_1, 2, 3, 1, 1) self.gridLayout.addWidget(self.checkBox_1, 2, 3, 1, 1)
self.label_422 = QtGui.QLabel(Form) self.label_422 = QtGui.QLabel(Form)
self.label_422.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_422.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_422.setObjectName(_fromUtf8("label_422")) self.label_422.setObjectName(_fromUtf8("label_422"))
self.gridLayout.addWidget(self.label_422, 7, 0, 1, 1) self.gridLayout.addWidget(self.label_422, 7, 0, 1, 1)
self.label_10 = QtGui.QLabel(Form) self.label_10 = QtGui.QLabel(Form)
@ -60,7 +62,7 @@ class Ui_Form(object):
self.doubleSpinBox_4.setObjectName(_fromUtf8("doubleSpinBox_4")) self.doubleSpinBox_4.setObjectName(_fromUtf8("doubleSpinBox_4"))
self.gridLayout.addWidget(self.doubleSpinBox_4, 7, 1, 1, 1) self.gridLayout.addWidget(self.doubleSpinBox_4, 7, 1, 1, 1)
self.label_111 = QtGui.QLabel(Form) self.label_111 = QtGui.QLabel(Form)
self.label_111.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_111.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_111.setObjectName(_fromUtf8("label_111")) self.label_111.setObjectName(_fromUtf8("label_111"))
self.gridLayout.addWidget(self.label_111, 2, 0, 1, 1) self.gridLayout.addWidget(self.label_111, 2, 0, 1, 1)
self.label_4 = QtGui.QLabel(Form) self.label_4 = QtGui.QLabel(Form)
@ -83,11 +85,11 @@ class Ui_Form(object):
self.label_5.setObjectName(_fromUtf8("label_5")) self.label_5.setObjectName(_fromUtf8("label_5"))
self.gridLayout.addWidget(self.label_5, 8, 2, 1, 1) self.gridLayout.addWidget(self.label_5, 8, 2, 1, 1)
self.label_522 = QtGui.QLabel(Form) self.label_522 = QtGui.QLabel(Form)
self.label_522.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_522.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_522.setObjectName(_fromUtf8("label_522")) self.label_522.setObjectName(_fromUtf8("label_522"))
self.gridLayout.addWidget(self.label_522, 8, 0, 1, 1) self.gridLayout.addWidget(self.label_522, 8, 0, 1, 1)
self.label_112 = QtGui.QLabel(Form) self.label_112 = QtGui.QLabel(Form)
self.label_112.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_112.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_112.setObjectName(_fromUtf8("label_112")) self.label_112.setObjectName(_fromUtf8("label_112"))
self.gridLayout.addWidget(self.label_112, 12, 0, 1, 1) self.gridLayout.addWidget(self.label_112, 12, 0, 1, 1)
self.label_9 = QtGui.QLabel(Form) self.label_9 = QtGui.QLabel(Form)
@ -107,7 +109,7 @@ class Ui_Form(object):
self.label_6.setObjectName(_fromUtf8("label_6")) self.label_6.setObjectName(_fromUtf8("label_6"))
self.gridLayout.addWidget(self.label_6, 9, 2, 1, 1) self.gridLayout.addWidget(self.label_6, 9, 2, 1, 1)
self.label_type = QtGui.QLabel(Form) self.label_type = QtGui.QLabel(Form)
self.label_type.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_type.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_type.setObjectName(_fromUtf8("label_type")) self.label_type.setObjectName(_fromUtf8("label_type"))
self.gridLayout.addWidget(self.label_type, 0, 0, 1, 1) self.gridLayout.addWidget(self.label_type, 0, 0, 1, 1)
self.doubleSpinBox_3 = QtGui.QDoubleSpinBox(Form) self.doubleSpinBox_3 = QtGui.QDoubleSpinBox(Form)
@ -127,15 +129,15 @@ class Ui_Form(object):
self.label_2.setObjectName(_fromUtf8("label_2")) self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout.addWidget(self.label_2, 3, 2, 1, 1) self.gridLayout.addWidget(self.label_2, 3, 2, 1, 1)
self.label_102 = QtGui.QLabel(Form) self.label_102 = QtGui.QLabel(Form)
self.label_102.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_102.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_102.setObjectName(_fromUtf8("label_102")) self.label_102.setObjectName(_fromUtf8("label_102"))
self.gridLayout.addWidget(self.label_102, 13, 0, 1, 1) self.gridLayout.addWidget(self.label_102, 13, 0, 1, 1)
self.label_222 = QtGui.QLabel(Form) self.label_222 = QtGui.QLabel(Form)
self.label_222.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_222.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_222.setObjectName(_fromUtf8("label_222")) self.label_222.setObjectName(_fromUtf8("label_222"))
self.gridLayout.addWidget(self.label_222, 3, 0, 1, 1) self.gridLayout.addWidget(self.label_222, 3, 0, 1, 1)
self.label_322 = QtGui.QLabel(Form) self.label_322 = QtGui.QLabel(Form)
self.label_322.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_322.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_322.setObjectName(_fromUtf8("label_322")) self.label_322.setObjectName(_fromUtf8("label_322"))
self.gridLayout.addWidget(self.label_322, 5, 0, 1, 1) self.gridLayout.addWidget(self.label_322, 5, 0, 1, 1)
self.doubleSpinBox_9 = QtGui.QDoubleSpinBox(Form) self.doubleSpinBox_9 = QtGui.QDoubleSpinBox(Form)
@ -168,11 +170,11 @@ class Ui_Form(object):
self.label_3.setObjectName(_fromUtf8("label_3")) self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout.addWidget(self.label_3, 5, 2, 1, 1) self.gridLayout.addWidget(self.label_3, 5, 2, 1, 1)
self.label_82 = QtGui.QLabel(Form) self.label_82 = QtGui.QLabel(Form)
self.label_82.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_82.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_82.setObjectName(_fromUtf8("label_82")) self.label_82.setObjectName(_fromUtf8("label_82"))
self.gridLayout.addWidget(self.label_82, 11, 0, 1, 1) self.gridLayout.addWidget(self.label_82, 11, 0, 1, 1)
self.label_622 = QtGui.QLabel(Form) self.label_622 = QtGui.QLabel(Form)
self.label_622.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_622.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_622.setObjectName(_fromUtf8("label_622")) self.label_622.setObjectName(_fromUtf8("label_622"))
self.gridLayout.addWidget(self.label_622, 9, 0, 1, 1) self.gridLayout.addWidget(self.label_622, 9, 0, 1, 1)
self.doubleSpinBox_7 = QtGui.QDoubleSpinBox(Form) self.doubleSpinBox_7 = QtGui.QDoubleSpinBox(Form)
@ -189,7 +191,7 @@ class Ui_Form(object):
self.label_7.setObjectName(_fromUtf8("label_7")) self.label_7.setObjectName(_fromUtf8("label_7"))
self.gridLayout.addWidget(self.label_7, 10, 2, 1, 1) self.gridLayout.addWidget(self.label_7, 10, 2, 1, 1)
self.label_72 = QtGui.QLabel(Form) self.label_72 = QtGui.QLabel(Form)
self.label_72.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_72.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.label_72.setObjectName(_fromUtf8("label_72")) self.label_72.setObjectName(_fromUtf8("label_72"))
self.gridLayout.addWidget(self.label_72, 10, 0, 1, 1) self.gridLayout.addWidget(self.label_72, 10, 0, 1, 1)
self.doubleSpinBox_8 = QtGui.QDoubleSpinBox(Form) self.doubleSpinBox_8 = QtGui.QDoubleSpinBox(Form)
@ -266,7 +268,7 @@ class Ui_Form(object):
self.retranslateUi(Form) self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form): def retranslateUi( self, Form ):
Form.setWindowTitle(_translate("Form", "Form", None)) Form.setWindowTitle(_translate("Form", "Form", None))
self.label_422.setText(_translate("Form", "β", None)) self.label_422.setText(_translate("Form", "β", None))
self.label_10.setText(_translate("Form", "TextLabel", None)) self.label_10.setText(_translate("Form", "TextLabel", None))
@ -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))

View File

@ -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)):
@ -35,7 +33,7 @@ class Data:
self.hide_funcs = [] self.hide_funcs = []
self.fit_param = param self.fit_param = param
fit_real, fit_imag = FitFunctionCreator().fitfcn(param, self.frequency_fit, *funcs) fit_real, fit_imag = FitFunctionCreator().fitfcn(param, self.frequency_fit, *funcs)
self.epsilon_fit = fit_real + 1j*fit_imag self.epsilon_fit = fit_real+1j*fit_imag
def set_data(self,f,e_real,e_imag): def set_data(self,f,e_real,e_imag):
self.frequency = f self.frequency = f

19
gracedriver.py Normal file
View 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

File diff suppressed because it is too large Load Diff