Learning Ngspice is a difficult endeavor, with bewildering commands and syntax. You can explore the full power of Ngspice with the help of Python. We have created full-functioning notebooks that can be used with Google Colabs or Jupyter.
Ngspice is an open-source circuit simulator for exploring and validating electronic designs. Experiment with design alternatives, optimize operation, and understand how operation changes under real-world conditions.
Google Colab is a cloud-based notebook environment for writing, running, and sharing code. Prototype ideas quickly, execute computations without local setup, and collaborate through live notebooks that combine code, results, and documentation.
Interaction with Ngspice within the notebook is facilitated by the PyOPUS, a library formulation-based optimization with circuits in mind.
There are three ways to use these run these notebooks.
Colab: This is the easiest way. Open the notebook you want to use and press the Open in Colab buttom at the top of the notebook. You'll have to log into your Google account to execute the cells.
Codespace: Notebooks can be launched directly in Github using Codespaces.
Jupyter: Notebooks can be download and opened in JupyterLab.
It is best to go through the notebooks in the order below, as each one introduces new concepts. divider.ipynb has more detailed explanations. Subsequent notebooks, assume you know know the concepts introduced in divider.ipynb.
| Notebook | Description | Features |
|---|---|---|
| divider.ipynb | Simple resistor divider | Ngspice introduction, PyOPUS introduction, condensed output |
| rlc.ipynb | Parallel RLC | plotting introduction |
| rlc_widgets.ipynb | Interactive parallel RLC | slider widgets, interactive plot, looping Nspice simulation |