From 0a32f6576ad2d21e70e660f8f7710848cf6eabbb Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Wed, 24 Sep 2014 16:19:46 +0200 Subject: [PATCH] Added Gb distribution to YAFF menu --- YAFFConfig.py | 34 +++++++++++-------------------- YAFFparameters.py | 52 ++++++++++++++++++++++------------------------- YAFFparameters.ui | 5 +++++ libyaff.py | 16 ++++++++++++++- 4 files changed, 56 insertions(+), 51 deletions(-) diff --git a/YAFFConfig.py b/YAFFConfig.py index a19ad35..988c0a9 100644 --- a/YAFFConfig.py +++ b/YAFFConfig.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'YAFFConfig.ui' # -# Created: Tue Jul 29 08:56:48 2014 -# by: PyQt4 UI code generator 4.11.1 +# Created: Tue Sep 23 21:38:12 2014 +# by: PyQt4 UI code generator 4.11.1 # # WARNING! All changes made in this file will be lost! @@ -12,21 +12,19 @@ from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: - def _fromUtf8( s ): + def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 - - def _translate( context, text, disambig ): + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: - def _translate( context, text, disambig ): + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) - class Ui_Dialog(object): - def setupUi( self, Dialog ): + def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(250, 229) self.gridLayout_3 = QtGui.QGridLayout(Dialog) @@ -87,7 +85,7 @@ class Ui_Dialog(object): self.gridLayout_3.addWidget(self.groupBox_tau, 1, 0, 1, 1) self.buttonBox = QtGui.QDialogButtonBox(Dialog) 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.gridLayout_3.addWidget(self.buttonBox, 2, 0, 1, 1) @@ -96,22 +94,14 @@ class Ui_Dialog(object): QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog) - def retranslateUi( self, Dialog ): + def retranslateUi(self, Dialog): Dialog.setWindowTitle(_translate("Dialog", "YAFF Configuration", None)) self.groupBox_time.setTitle(_translate("Dialog", "Time values (log10[t])", None)) - self.label.setText(_translate("Dialog", - "

tmin

", - None)) - self.label_2.setText(_translate("Dialog", - "

tmax

", - None)) + self.label.setText(_translate("Dialog", "

tmin

", None)) + self.label_2.setText(_translate("Dialog", "

tmax

", None)) self.label_3.setText(_translate("Dialog", "N", None)) self.groupBox_tau.setTitle(_translate("Dialog", "τ-Distribution (log10[τ])", None)) - self.label_7.setText(_translate("Dialog", - "

tmin

", - None)) - self.label_8.setText(_translate("Dialog", - "

tmax

", - None)) + self.label_7.setText(_translate("Dialog", "

tmin

", None)) + self.label_8.setText(_translate("Dialog", "

tmax

