PyAMS BETA

Python for Analog and Mixed Signals

Draw a circuit, simulate it and look at the waveforms, or write it in Python. DC, transient and AC analyses with custom models.

  • PyAMS software: schematic capture, symbol design and waveform viewer
  • Custom models written as plain Python classes
  • 90+ ready-made models, from resistors to MOSFETs, op-amps and logic gates

Free and open source (MIT) · Python 3.8+ · Linux, Windows, macOS

Download PyAMS software Documentation

Prefer VS Code or plain Python scripts? See other ways to use PyAMS.

Beta: the core is stable and tested on many circuits, but some features may still change. Feedback is highly appreciated!

What is PyAMS?

PyAMS (Python for Analog and Mixed Signals) is an open-source tool for modeling and simulating analog and mixed-signal electronic circuits. It is built around the pyams-lib library, which solves circuits by modified nodal analysis and Newton–Raphson, so you only describe what each element does.

Connect ready-made or custom elements by node names, run a DC, transient or AC analysis, sweep any parameter, and plot or post-process the results — all in plain Python.

Two ways to use PyAMS
As a Python library

Install pyams-lib with pip and write your circuits as Python scripts.

Inside the CAD system

Use the PyAMS application or the VS Code extension for schematics, symbols and a waveform viewer. The library is already included.

90+
ready-made models
30+
circuit examples
3
analyses: DC, tran, AC
MIT
free and open source

Features

DC, Transient and AC

Operating point, DC sweeps, time-domain simulation and small-signal frequency response.

Custom Modeling

Write a new element as a Python class: declare signals and parameters, then write the equations.

90+ Ready Models

Passive elements, sources, diodes, thyristors, transistors, op-amp, 555 timer, logic gates, counters and ADC/DAC.

Parametric Sweep

Repeat any analysis for a list of parameter values and overlay the curves.

Robust Solver

Adaptive time step, second-order integration and automatic convergence aids for switching circuits.

Plots and Results

Built-in Matplotlib plots, or NumPy arrays for your own post-processing. Interactive Plotly viewer in the CAD system.

Cross-platform

Pure Python 3 on Linux, Windows and macOS (CPython and PyPy). Only NumPy and Matplotlib are needed.

Documented

A page for every model and 40 ready-to-run circuit examples with their results.

Free and Open Source

Distributed under the MIT license.

PyAMS software

PyAMS is a CAD system for designing and simulating circuits graphically: a complete, dedicated application, built on the PyAMS Python library.

Download PyAMS software
Draw the schematic, with your notes and formulas next to it.
Run the analysis with the progress log.
Start page with recent files and examples.
Write your models in the software

Right-click a symbol and choose Open Python Model: its Python file opens in a built-in editor window. No other program is needed.

  • Errors while you type. Syntax errors and undefined names are underlined and listed at the bottom.
  • One window, one tab per model. Find and replace, go to line, comment, auto-indent.
  • New model in one click. Pick an analog, digital or blank template; the file is created in your project and set as the model of the symbol.
The model editor: an undefined name is underlined and listed.
What the software does
Schematic capture
Draw the circuit and connect the elements.
Symbol design
Create symbols for the elements, including your own models.
Simulation
DC, transient and AC analyses with the pyams library.
Waveform viewer
Interactive Plotly viewer for the results.
Tabs
Several circuits and symbols open at once, each with its own undo history.
Project folder
Symbols and models next to your circuit are found automatically.
Operating point and live runs
Check DC values quickly, or run a live simulation.
Examples
Over 30 ready circuits to open from the start page.

The pyams library is already included: you only need Python with numpy and matplotlib.

Quick start

From an idea to a simulation in three steps: write the model, draw its symbol, then use it in a circuit.

1

Write the model

A model is a plain Python class: declare its signals and parameters, then write the equation of the element in analog().

Here, a diode: its current follows the Shockley equation. Write it in the built-in editor (Tools > New Python Model...), which checks your code as you type.

2

Draw the symbol

In the symbol editor draw the shape, place the pins, set the reference (D) and link the symbol to your model by its name, MyDiode, and its file.

Save the symbol next to your circuit: it is found automatically.

3

Simulate the circuit

Place the symbol in the schematic, connect it to the other elements, add an analysis block and run it: DC, transient or AC. The waveforms appear in the viewer, right in the drawing.

Example: a half-wave rectifier, with a 50 Hz source, a diode, a capacitor and a load.

Prefer a script?

The same circuit with the Python library, without the CAD system. Choose the analysis with analysis(mode="dc"), analysis(mode="tran", ...) or analysis(mode="ac", ...), and sweep any parameter with sweep(param="R1.R", list=[...]).

from pyams.lib import circuit
from pyams.models import Resistor, SinVoltage, Diode

V1 = SinVoltage("In", "0");  V1.setParams("Va=10V Fr=2Hz")
D1 = Diode("In", "Out")
R1 = Resistor("Out", "0");  R1.setParams("R=1KΩ")

