{"id":14989200,"url":"https://github.com/ahkab/ahkab","last_synced_at":"2025-04-12T21:20:17.836Z","repository":{"id":10170710,"uuid":"12254495","full_name":"ahkab/ahkab","owner":"ahkab","description":"a SPICE-like electronic circuit simulator written in Python","archived":false,"fork":false,"pushed_at":"2024-04-23T17:59:17.000Z","size":10859,"stargazers_count":364,"open_issues_count":30,"forks_count":85,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-04-03T23:09:33.688Z","etag":null,"topics":["circuit-simulation","circuits","linear-time-invariant","nodal-analysis","scipy","spice","sympy"],"latest_commit_sha":null,"homepage":"https://ahkab.github.io/ahkab/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahkab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-08-20T21:18:54.000Z","updated_at":"2025-03-28T07:43:48.000Z","dependencies_parsed_at":"2024-06-12T16:37:07.851Z","dependency_job_id":"82c59a03-cd66-4d29-b555-c95443f1a6f9","html_url":"https://github.com/ahkab/ahkab","commit_stats":{"total_commits":1164,"total_committers":12,"mean_commits":97.0,"dds":"0.21305841924398627","last_synced_commit":"1e8939194b689909b8184ce7eba478b485ff9e3a"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkab%2Fahkab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkab%2Fahkab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkab%2Fahkab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkab%2Fahkab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahkab","download_url":"https://codeload.github.com/ahkab/ahkab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248632234,"owners_count":21136648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuit-simulation","circuits","linear-time-invariant","nodal-analysis","scipy","spice","sympy"],"created_at":"2024-09-24T14:17:51.146Z","updated_at":"2025-04-12T21:20:17.807Z","avatar_url":"https://github.com/ahkab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://rawgithub.com/ahkab/ahkab/master/doc/images/logo_small.png\" alt=\"Monkeying around\" style=\"width: 80px;\"/\u003e ahkab\n=================================================================================================================================\n\n**a SPICE-like electronic circuit simulator written in Python**\n\nThe code should be easy to read and modify, the main language is Python -- 2 or 3 -- and it is platform-independent.\n\nNews\n-----\n\n-   It's with a heavy heart that I write that @ggventurini passed away on September 15th, 2015, at the age of thirty-two. He will be remembered fondly as a friendly and helpful engineer, always excited about his work at CERN and his numerous labors to improve the accessibility of tools for science, research, and development. \n-   Ahkab v0.18 was released on July 12 2015, including new features, bugfixes and improved documentation. It is recommended to upgrade. Check out [the release notes](https://github.com/ahkab/ahkab/releases/tag/v0.18) for more!\n-   The whole codebase has been going through a (yet incomplete) refactoring and documenting effort. The [new documentation is available on RTD](http://ahkab.readthedocs.org/en/latest/).\n\nIf you are interested in the project or the technology, have an issue with an example, or you would like to contribute by requesting, refactoring or documenting a particular feature, please reach out to us on GitHub!\n\n[![Build Status](https://travis-ci.org/ahkab/ahkab.png?branch=master)](https://travis-ci.org/ahkab/ahkab) [![Coverage Status](https://coveralls.io/repos/ahkab/ahkab/badge.png?branch=master)](https://coveralls.io/r/ahkab/ahkab?branch=master) [![PyPi version](http://img.shields.io/badge/version-0.18-brightgreen.png)](https://pypi.python.org/pypi/ahkab/) [![GPLv2 license](http://img.shields.io/badge/license-GPL%20v2-brightgreen.png)](https://raw.githubusercontent.com/ahkab/ahkab/master/LICENSE)\n[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.19967.svg)](http://dx.doi.org/10.5281/zenodo.19967)\n\nSupported simulations:\n----------------------\n\n-   Numeric:\n    -   **Operating point**, with guess computation to speed up the solution. See example: [Downscaling current mirror](https://ahkab.readthedocs.org/en/latest/examples/OP_simulation.html)\n    -   **DC sweep**\n    -   **Transient analysis**, available differentiation formulas: implicit Euler, trapezoidal, gear orders from 2 to 5. See for example the [simulation of a Colpitts Oscillator](https://ahkab.readthedocs.org/en/latest/examples/Transient-Example.html).\n    -   **AC analysis**\n    -   **PZ** analysis\n    -   **Periodic steady state analysis** of non-autonomous circuits, *time* *domain* shooting and brute-force algorithms.\n-   Symbolic:\n    -   **Small signal analysis**, AC or DC, with extraction of transfer functions, DC gain, poles and zeros. Various [symbolic analysis examples on this page](https://ahkab.readthedocs.org/en/latest/examples/Symbolic-simulation.html).\n\nThe results are saved to disk, plotted or printed to stdout and can be read/processed by the most common tools (eg. [Octave](http://www.gnu.org/software/octave/), [gnuplot](http://www.gnuplot.info/), [Matlab](http://www.mathworks.com/products/matlab/), [gwave](http://www.telltronics.org/software/gwave/) and others)\n\nInstall\n-------\n\nThe program requires:\n\n-   the Python interpreter version 2 or 3 (at least v.2.6 for Python2, v.3.3 for Python3),\n-   numpy\u003e=1.7.0, scipy\u003e=0.14.0, sympy\u003e=0.7.6 and tabulate\u003e=0.7.3.\n\nMatplotlib is strongly recommended and no plotting will work without.\n\nIf you need more information about the dependencies, check the [Install notes](https://ahkab.readthedocs.org/en/latest/help/Install-Notes.html).\n\nUsage\n-----\n\n### 1. `ahkab` can be run as a Python library\n\n\u003cimg src=\"https://rawgithub.com/ahkab/ahkab/master/doc/images/readme_example/pbf.svg\" alt=\"Example schematic: a 5th order 1kHz band-pass Butterworth filter\"/\u003e\n\n```python\nfrom ahkab import new_ac, run\nfrom ahkab.circuit import Circuit\nfrom ahkab.plotting import plot_results # calls matplotlib for you\nimport numpy as np\n\n# Define the circuit\ncir = Circuit('Butterworth 1kHz band-pass filter')\ncir.add_vsource('V1', 'n1', cir.gnd, dc_value=0., ac_value=1.)\ncir.add_resistor('R1', 'n1', 'n2', 50.)\ncir.add_inductor('L1', 'n2', 'n3', 0.245894)\ncir.add_capacitor('C1', 'n3', 'n4', 1.03013e-07)\ncir.add_inductor('L2', 'n4', cir.gnd, 9.83652e-05)\ncir.add_capacitor('C2', 'n4', cir.gnd, 0.000257513)\ncir.add_inductor('L3', 'n4', 'n5', 0.795775)\ncir.add_capacitor('C3', 'n5', 'n6', 3.1831e-08)\ncir.add_inductor('L4', 'n6', cir.gnd, 9.83652e-05)\ncir.add_capacitor('C4', 'n6', cir.gnd, 0.000257513)\ncir.add_capacitor('C5', 'n7', 'n8', 1.03013e-07)\ncir.add_inductor('L5', 'n6', 'n7', 0.245894)\ncir.add_resistor('R2', 'n8', cir.gnd, 50.)\n\n# Define the analysis\nac1 = new_ac(.97e3, 1.03e3, 1e2, x0=None)\n\n# run it\nres = run(cir, ac1)\n\n# plot the results\nplot_results('5th order 1kHz Butterworth filter', [('|Vn8|',\"\")], res['ac'],\n             outfilename='bpf_transfer_fn.png')\n```\n\n\u003cimg src=\"https://rawgithub.com/ahkab/ahkab/master/doc/images/readme_example/bpf_results.svg\" alt=\"Example: AC simulation results\"/\u003e\n\n#### 2. `ahkab` can be run from the command line with a netlist file\n\nThe syntax is:\n\n    `$ python ahkab -o graph.dat \u003cnetlist file\u003e`\n\nSee `ahkab --help` for command line switches, [also online on the documentation pages.](http://ahkab.readthedocs.org/en/latest/help/Command-Line-Help.html)\n\n### Documentation\n\nThe [documentation is available on RTD](http://ahkab.readthedocs.org/en/latest/).\n\nThere, you can find a [documentation](http://ahkab.readthedocs.org/en/latest/ahkab.html) and [examples](http://ahkab.readthedocs.org/en/latest/examples/Python_API.html) regarding how to simulate from a Python script.\n\nRefer to the [netlist syntax page](http://ahkab.readthedocs.org/en/latest/help/Netlist-Syntax.html) if you prefer to write netlist files that describe the circuit.\n\nExperience with running SPICE or related commercial simulators can be very useful: this is not for the faint of heart.\n\n### Development model\n\n-   The development happens on the [github repository](https://github.com/ahkab/ahkab),\n-   Mostly on the master branch, with feature branch being created only for special purposes or non-trivial features.\n-   Snapshots are released on a (hopefully) regular basis and are available on the [Releases pages](https://github.com/ahkab/ahkab/releases), complete with changelog, and on [PYPI](https://pypi.python.org/pypi/ahkab/).\n\nPatches and pull requests are welcome!\n\n### How this project was born\n\nWrites @ggventurini:\n\n\"This project was born when I was an enthusistic undergrad, apparently with plenty of free time, attending \"Simulazione Circuitale\" (*Circuit Simulation*) taught by [Prof. A. Brambilla](http://brambilla.dei.polimi.it/) back in Italy at the Polytechnic University of Milan.\n\nI am grateful to prof. Brambilla for teaching one of the most interesting courses of my university years. -GV\"\n\n### Bugs and patches\n\nDoes it work? Bugs? Do you have patches? Did you run some noteworthy simulation? Let us know on GitHub! You can also reach the maintainer at @itdaniher @gmail.com, he's happy to talk about Python.\n\n### Support the development with a donation\n\nIf you wish to support the development of `ahkab`, ***please donate to cancer research:***\n\n-   [Association for International Cancer Research (eng)](http://www.aicr.org.uk/donate.aspx),\n\nor\n\n-   [Fond. IRCCS Istituto Nazionale dei Tumori (it)](http://www.istitutotumori.mi.it/modules.php?name=Content\u0026pa=showpage\u0026pid=24).\n\n### Credits\n\n**Authors:** [Giuseppe Venturini](https://github.com/ggventurini), with contributions from [Ian Daniher](https://github.com/itdaniher), [Rob Crowther](https://github.com/weilawei), and [KOLANICH](https://github.com/KOLANICH).\n\n**Maintainer:** [Ian Daniher](https://github.com/itdaniher)\n\n**Code:** the module `py3compat.py` is (c) 2013 - the Jinja team.\n\n**Dependencies:** many thanks to the authors of `numpy`, `scipy`, `sympy`, ``matplotlib`` and ``tabulate``!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahkab%2Fahkab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahkab%2Fahkab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahkab%2Fahkab/lists"}