diff options
author | Sunil Shetye | 2019-06-13 13:11:14 +0530 |
---|---|---|
committer | GitHub | 2019-06-13 13:11:14 +0530 |
commit | cfc34bb19977e738582620802415ccde27a03039 (patch) | |
tree | daaace10133835956619b401aca9c252e3e789bc /src/ngspiceSimulation | |
parent | 25c6eddcea3c8a62d9750a78435454544d8c7b14 (diff) | |
parent | 20b23a7934f7cf01cd5b4353ddd2e008b40e5ffd (diff) | |
download | eSim-cfc34bb19977e738582620802415ccde27a03039.tar.gz eSim-cfc34bb19977e738582620802415ccde27a03039.tar.bz2 eSim-cfc34bb19977e738582620802415ccde27a03039.zip |
Merge pull request #86 from nilshah98/documentation
Documentation added and minor fixes
Diffstat (limited to 'src/ngspiceSimulation')
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py | 10 | ||||
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py.bak | 37 | ||||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.py | 42 |
3 files changed, 35 insertions, 54 deletions
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index 52427681..def1d4e9 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -4,9 +4,11 @@ import platform import os +# This Class creates NgSpice Window class NgspiceWidget(QtGui.QWidget): """ - This Class creates NgSpice Window + Includes functions that checks whether OS is linux or windows + and creates NgSpice window accordingly. """ def __init__(self, command, projPath): @@ -18,21 +20,21 @@ class NgspiceWidget(QtGui.QWidget): self.layout.addWidget(self.terminal) print("Argument to ngspice command : ", command) - + # For Linux OS if platform.system() == 'Linux': self.command = "cd " + projPath + ";ngspice " + command # Creating argument for process - # self.args = ['-into', str(self.terminal.winId()),\ - # '-hold','-e', self.command] self.args = ['-hold', '-e', self.command] self.process.start('xterm', self.args) self.obj_appconfig.process_obj.append(self.process) + print(self.obj_appconfig.proc_dict) ( self.obj_appconfig.proc_dict [self.obj_appconfig.current_project['ProjectName']].append( self.process.pid()) ) + # For Windows OS elif platform.system() == 'Windows': tempdir = os.getcwd() projPath = self.obj_appconfig.current_project["ProjectName"] diff --git a/src/ngspiceSimulation/NgspiceWidget.py.bak b/src/ngspiceSimulation/NgspiceWidget.py.bak deleted file mode 100644 index 27101eb3..00000000 --- a/src/ngspiceSimulation/NgspiceWidget.py.bak +++ /dev/null @@ -1,37 +0,0 @@ -from PyQt4 import QtGui,QtCore -from configuration.Appconfig import Appconfig -import platform -import os - -class NgspiceWidget(QtGui.QWidget): - """ - This Class creates NgSpice Window - """ - def __init__(self,command,projPath): - QtGui.QWidget.__init__(self) - self.obj_appconfig = Appconfig() - self.process = QtCore.QProcess(self) - self.terminal = QtGui.QWidget(self) - self.layout = QtGui.QVBoxLayout(self) - self.layout.addWidget(self.terminal) - - print("Argument to ngspice command : ",command) - - if platform.system() == 'Linux': - self.command = "cd "+projPath+";ngspice "+command - #Creating argument for process - #self.args = ['-into', str(self.terminal.winId()),'-hold','-e', self.command] - self.args = ['-hold','-e', self.command] - self.process.start('xterm', self.args) - self.obj_appconfig.process_obj.append(self.process) - self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']].append(self.process.pid()) - - elif platform.system() == 'Windows': - tempdir= os.getcwd() - projPath = self.obj_appconfig.current_project["ProjectName"] - os.chdir(projPath) - self.command = "ngspice "+command - self.process.start(self.command) - os.chdir(tempdir) - - diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index 9e9db8f6..9f8f8e88 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -11,7 +11,13 @@ from configuration.Appconfig import Appconfig import numpy as np +# This class creates Python Plotting window class plotWindow(QtGui.QMainWindow): + ''' + This class defines python plotting window, its features, buttons, + colors, AC and DC analysis, plotting etc. + ''' + def __init__(self, fpath, projectName): QtGui.QMainWindow.__init__(self) self.fpath = fpath @@ -114,6 +120,7 @@ class plotWindow(QtGui.QMainWindow): '; font-weight = bold;') self.top_grid.addWidget(self.colorLab, i + 3, 1) + # Buttons for Plot, multimeter, plotting function. self.clear = QtGui.QPushButton("Clear") self.warnning = QtGui.QLabel() self.funcName = QtGui.QLabel() @@ -135,7 +142,7 @@ class plotWindow(QtGui.QMainWindow): self.palette2.setColor(QtGui.QPalette.Foreground, QtCore.Qt.red) self.funcName.setPalette(self.palette1) self.funcExample.setPalette(self.palette2) - + # Widgets for grid, plot button and multimeter button. self.right_vbox.addLayout(self.top_grid) self.right_vbox.addWidget(self.plotbtn) self.right_vbox.addWidget(self.multimeterbtn) @@ -158,10 +165,13 @@ class plotWindow(QtGui.QMainWindow): self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidgetResizable(True) self.scrollArea.setWidget(self.widget) - + ''' + Right side box containing checkbox for different inputs and + options of plot, multimeter and plot function. + ''' self.finalhbox = QtGui.QHBoxLayout() self.finalhbox.addWidget(self.scrollArea) - + # Right side window frame showing list of nodes and branches. self.mainFrame.setLayout(self.finalhbox) self.showMaximized() @@ -170,10 +180,10 @@ class plotWindow(QtGui.QMainWindow): "<font color='indigo'>List of Branches:</font>") self.funcLabel.setText("<font color='indigo'>Function:</font>") self.funcName.setText( - "<font color='indigo'>Standard functions</font>\ + "<font color='indigo'>Standard functions</font>\ <br><br>Addition:<br>Subtraction:<br>\ Multiplication:<br>Division:<br>Comparison:" - ) + ) self.funcExample.setText( "\n\nNode1 + Node2\nNode1 - Node2\nNode1 * Node2\nNode1 / Node2\ \nNode1 vs Node2") @@ -188,7 +198,7 @@ class plotWindow(QtGui.QMainWindow): self.multimeterbtn, QtCore.SIGNAL('clicked()'), self.multiMeter) - + # for AC analysis if self.plotType[0] == 0: self.analysisType.setText("<b>AC Analysis</b>") if self.plotType[1] == 1: @@ -201,7 +211,7 @@ class plotWindow(QtGui.QMainWindow): self.plotbtn, QtCore.SIGNAL('clicked()'), self.onPush_ac) - + # for transient analysis elif self.plotType[0] == 1: self.analysisType.setText("<b>Transient Analysis</b>") self.connect( @@ -210,14 +220,16 @@ class plotWindow(QtGui.QMainWindow): self.onPush_trans) else: + # For DC analysis self.analysisType.setText("<b>DC Analysis</b>") self.connect( self.plotbtn, QtCore.SIGNAL('clicked()'), self.onPush_dc) - self.setCentralWidget(self.mainFrame) - + self.setCentralWidget(self.mainFrame) + + # definition of functions pushedClear, pushedPlotFunc. def pushedClear(self): self.text.clear() self.axes.cla() @@ -372,6 +384,9 @@ class plotWindow(QtGui.QMainWindow): self.combo = [] self.combo1 = [] self.combo1_rev = [] + + # 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 @@ -502,9 +517,10 @@ class plotWindow(QtGui.QMainWindow): loc_y += 50 # Adding object of multimeter to dictionary ( - self.obj_appconfig.dock_dict - [self.obj_appconfig.current_project['ProjectName']].append( - self.obj[j]) + self.obj_appconfig. + dock_dict[ + self.obj_appconfig.current_project['ProjectName']]. + append(self.obj[j]) ) if boxCheck == 0: @@ -554,7 +570,7 @@ class DataExtraction: self.x = [] # stores x-axis data def numberFinder(self, fpath): - # Opening ANalysis file + # Opening Analysis file with open(os.path.join(fpath, "analysis")) as f3: self.analysisInfo = f3.read() self.analysisInfo = self.analysisInfo.split(" ") |