Version 1

master
Nicolas 6 years ago
parent ac4e0fef5e
commit d00188f0bf

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>560</x>
<y>450</y>
<width>90</width>
<height>35</height>
</rect>
</property>
<property name="text">
<string>Calculer</string>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>230</x>
<y>60</y>
<width>411</width>
<height>152</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_3"/>
</item>
<item>
<widget class="QSpinBox" name="spinBox"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_2">
<property name="geometry">
<rect>
<x>32</x>
<y>60</y>
<width>201</width>
<height>151</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Fréquence de coupure</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Amplitude</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Impédance d'entrée</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Ordre</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>460</x>
<y>450</y>
<width>90</width>
<height>35</height>
</rect>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
<widget class="QTableWidget" name="tableWidget">
<property name="geometry">
<rect>
<x>230</x>
<y>220</y>
<width>411</width>
<height>191</height>
</rect>
</property>
</widget>
<zorder>pushButton</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>verticalLayoutWidget_2</zorder>
<zorder>label_2</zorder>
<zorder>spinBox</zorder>
<zorder>pushButton_2</zorder>
<zorder>tableWidget</zorder>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>500</x>
<y>430</y>
<width>90</width>
<height>35</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>80</x>
<y>10</y>
<width>271</width>
<height>251</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2"/>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,57 @@
# -*-coding:Latin-1 -*
from math import *
print("Entrez la fréquence de coupure:")
frequence = input()
#print(f)
print("Entrez l'impédance d'entrée:")
impedance=input()
print("Entrez l'amplitude max:")
amplitude=input()
print("Entrez l'ordre du filtre:")
ordre=input()
#Calcul des paramètres
#Calcule de wc
wc=2*pi*frequence
#Calcul de b
b=log(cosh(amplitude/17.37)/sinh(amplitude/17.37))
#Calcul de gamma
gamma=sinh(b/(2*ordre))
#initialisation i
i=1
ak=[0]*ordre
bk=[0]*ordre
gk=[0]*ordre
#Cacule de ak
for i in range(ordre):
ak[i-1]=sin((2*(i-1)*pi)/(2*ordre))
#Calcul de bk
for i in range(ordre):
bk[i-1]=pow(gamma,2)+(sin(i*pi)/ordre)
print("test")
print(bk)
#Calcul de gk
gk[0] = ((2*ak[1])/gamma)
print(ak)
print(gk[0])
print(bk[0])
for i in range(ordre):
gk[i]=((4*ak[i-1]*ak[i])/(bk[i-1]*gk[i-1]))
#Calcul de ck et lk
if (ordre%2)==0:
for i in range(ordre):
lk[i]=(impedance/wc)*gk[i]
for i in range(ordre):
ck[i]=(1/impedance)*(1/wc)*gk[i-1]
else:
for i in range(ordre):
lk[i]=(impedance/wc)*gk[i-1]
for i in range(ordre):
ck[i]=(1/impedance)*(1/wc)*gk[i]
#Calcul de Rn
if ordre==1:
rn=1*impedance
else:
rn=pow((tanh(b/4)),2)
print(ck)

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,115 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'filtre.ui'
#
# Created by: PyQt4 UI code generator 4.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(800, 600)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(560, 450, 90, 35))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.verticalLayoutWidget = QtGui.QWidget(self.centralwidget)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(230, 60, 411, 152))
self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setMargin(0)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.lineEdit = QtGui.QLineEdit(self.verticalLayoutWidget)
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.verticalLayout.addWidget(self.lineEdit)
self.lineEdit_2 = QtGui.QLineEdit(self.verticalLayoutWidget)
self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2"))
self.verticalLayout.addWidget(self.lineEdit_2)
self.lineEdit_3 = QtGui.QLineEdit(self.verticalLayoutWidget)
self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3"))
self.verticalLayout.addWidget(self.lineEdit_3)
self.spinBox = QtGui.QSpinBox(self.verticalLayoutWidget)
self.spinBox.setObjectName(_fromUtf8("spinBox"))
self.verticalLayout.addWidget(self.spinBox)
self.verticalLayoutWidget_2 = QtGui.QWidget(self.centralwidget)
self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(32, 60, 201, 151))
self.verticalLayoutWidget_2.setObjectName(_fromUtf8("verticalLayoutWidget_2"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.verticalLayoutWidget_2)
self.verticalLayout_2.setMargin(0)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.label_2 = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout_2.addWidget(self.label_2)
self.label_3 = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.verticalLayout_2.addWidget(self.label_3)
self.label_4 = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.verticalLayout_2.addWidget(self.label_4)
self.label = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout_2.addWidget(self.label)
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(460, 450, 90, 35))
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.tableWidget = QtGui.QTableWidget(self.centralwidget)
self.tableWidget.setGeometry(QtCore.QRect(230, 220, 411, 191))
self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
self.tableWidget.setColumnCount(0)
self.tableWidget.setRowCount(0)
self.pushButton.raise_()
self.verticalLayoutWidget.raise_()
self.verticalLayoutWidget_2.raise_()
self.label_2.raise_()
self.spinBox.raise_()
self.pushButton_2.raise_()
self.tableWidget.raise_()
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 31))
self.menubar.setObjectName(_fromUtf8("menubar"))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
self.pushButton.setText(_translate("MainWindow", "Calculer", None))
self.label_2.setText(_translate("MainWindow", "Fréquence de coupure", None))
self.label_3.setText(_translate("MainWindow", "Amplitude", None))
self.label_4.setText(_translate("MainWindow", "Impédance d\'entrée", None))
self.label.setText(_translate("MainWindow", "Ordre", None))
self.pushButton_2.setText(_translate("MainWindow", "Reset", None))
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