", None)) self.label_9.setText(_translate("Dialog", "N", None)) diff --git a/YAFFparameters.py b/YAFFparameters.py index 1c21776..478a236 100644 --- a/YAFFparameters.py +++ b/YAFFparameters.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'YAFFparameters.ui' # -# Created: Tue Jul 29 08:56:48 2014 -# by: PyQt4 UI code generator 4.11.1 +# Created: Tue Sep 23 21:38:12 2014 +# by: PyQt4 UI code generator 4.11.1 # # WARNING! All changes made in this file will be lost! @@ -12,21 +12,19 @@ from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: - def _fromUtf8( s ): + def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 - - def _translate( context, text, disambig ): + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: - def _translate( context, text, disambig ): + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) - class Ui_Form(object): - def setupUi( self, Form ): + def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(300, 322) self.gridLayout = QtGui.QGridLayout(Form) @@ -42,7 +40,7 @@ class Ui_Form(object): self.checkBox_1.setObjectName(_fromUtf8("checkBox_1")) self.gridLayout.addWidget(self.checkBox_1, 2, 3, 1, 1) 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.gridLayout.addWidget(self.label_422, 7, 0, 1, 1) self.label_10 = QtGui.QLabel(Form) @@ -62,7 +60,7 @@ class Ui_Form(object): self.doubleSpinBox_4.setObjectName(_fromUtf8("doubleSpinBox_4")) self.gridLayout.addWidget(self.doubleSpinBox_4, 7, 1, 1, 1) 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.gridLayout.addWidget(self.label_111, 2, 0, 1, 1) self.label_4 = QtGui.QLabel(Form) @@ -85,11 +83,11 @@ class Ui_Form(object): self.label_5.setObjectName(_fromUtf8("label_5")) self.gridLayout.addWidget(self.label_5, 8, 2, 1, 1) self.label_522 = QtGui.QLabel(Form) - self.label_522.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_522.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_522.setObjectName(_fromUtf8("label_522")) self.gridLayout.addWidget(self.label_522, 8, 0, 1, 1) self.label_112 = QtGui.QLabel(Form) - self.label_112.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_112.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_112.setObjectName(_fromUtf8("label_112")) self.gridLayout.addWidget(self.label_112, 12, 0, 1, 1) self.label_9 = QtGui.QLabel(Form) @@ -109,7 +107,7 @@ class Ui_Form(object): self.label_6.setObjectName(_fromUtf8("label_6")) self.gridLayout.addWidget(self.label_6, 9, 2, 1, 1) self.label_type = QtGui.QLabel(Form) - self.label_type.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_type.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_type.setObjectName(_fromUtf8("label_type")) self.gridLayout.addWidget(self.label_type, 0, 0, 1, 1) self.doubleSpinBox_3 = QtGui.QDoubleSpinBox(Form) @@ -129,15 +127,15 @@ class Ui_Form(object): self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout.addWidget(self.label_2, 3, 2, 1, 1) self.label_102 = QtGui.QLabel(Form) - self.label_102.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_102.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_102.setObjectName(_fromUtf8("label_102")) self.gridLayout.addWidget(self.label_102, 13, 0, 1, 1) self.label_222 = QtGui.QLabel(Form) - self.label_222.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_222.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_222.setObjectName(_fromUtf8("label_222")) self.gridLayout.addWidget(self.label_222, 3, 0, 1, 1) self.label_322 = QtGui.QLabel(Form) - self.label_322.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_322.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_322.setObjectName(_fromUtf8("label_322")) self.gridLayout.addWidget(self.label_322, 5, 0, 1, 1) self.doubleSpinBox_9 = QtGui.QDoubleSpinBox(Form) @@ -170,11 +168,11 @@ class Ui_Form(object): self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout.addWidget(self.label_3, 5, 2, 1, 1) self.label_82 = QtGui.QLabel(Form) - self.label_82.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_82.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_82.setObjectName(_fromUtf8("label_82")) self.gridLayout.addWidget(self.label_82, 11, 0, 1, 1) self.label_622 = QtGui.QLabel(Form) - self.label_622.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_622.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_622.setObjectName(_fromUtf8("label_622")) self.gridLayout.addWidget(self.label_622, 9, 0, 1, 1) self.doubleSpinBox_7 = QtGui.QDoubleSpinBox(Form) @@ -191,7 +189,7 @@ class Ui_Form(object): self.label_7.setObjectName(_fromUtf8("label_7")) self.gridLayout.addWidget(self.label_7, 10, 2, 1, 1) self.label_72 = QtGui.QLabel(Form) - self.label_72.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.label_72.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_72.setObjectName(_fromUtf8("label_72")) self.gridLayout.addWidget(self.label_72, 10, 0, 1, 1) self.doubleSpinBox_8 = QtGui.QDoubleSpinBox(Form) @@ -257,6 +255,7 @@ class Ui_Form(object): self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) + self.comboBox.addItem(_fromUtf8("")) self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1) self.removeButton = QtGui.QPushButton(Form) self.removeButton.setObjectName(_fromUtf8("removeButton")) @@ -268,7 +267,7 @@ class Ui_Form(object): self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) - def retranslateUi( self, Form ): + def retranslateUi(self, Form): Form.setWindowTitle(_translate("Form", "Form", None)) self.label_422.setText(_translate("Form", "β", None)) self.label_10.setText(_translate("Form", "TextLabel", None)) @@ -283,24 +282,21 @@ class Ui_Form(object): self.label_huh.setText(_translate("Form", "TextLabel", None)) self.label_2.setText(_translate("Form", "TextLabel", None)) self.label_102.setText(_translate("Form", "g", None)) - self.label_222.setText( - _translate("Form", "

