diff options
author | nilshah98 | 2019-06-07 19:15:54 +0530 |
---|---|---|
committer | nilshah98 | 2019-06-13 12:18:39 +0530 |
commit | 89c637c341a281d31ccd63be65a3504d6db79882 (patch) | |
tree | e46a0272c89123fa0ee01ceb375dcc0f5440472b /src/ngspiceSimulation | |
parent | daffbbb29757deff785c13a429b4c03fe3f25fba (diff) | |
download | eSim-89c637c341a281d31ccd63be65a3504d6db79882.tar.gz eSim-89c637c341a281d31ccd63be65a3504d6db79882.tar.bz2 eSim-89c637c341a281d31ccd63be65a3504d6db79882.zip |
made pep8 compliant using autopep8 tool
Diffstat (limited to 'src/ngspiceSimulation')
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py | 2 | ||||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.py | 76 |
2 files changed, 31 insertions, 47 deletions
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index ba56df2a..1d5c974f 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -6,7 +6,7 @@ import os # This Class creates NgSpice Window class NgspiceWidget(QtGui.QWidget): - + def __init__(self, command, projPath): """ 1)Creates constructor for NgspiceWidget class. diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index 6cf99752..3bf8fe59 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -61,7 +61,7 @@ class plotWindow(QtGui.QMainWindow): # Get DataExtraction Details self.obj_dataext = DataExtraction() self.plotType = self.obj_dataext.openFile(self.fpath) - + self.obj_dataext.computeAxes() self.a = self.obj_dataext.numVals() @@ -127,7 +127,7 @@ class plotWindow(QtGui.QMainWindow): self.warnning = QtGui.QLabel() self.funcName = QtGui.QLabel() self.funcExample = QtGui.QLabel() - + self.plotbtn = QtGui.QPushButton("Plot") self.plotbtn.setToolTip('<b>Press</b> to Plot') self.multimeterbtn = QtGui.QPushButton("Multimeter") @@ -157,11 +157,11 @@ class plotWindow(QtGui.QMainWindow): self.right_grid.addWidget(self.funcName, 4, 0) self.right_grid.addWidget(self.funcExample, 4, 1) self.right_vbox.addLayout(self.right_grid) - + self.hbox = QtGui.QHBoxLayout() self.hbox.addLayout(self.left_vbox) self.hbox.addLayout(self.right_vbox) - + self.widget = QtGui.QWidget() self.widget.setLayout(self.hbox) # finalvbox self.scrollArea = QtGui.QScrollArea() @@ -176,7 +176,7 @@ class plotWindow(QtGui.QMainWindow): # Right side window frame showing list of nodes and branches. self.mainFrame.setLayout(self.finalhbox) self.showMaximized() - + self.listNode.setText("<font color='indigo'>List of Nodes:</font>") self.listBranch.setText( "<font color='indigo'>List of Branches:</font>") @@ -237,20 +237,20 @@ class plotWindow(QtGui.QMainWindow): self.axes.cla() self.canvas.draw() QtCore.SLOT('quit()') - + def pushedPlotFunc(self): self.parts = str(self.text.text()) self.parts = self.parts.split(" ") if self.parts[len(self.parts) - 1] == '': self.parts = self.parts[0:-1] - + self.values = self.parts self.comboAll = [] - self.axes.cla() - + self.axes.cla() + self.plotType2 = self.obj_dataext.openFile(self.fpath) - + if len(self.parts) <= 2: self.warnning.setText("Too few arguments!\nRefer syntax below!") QtGui.QMessageBox.about( @@ -283,7 +283,7 @@ class plotWindow(QtGui.QMainWindow): self.comboAll.append(self.obj_dataext.y[i]) for i in range(len(a)): - + if a[i] == len(self.obj_dataext.NBList): QtGui.QMessageBox.about( self, "Warning!!", "One of the operands doesn't belong\ @@ -300,9 +300,9 @@ class plotWindow(QtGui.QMainWindow): else: self.axes.cla() - + for i in range(len(self.obj_dataext.y[a[0]])): - self.combo.append(self.obj_dataext.y[a[0]][i]) + self.combo.append(self.obj_dataext.y[a[0]][i]) self.combo1.append(self.obj_dataext.y[a[1]][i]) self.axes.plot( @@ -316,7 +316,7 @@ class plotWindow(QtGui.QMainWindow): self.axes.set_xlabel('Voltage(V)-->') else: self.axes.set_ylabel('Current(I)-->') - self.axes.set_ylabel('Current(I)-->') + self.axes.set_ylabel('Current(I)-->') elif max(a) >= self.volts_length and min(a) < self.volts_length: QtGui.QMessageBox.about( @@ -350,7 +350,7 @@ class plotWindow(QtGui.QMainWindow): label=str(1)) self.axes.set_xlabel('freq-->') - + if max(a) < self.volts_length: self.axes.set_ylabel('Voltage(V)-->') else: @@ -368,7 +368,7 @@ class plotWindow(QtGui.QMainWindow): self.axes.set_ylabel('Voltage(V)-->') else: self.axes.set_ylabel('Current(I)-->') - + else: # self.setWindowTitle('DC Analysis') self.axes.plot( @@ -408,7 +408,7 @@ class plotWindow(QtGui.QMainWindow): self.axes.set_ylabel('Voltage(V)-->') else: self.axes.set_ylabel('Current(I)-->') - + self.axes.grid(True) if boxCheck == 0: QtGui.QMessageBox.about( @@ -437,7 +437,7 @@ class plotWindow(QtGui.QMainWindow): QtGui.QMessageBox.about( self, "Warning!!", "Please select at least one Node OR Branch") self.canvas.draw() - + def onPush_trans(self): self.axes.cla() boxCheck = 0 @@ -474,7 +474,7 @@ class plotWindow(QtGui.QMainWindow): label=str( j + 1)) self.axes.set_xlabel('Voltage Sweep(V)-->') - + if j < self.volts_length: self.axes.set_ylabel('Voltage(V)-->') else: @@ -495,7 +495,7 @@ class plotWindow(QtGui.QMainWindow): 'm': 'color:magenta', 'k': 'color:black' }[letter] - + def multiMeter(self): print("Function : MultiMeter") self.obj = {} @@ -537,7 +537,7 @@ class plotWindow(QtGui.QMainWindow): class MultimeterWidgetClass(QtGui.QWidget): def __init__(self, node_branch, rmsValue, loc_x, loc_y, voltFlag): QtGui.QWidget.__init__(self) - + self.multimeter = QtGui.QWidget(self) if voltFlag: self.node_branchLabel = QtGui.QLabel("Node") @@ -561,7 +561,7 @@ class MultimeterWidgetClass(QtGui.QWidget): self.setWindowTitle("MultiMeter") self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.show() - + class DataExtraction: def __init__(self): @@ -580,7 +580,7 @@ class DataExtraction: # Reading data file for voltage with open(os.path.join(fpath, "plot_data_v.txt")) as f2: self.voltData = f2.read() - + self.voltData = self.voltData.split("\n") # Initializing variable @@ -621,7 +621,7 @@ class DataExtraction: self.analysisType = 0 if "dec" in self.analysisInfo: self.dec = 1 - + for i in self.voltData[3:]: p += 1 # 'p' gives no. of lines of data for each node/branch if "Index" in i: @@ -630,7 +630,7 @@ class DataExtraction: # print "l:",l if "AC" in i: # DC for dc files and AC for ac ones break - + elif ".tran" in self.analysisInfo: self.analysisType = 1 for i in self.voltData[3:]: @@ -653,7 +653,6 @@ class DataExtraction: # print "l:",l if "DC" in i: # DC for dc files and AC for ac ones break - # print "VoltNumber",vnumber # print "CurrentNumber",inumber @@ -671,7 +670,7 @@ class DataExtraction: try: with open(os.path.join(fpath, "plot_data_i.txt")) as f2: alli = f2.read() - + alli = alli.split("\n") self.NBIList = [] @@ -684,7 +683,7 @@ class DataExtraction: self.msg = QtGui.QErrorMessage(None) self.msg.showMessage('Unable to open plot data files.') self.msg.setWindowTitle("Error Message:openFile") - + try: for l in alli[3].split(" "): if len(l) > 0: @@ -720,7 +719,7 @@ class DataExtraction: inum_i = len(alli[5].split("\t")) full_data = [] - + # Creating list of data: if d3 < 3: for i in range(1, d2): @@ -785,9 +784,9 @@ class DataExtraction: if self.NBList[len(self.NBList) - 1] == 'v-sweep': self.NBList.pop() j1.pop() - + j1.pop() - j = j + j1 + j = j + j1 j = j + full_data[m] # print j m += 1 @@ -827,18 +826,3 @@ class DataExtraction: for i in self.data: temp = i.split("\t") self.x.append(Decimal(temp[0])) - - - - - - - - - - - - - - - |