cir = circuit()
cir.addElements({"V1": V1, "D1": D1, "R1": R1})
cir.setOutPuts("In", "Out")
cir.analysis(mode="tran", start=0, stop=2, step=0.001)
cir.run()
cir.plot()

Ready-made models

93 models are included in the library, grouped by family. Import any of them from pyams.models, or place them from the CAD system.

Basic elements and controlled sources13
ResistorConductorCapacitorCapacitorIcInductorInductorIcNonlinearResistanceTransformerTransmissionLineVCVSVCCSCCVSCCCS
Laplace transfer functions8
LaplaceNDLaplaceZPLaplaceNDIILaplaceZPIILaplaceNDIVLaplaceZPIVLaplaceNDVILaplaceZPVI
Switches and relays7
SwitchSwitchVSwitchISwitchSPSTSwitchSPDTRelayIdealSwitch
Sources12
DCVoltageSinVoltageACVoltageExpVoltagePWLVoltageTrapezoidVoltageDCCurrentSinCurrentACCurrentExpCurrentPWLCurrentTrapezoidCurrent
Semiconductor13
DiodeLEDDiodeBridgeDiacZenerDiodeTunnelDiodeThyristorUJTBJTMOSFETMOSFET4JFETIGBT
Analog ICs3
OpAmpComparatorTimer555
Digital31
DigitalClockNOTANDORNANDNORXORXNORAND3OR3NAND3NOR3SRLatchDLatchDFFJKFFTFFRegisterLFSRCounterShiftRegisterMultiplexerDemultiplexerDecoderPriorityEncoderMagnitudeComparatorParityGeneratorBinaryToGrayGrayToBinarySevenSegmentDecoderAdder
Mixed-signal (ADC and DAC)6
DACADCDAC_analogADC_analogDAC_clockedADC_clocked
Browse all models in the documentation

Examples

Each example is a circuit that comes with the PyAMS software: the schematic above, the result of its simulation below, exactly as they appear in the editor. Open them from the start page and run them.

Chua's BJT
Transient

Chua's chaotic oscillator with two bipolar transistors: the attractor is drawn as V(y) against V(x).

MOSFET ring oscillator
Transient

Three CMOS inverters in a loop: the three nodes oscillate with a phase shift of one third of a period.

Full-wave bridge rectifier
Transient

Fed by a transformer, with the Diode Bridge symbol, a filter capacitor and a load.

555 timer, astable
Transient

Astable multivibrator: the threshold capacitor charges and discharges between 1/3 and 2/3 of Vcc.

Chua's circuit with op-amps
Transient

A chaotic double-scroll oscillator built with two op-amps.

Chebyshev low-pass filter
AC analysis

5th-order LC ladder, 1 dB ripple, cut-off at 1 kHz.

8-bit ADC and DAC with a bus
Mixed signal

Digital models connected by an 8-line bus: the staircase follows the sine input.

UJT relaxation oscillator
Transient

A sawtooth on the emitter and the pulses on the two bases.

DIAC relaxation oscillator
Transient

The capacitor charges through R1 until the DIAC breaks over, then discharges into R2 as a pulse.

More than 30 circuits are included. Examples written as Python scripts (JFET curves, SCR lamp dimmer, amplifier gain...) are in the documentation.

Publications

Articles published about PyAMS. If you use PyAMS in your work, please cite them.

Installation

Install the PyAMS software in three steps. The pyams library is included.

1
Install the PyAMS software
  1. Download the installer for your system from the Download section.
  2. Run it and follow the instructions.
  3. Start PyAMS and open or create a project.

Simulations need Python 3.8 or higher with numpy and matplotlib. Works on Linux, Windows and macOS.

Download PyAMS software

Other ways to use PyAMS

The software covers most needs. These two options are for people who prefer to work in VS Code or in their own Python scripts.

Install VS Code with the PyAMS extension

The CAD tools inside Visual Studio Code, next to your Python files: draw schematics, design symbols and simulate without leaving the editor.

  1. Install Visual Studio Code.
  2. Open the Extensions view: Ctrl + Shift + X.
  3. Search for PyAMS and click Install.
PyAMS extension
Install the Python library

For your own Python scripts, without the graphical tools.

$ pip install pyams-lib

NumPy and Matplotlib are installed automatically. To upgrade later:

$ pip install --upgrade pyams-lib
pyams-lib on PyPI

The PyAMS software and the VS Code extension already include the pyams library: do not install it with pip alongside them.

Download and links

Download the PyAMS software, and find the documentation and the source code.

PyAMS software
version 0.8.0
Installing on Windows

Run the installer, or unzip the portable version and start PyAMS.exe. If Windows SmartScreen warns about an unknown publisher, click More info, then Run anyway.

Installing on Linux

AppImage: make it executable and start it:

chmod +x PyAMS-*.AppImage && ./PyAMS-*.AppImage

Debian or Ubuntu package:

sudo apt install ./pyams-*.deb

Python with numpy and matplotlib is needed to run simulations. All files are on the SourceForge project page.

Documentation

Modeling, simulation, models and examples.

readthedocs.io Read the docs
Source code

For contributors and tinkerers.

d-fathi/pyams_lib GitHub