τα

", - None)) + self.label_222.setText(_translate("Form", "

τα

", None)) self.label_322.setText(_translate("Form", "α", None)) self.label_8.setText(_translate("Form", "TextLabel", None)) self.label_1.setText(_translate("Form", "TextLabel", None)) self.label_3.setText(_translate("Form", "TextLabel", None)) self.label_82.setText(_translate("Form", "b", None)) - self.label_622.setText( - _translate("Form", "

τβ

", - None)) + self.label_622.setText(_translate("Form", "

τβ

", None)) self.label_7.setText(_translate("Form", "TextLabel", None)) self.label_72.setText(_translate("Form", "a", None)) self.label_23.setText(_translate("Form", "Fix", None)) self.comboBox.setItemText(0, _translate("Form", "GG", None)) self.comboBox.setItemText(1, _translate("Form", "GGe", None)) - self.comboBox.setItemText(2, _translate("Form", "GG + b", None)) - self.comboBox.setItemText(3, _translate("Form", "GGe + b", None)) + self.comboBox.setItemText(2, _translate("Form", "Gb", None)) + self.comboBox.setItemText(3, _translate("Form", "GG + b", None)) + self.comboBox.setItemText(4, _translate("Form", "GGe + b", None)) self.removeButton.setText(_translate("Form", "Remove", None)) self.configButton.setText(_translate("Form", "Configure", None)) diff --git a/YAFFparameters.ui b/YAFFparameters.ui index ed8fa34..3a77d66 100644 --- a/YAFFparameters.ui +++ b/YAFFparameters.ui @@ -441,6 +441,11 @@ GGe + + + Gb + + GG + b diff --git a/libyaff.py b/libyaff.py index 89ff99b..c2cbee5 100644 --- a/libyaff.py +++ b/libyaff.py @@ -17,7 +17,7 @@ def filon(oms, unsorted_x,unsorted_y): y = unsorted_y[unsorted_x.argsort()] amps = zeros(oms.size, dtype='complex') for i,om in enumerate(oms): - amps[i] = sum(diff(y)/diff(x)*(cos(om*x[1:])-cos(om*x[:-1])))/om**2 + amps[i] = sum(diff(y)/diff(x)*(cos(om*x[1:])-cos(om*x[:-1])))/om**2 amps[i] += 1j*( - sum(diff(y)/diff(x)*(sin(om*x[1:])-sin(om*x[:-1])))/om**2) #-y[0]/om return amps @@ -45,6 +45,7 @@ class Yaff(QObject): yaff = [ (self.yaff_gg, "GG"), (self.yaff_gge, "GGe"), + (self.yaff_gb, "Gb"), (self.yaff, "GG + GGb"), (self.yaff_extended, "GGe + GGb"), ] @@ -205,6 +206,19 @@ class Yaff(QObject): self.step_signal.emit(list(p)) return epp + def yaff_gb(self, p,x, cb=None): + """ + GG + """ + delta_eps, tau1, a1, b1, lambd, tau2, a2, b2, s, g = p + #ts = logspace(-10,5,512*2) + dist_ggb = self.ggb(p=[tau2, a2, b2], tau=self.dist_tau) + self.dist_y = dist_ggb + phi_alpha = self.dist_to_relax(self.time_points, self.dist_tau, self.dist_y).real + epp = delta_eps*2*pi*x*filon(2*pi*x, self.time_points, phi_alpha ) + self.step_signal.emit(list(p)) + return epp + def yaff_gg(self, p,x, cb=None): """ GG