@ -0,0 +1,126 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'filtre2.ui'
#
# Created by: PyQt4 UI code generator 4.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(800, 600)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.Calculer = QtGui.QPushButton(self.centralwidget)
self.Calculer.setGeometry(QtCore.QRect(560, 450, 90, 35))
self.Calculer.setObjectName(_fromUtf8("Calculer"))
self.verticalLayoutWidget = QtGui.QWidget(self.centralwidget)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(230, 60, 411, 152))
self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setMargin(0)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.frequence = QtGui.QLineEdit(self.verticalLayoutWidget)
self.frequence.setObjectName(_fromUtf8("frequence"))
self.verticalLayout.addWidget(self.frequence)
self.amplitude = QtGui.QLineEdit(self.verticalLayoutWidget)
self.amplitude.setObjectName(_fromUtf8("amplitude"))
self.verticalLayout.addWidget(self.amplitude)
self.imdance = QtGui.QLineEdit(self.verticalLayoutWidget)
self.imdance.setObjectName(_fromUtf8("imdance"))
self.verticalLayout.addWidget(self.imdance)
self.ordre = QtGui.QSpinBox(self.verticalLayoutWidget)
self.ordre.setObjectName(_fromUtf8("ordre"))
self.verticalLayout.addWidget(self.ordre)
self.verticalLayoutWidget_2 = QtGui.QWidget(self.centralwidget)
self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(32, 60, 201, 151))
self.verticalLayoutWidget_2.setObjectName(_fromUtf8("verticalLayoutWidget_2"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.verticalLayoutWidget_2)
self.verticalLayout_2.setMargin(0)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.label_2 = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout_2.addWidget(self.label_2)
self.label_3 = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.verticalLayout_2.addWidget(self.label_3)
self.label_4 = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.verticalLayout_2.addWidget(self.label_4)
self.label = QtGui.QLabel(self.verticalLayoutWidget_2)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout_2.addWidget(self.label)
self.reset = QtGui.QPushButton(self.centralwidget)
self.reset.setGeometry(QtCore.QRect(460, 450, 90, 35))
self.reset.setObjectName(_fromUtf8("reset"))
self.lineEdit = QtGui.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(370, 20, 113, 33))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.tableView = QtGui.QTableView(self.centralwidget)
self.tableView.setGeometry(QtCore.QRect(230, 230, 421, 192))
self.tableView.setObjectName(_fromUtf8("tableView"))
self.Calculer.raise_()
self.verticalLayoutWidget.raise_()
self.verticalLayoutWidget_2.raise_()
self.label_2.raise_()
self.ordre.raise_()
self.reset.raise_()
self.lineEdit.raise_()
self.tableView.raise_()
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 31))
self.menubar.setObjectName(_fromUtf8("menubar"))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.actionCalculer = QtGui.QAction(MainWindow)
self.actionCalculer.setObjectName(_fromUtf8("actionCalculer"))
self.retranslateUi(MainWindow)
QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.show)
QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.frequence.clear)
QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.amplitude.clear)
QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.imdance.clear)
QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.ordre.clear)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
self.Calculer.setText(_translate("MainWindow", "Calculer", None))
self.label_2.setText(_translate("MainWindow", "Fréquence de coupure", None))
self.label_3.setText(_translate("MainWindow", "Amplitude", None))
self.label_4.setText(_translate("MainWindow", "Impédance d\'entrée", None))
self.label.setText(_translate("MainWindow", "Ordre", None))
self.reset.setText(_translate("MainWindow", "Reset", None))
self.lineEdit.setText(_translate("MainWindow", "Filtres", None))
self.actionCalculer.setText(_translate("MainWindow", "calculer", None))
import test_rc
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
Loading…
Cancel
Save