Difference between revisions of "Using Python with ngspice"
Jump to navigation
Jump to search
(Created page with "We can automate this process by using ngspice in batch mode, i.e. running the simulator from the command line, and reading the output file using Python, and do the processing...") |
|||
Line 4: | Line 4: | ||
== Running ngspice from Python == | == Running ngspice from Python == | ||
− | Below is a simple Python script for running ngspice, reading its output. | + | Below is a simple Python script for running ngspice, reading its output. It uses the '''ngspice_link''' module, that contains convenient classes and functions for running ngspice from within Python. |
Revision as of 14:45, 6 August 2020
We can automate this process by using ngspice in batch mode, i.e. running the simulator from the command line, and reading the output file using Python, and do the processing automatically. To run ngspice at the command line, you can use ngspice <circuit file>
.
One very good environment for Python3 is Spyder. You can download this for multiple platforms, and the easiest way to install Spyder is as part of the Anaconda distribution, also available for various operating systems.
Running ngspice from Python
Below is a simple Python script for running ngspice, reading its output. It uses the ngspice_link module, that contains convenient classes and functions for running ngspice from within Python.