Skip to content

iamkrvikash/ngspice-python

Repository files navigation

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

About

Ngspice using Python Script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published