diff options
author | Rahul P | 2020-03-04 17:01:11 +0530 |
---|---|---|
committer | GitHub | 2020-03-04 17:01:11 +0530 |
commit | 8ffe81b36caa259151978de0434e4e0c5c32d217 (patch) | |
tree | 32202454d13dfabbf6556e98987f2a9632619ea9 /src/ngspiceSimulation | |
parent | e40317e709c220176fc5b7edf23d4434504335b0 (diff) | |
parent | 13f3bcfda9416624cebbf5705de398e8efcad344 (diff) | |
download | eSim-8ffe81b36caa259151978de0434e4e0c5c32d217.tar.gz eSim-8ffe81b36caa259151978de0434e4e0c5c32d217.tar.bz2 eSim-8ffe81b36caa259151978de0434e4e0c5c32d217.zip |
Merge pull request #132 from rahulp13/master
major changes
Diffstat (limited to 'src/ngspiceSimulation')
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.py | 61 |
1 files changed, 20 insertions, 41 deletions
diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index bbcc981f..032b1eeb 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -1,5 +1,5 @@ -from __future__ import division # Used for decimal division eg -# 2/3=0.66 and not '0' 6/2=3.0 and 6//2=3 +from __future__ import division # Used for decimal division +# eg: 2/3=0.66 and not '0' 6/2=3.0 and 6//2=3 import os from PyQt4 import QtGui, QtCore from decimal import Decimal, getcontext @@ -264,20 +264,17 @@ class plotWindow(QtGui.QMainWindow): # p = 0 for i in range(len(self.parts)): - # print "I",i if i % 2 == 0: - # print "I'm in:" for j in range(len(self.obj_dataext.NBList)): if self.parts[i] == self.obj_dataext.NBList[j]: - # print "I got you:",self.parts[i] a.append(j) if len(a) != len(self.parts) // 2 + 1: QtGui.QMessageBox.about( self, "Warning!!", - "One of the operands doesn't belong to\ - the above list of Nodes!!") + "One of the operands doesn't belong to " + "the above list of Nodes!!") for i in a: self.comboAll.append(self.obj_dataext.y[i]) @@ -286,11 +283,13 @@ class plotWindow(QtGui.QMainWindow): if a[i] == len(self.obj_dataext.NBList): QtGui.QMessageBox.about( - self, "Warning!!", "One of the operands doesn't belong\ - to the above list!!") + self, "Warning!!", "One of the operands doesn't belong " + + "to the above list!!" + ) self.warnning.setText( - "<font color='red'>To Err Is Human!<br>One of the operands\ - doesn't belong to the above list!!</font>") + "<font color='red'>To Err Is Human!<br>One of the " + + "operands doesn't belong to the above list!!</font>" + ) if self.parts[1] == 'vs': if len(self.parts) > 3: @@ -391,7 +390,6 @@ class plotWindow(QtGui.QMainWindow): # definition of functions onPush_decade, onPush_ac, onPush_trans,\ # onPush_dc, color and multimeter and getRMSValue. def onPush_decade(self): - # print "Calling on push Decade" boxCheck = 0 self.axes.cla() @@ -591,7 +589,6 @@ class DataExtraction: # 'inumber' gives total number of current p = npv = vnumber = inumber = 0 - # print "VoltsData : ",self.voltData # Finding totla number of voltage node for i in self.voltData[3:]: @@ -599,22 +596,16 @@ class DataExtraction: if "Index" in i: # "V(" in i or "x1" in i or "u3" in i: vnumber += 1 - # print "Voltage Number :",vnumber - # Reading Current Source Data with open(os.path.join(fpath, "plot_data_i.txt")) as f1: self.currentData = f1.read() self.currentData = self.currentData.split("\n") - # print "CurrentData : ",self.currentData - # Finding Number of Branch for i in self.currentData[3:]: if "#branch" in i: inumber += 1 - # print "Current Number :",inumber - self.dec = 0 # For AC @@ -655,14 +646,9 @@ class DataExtraction: if "DC" in i: # DC for dc files and AC for ac ones break - # print "VoltNumber",vnumber - # print "CurrentNumber",inumber vnumber = vnumber // npv # vnumber gives the no of voltage nodes inumber = inumber // npv # inumber gives the no of branches - # print "VoltNumber",vnumber - # print "CurrentNumber",inumber - p = [p, vnumber, self.analysisType, self.dec, inumber] return p @@ -681,9 +667,11 @@ class DataExtraction: except Exception as e: print("Exception Message : ", str(e)) self.obj_appconfig.print_error('Exception Message :' + str(e)) - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage('Unable to open plot data files.') - self.msg.setWindowTitle("Error Message:openFile") + self.msg.exec_() try: for l in alli[3].split(" "): @@ -691,13 +679,14 @@ class DataExtraction: self.NBIList.append(l) self.NBIList = self.NBIList[2:] len_NBIList = len(self.NBIList) - # print "NBILIST : ",self.NBIList except Exception as e: print("Exception Message : ", str(e)) self.obj_appconfig.print_error('Exception Message :' + str(e)) - self.msg = QtGui.QErrorMessage(None) - self.msg.showMessage('Error in Analysis File.') - self.msg.setWindowTitle("Error Message:openFile") + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") + self.msg.showMessage('Unable to read Analysis File.') + self.msg.exec_() d = self.numberFinder(fpath) d1 = int(d[0] + 1) @@ -706,7 +695,6 @@ class DataExtraction: d4 = d[4] dec = [d3, d[3]] - # print "No. of Nodes:", d2 self.NBList = [] allv = allv.split("\n") for l in allv[3].split(" "): @@ -747,13 +735,11 @@ class DataExtraction: for i in alli[5:d1 - 1]: if len(i.split("\t")) == inum_i: j2 = i.split("\t") - # print j2 j2.pop(0) j2.pop(0) j2.pop() if d3 == 0: # not in trans j2.pop() - # print j2 for l in range(1, d4): j3 = alli[5 + l * d1 + k].split("\t") @@ -763,14 +749,11 @@ class DataExtraction: j3.pop() # not required for dc j3.pop() j2 = j2 + j3 - # print j2 full_data.append(j2) k += 1 - # print "FULL DATA :",full_data - for i in allv[5:d1 - 1]: if len(i.split("\t")) == inum: j = i.split("\t") @@ -790,9 +773,8 @@ class DataExtraction: j1.pop() j = j + j1 j = j + full_data[m] - # print j m += 1 - # print j[:20] + j = "\t".join(j[1:]) j = j.replace(",", "") ivals.append(j) @@ -801,7 +783,6 @@ class DataExtraction: self.data = ivals - # print "volts:",self.butnames self.volts_length = len(self.NBList) self.NBList = self.NBList + self.NBIList @@ -811,12 +792,10 @@ class DataExtraction: def numVals(self): a = self.volts_length # No of voltage nodes b = len(self.data[0].split("\t")) - # print "numvals:",b return [b, a] def computeAxes(self): nums = len(self.data[0].split("\t")) - # print "i'm nums:",nums self.y = [] var = self.data[0].split("\t") for i in range(1, nums): |