Skip to main content

Interactive PySide6 + manim demonstration of how an ADC works

Project description

cicadc

An interactive desktop program that demonstrates how an analog-to-digital converter (ADC) works. It shows two side-by-side panels rendered with manim inside a PySide6 window:

  • Left panel (analog) - the analog signal drawn as a path that scrolls past "now" (the middle line), with the future at the top and the past at the bottom. Optional noise is added. A blue car drives along the signal and turns to follow the path; a translucent gray "shadow" car marks the quantized value.
  • Right panel (digital) - the digital signal as a sample-and-hold staircase. Gray is the unfiltered (raw) quantizer output and green is the optional moving-average filtered output (normalised to unity gain at the signal frequency). A green car follows the filtered output, trailing by the filter's group delay so it lands back on the analog curve (delay-compensated).

Project layout

src/cicadc/          package (src layout, mirrors cicwave)
  cli.py             click console entry point (`cicadc`)
  app.py             QApplication bootstrap
  main_window.py     PySide6 window + controls
  manim_scene.py     offscreen manim renderer
  signal_source.py   analog signal model (sinusoid + noise)
  quantizer.py       N-bit quantizer
  render_widget.py   Qt widget + animation loop
  assets/car.png     car sprite
tests/unittests/     unittest suite

Requirements

  • Python 3.9-3.13 (manim does not yet support 3.14). A python3.12 venv is used by the setup steps below.
  • A working manim install (Cairo backend). On macOS you may need the system libraries pkg-config cairo pango via Homebrew if the wheels do not cover your platform.

Setup

python3.12 -m venv .venv
source .venv/bin/activate
pip install -e .          # or: pip install -r requirements.txt

make dev-install runs the editable install for you.

Run

cicadc                   # installed console script
# or, from a checkout without installing:
python main.py

Controls

  • Frequency / Amplitude - the input sinusoid (amplitude is a fraction of full scale).
  • Speed - how fast the signal scrolls past "now".
  • Bits - resolution of the quantizer.
  • Sample period - the ADC sample clock interval.
  • Noise - additive analog noise amplitude.
  • Avg - moving-average filter length on the digital output (1 = off).
  • Play / Pause - start or stop the animation.

Development

make test     # run unit tests
make check    # import and print version
make lint     # ruff (if installed)
make build    # build wheel + sdist

Acknowledgements

Big thanks to Domen Visnar for the idea behind this project!

Status

Single/− sinusoid input, adjustable bit depth, noise, and a normalised moving-average filter with delay compensation are implemented. Random / multi-sinusoid inputs and a configurable bandwidth filter are planned follow-ups.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cicadc-0.1.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cicadc-0.1.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file cicadc-0.1.0.tar.gz.

File metadata

  • Download URL: cicadc-0.1.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cicadc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2bbc4ecbcbe785956d6bce9688c745d876ede8ca82d29e2db100fcb75eef81d5
MD5 c0d89045822631d82fed543d195b9eb1
BLAKE2b-256 e2f7269e1ec5b536b26a1799ecaf1d12abe886e0ab30134d7e841cbea1541963

See more details on using hashes here.

File details

Details for the file cicadc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cicadc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cicadc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 413813f0e6da1295e017d30e825c2f591471f0424de6df5594edbf29631b5e17
MD5 ddc85b61785139f07717ee917ee36d43
BLAKE2b-256 6bf2ff70e6923cb65db05a7b995fda2dad0612cf3c666aad53ce0f09de06b09f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page