White Audio Designs
[ Products &rarr pyspice ]

pyspice.py is a SPICE pre-processor written in Python, inspired by the Perl SPICE pre-processor spicepp by John Sheahan.

I developed this module as part of my own work and provide it here as a service to the Python and SPICE communities. Additions, suggestions, and usefullness reports are appreciated. It is currently licensed under the GPL.

It was (is currently being) developed with Python 2.4 and uses a few features introduced in 2.4. they relate to (re)sorting the netlist lines.


  • Each input "card" type has its own object type.
  • Netlists are converted into an array of type instances.
  • Netlist order is preserved for readability.
  • Salient features of pyspice.py:
  • Parallel capacitors are combined.
  • Parallel MOSFETs are combined.
  • Small capacitors are dropped for faster simulation.
Updated 2006.11-11 (v0.2a):
  • Fixed a missing newline so it doesn't throw an exception immediately, sorry.
Updated 2006.10.11 (v0.2):
  • At least default (pass through) handling of all element types.
  • NOTE: For combining, this uses a global node name scheme. In other words: subcircuits, libraries, etc. are not in a separate node namespace as they should be, beware.
  • Changed structure of classes (in LEO), there are base classes that contain common attributes and element classes that define the specific behavior.
  • This version _should_ work with any netlist and only touch M's and C's, YMMV.
  • Work is ongoing on the class structure and most important IMO is getting netlist hierarchy implemented.
Updated 2006.05.01 (v0.1)

The source is here. Usage (chmod +x):
  • pyspice.py [options] [-i infile] [-o outfile]
  • Use pyspice.py -h for all options.
I have been using LEO to develop this, here is the .leo file.
And the requisite screenshot (v0.1):
Pyspice Screenshot

Copyright 2006. All rights reserved. Contact: etihwnad AT gmail DOT com