summaryrefslogtreecommitdiff
path: root/src/ngspiceSimulation/pythonPlotting.py
diff options
context:
space:
mode:
authorrahulp132020-02-14 15:16:35 +0530
committerrahulp132020-02-14 15:16:35 +0530
commitcb55e59de7ee4383c04edfae7c39ad9ae9552b36 (patch)
treede1b292a10e8196689bf1a208fe6fe32f4618846 /src/ngspiceSimulation/pythonPlotting.py
parent08d4a0336550a0e610709970a0c5d366e109fe82 (diff)
downloadeSim-cb55e59de7ee4383c04edfae7c39ad9ae9552b36.tar.gz
eSim-cb55e59de7ee4383c04edfae7c39ad9ae9552b36.tar.bz2
eSim-cb55e59de7ee4383c04edfae7c39ad9ae9552b36.zip
common code for Win and Linux, merged py2 changes
Diffstat (limited to 'src/ngspiceSimulation/pythonPlotting.py')
-rw-r--r--src/ngspiceSimulation/pythonPlotting.py45
1 files changed, 9 insertions, 36 deletions
diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py
index bbcc981f..e19b49de 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,11 @@ 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 +388,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 +587,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 +594,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 +644,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
@@ -691,7 +675,6 @@ 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))
@@ -706,7 +689,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 +729,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 +743,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 +767,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 +777,6 @@ class DataExtraction:
self.data = ivals
- # print "volts:",self.butnames
self.volts_length = len(self.NBList)
self.NBList = self.NBList + self.NBIList
@@ -811,12 +786,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):