Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 741 Bytes

File metadata and controls

46 lines (36 loc) · 741 Bytes

ngspice-python

Code example to run Ngspice Raw File using Python Script

  1. Import NgSpicedata module present in repo
from ngspicedata import *
  1. Import Matplotlib module for plotting purpose
from pylab import *
import matplotlib.pyplot as pl
  1. Load the simrun file using
data=NgspiceData("simrun.raw")
  1. Print the simulation signal
sig_names = data.lssig('print') 
  1. 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')
  1. 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()

Output