Code example to run Ngspice Raw File using Python Script
- Import NgSpicedata module present in repo
from ngspicedata import *
- Import Matplotlib module for plotting purpose
from pylab import *
import matplotlib.pyplot as pl
- Load the simrun file using
data=NgspiceData("simrun.raw")
- Print the simulation signal
sig_names = data.lssig('print')
- Store values in x an y
In example code for inverter two signals "in" and "out" voltage is there.
x = data.evalsig('in')
y= data.evalsig('out')
- Plot the Inverter Graph
fig = figure(1)
fig.clf()
plot(x,y,'b-')
plt.xlabel('v(in)')
plt.ylabel('v(out)')
grid(True)
pl.show()