A Python package for visualizing SPICE simulation waveforms in Jupyter notebooks
Project description
Wave View: A Python Toolkit for SPICE Simulation Waveform Visualization
Wave View is a lightweight yet powerful Python toolkit that transforms raw SPICE .raw files into beautiful, interactive Plotly figures with minimal code. It reads simulation traces straight into a plain {signal_name: np.ndarray} dictionary, lets you define multi-axis plots declaratively via YAML (or override them on the command line), and automatically selects the best renderer whether you are in a Jupyter notebook, VS Code, or a headless CI job. Case-insensitive signal lookup, engineering-notation tick labels, and first-class multi-strip support help you focus on circuit analysis rather than plotting boilerplate.
Features
- Interactive Plotly Visualization: Modern, web-based plots with zoom, pan, and hover
- YAML Configuration: Flexible, reusable plotting configurations
- Simple API: Plot waveforms with a single function call
- Command Line Interface: Quick plotting from terminal with
waveview plot - Automatic Environment Detection: Auto-detection and inline plotting for Jupyter Notebooks, render in browser when running in standalone Python scripts.
Quick Start
Installation
pip install wave_view
Wave View provides two common workflows for visualizing your SPICE simulations:
- Option A: CLI-First – The fastest way to get from a
.rawfile to an interactive plot. Perfect for quick, one-off visualizations. - Option B: Python API – The most flexible approach. Ideal for scripting, custom data processing, and embedding plots in notebooks or reports.
Option A: CLI-First Workflow
Get from a raw file to a plot in three steps using the waveview command-line tool.
Step 1: Generate a Plot Specification
Use waveview init to create a template spec.yaml file from your simulation output. It automatically populates the file with the independent variable (like "time") and a few available signals.
waveview init your_simulation.raw > spec.yaml
Step 2: Discover Signals
Find the exact names of the signals you want to plot with waveview signals.
# List the first 10 signals
waveview signals your_simulation.raw
# List all signals
waveview signals your_simulation.raw --all
# Filter signals using a regular expression
waveview signals your_simulation.raw --grep "clk"
Step 3: Plot
Edit your spec.yaml to include the signals you discovered, then use waveview plot to generate an interactive HTML file or display the plot directly. The command now supports a self-contained workflow where the raw file is specified directly in the YAML.
# This command will open a browser window with your plot
waveview plot spec.yaml
# You can also override the raw file specified in the YAML
waveview plot spec.yaml your_simulation.raw
# To save the plot to a file instead
waveview plot spec.yaml --output my_plot.html
This approach is fast, requires no Python code, and keeps your plot configuration version-controlled alongside your simulation files.
Option B: Python API Workflow
For more advanced use cases, the Python API provides full control over data loading, processing, and plotting. This is ideal for Jupyter notebooks, custom analysis scripts, and automated report generation.
The API follows a clear three-step workflow:
- Data Loading – Load the raw
.rawfile withwave_view.load_spice_raw. - Configuration – Describe what you want to see using
wave_view.PlotSpec. - Plotting – Call
wave_view.plotto get a Plotly figure.
Minimal Example
import wave_view as wv
# 1. Load data from a .raw file
data, _ = wv.load_spice_raw("your_simulation.raw")
print(f"Signals available: {list(data.keys())[:5]}...")
# 2. Configure the plot using a YAML string
spec = wv.PlotSpec.from_yaml("""
title: "My Simulation Results"
x:
signal: "time"
label: "Time (s)"
y:
- label: "Voltage (V)"
signals:
Output: "v(out)"
Input: "v(in)"
""")
# 3. Create and display the plot
fig = wv.plot(data, spec)
fig.show()
Advanced Example: Plotting Derived Signals
Because the API gives you direct access to the data as NumPy arrays, you can easily perform calculations and plot the results.
import numpy as np
import wave_view as wv
# Load the data
data, _ = wv.load_spice_raw("your_simulation.raw")
# Calculate a new, derived signal
data["diff_voltage"] = data["v(out_p)"] - data["v(out_n)"]
# Create a spec that plots both raw and derived signals
spec = wv.PlotSpec.from_yaml("""
title: "Differential Output Voltage"
x:
signal: "time"
label: "Time (s)"
y:
- label: "Voltage (V)"
signals:
VOUT_P: "v(out_p)"
VOUT_N: "v(out_n)"
VOUT_DIFF: "diff_voltage"
""")
# Create and display the plot
fig = wv.plot(data, spec)
fig.show()
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/Jianxun/wave_view.git
cd wave_view
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode with all dependencies
pip install -e .
pip install -r requirements-dev.txt
# Verify development setup
python -c "import wave_view as wv; print('Development setup complete!')"
Run Tests
# Run all tests
pytest
# With coverage
pytest --cov=wave_view --cov-report=html
# Run specific test file
pytest tests/workflows/test_cli_plot.py -v
Project Structure
wave_view/
├── src/wave_view/
│ ├── core/
│ │ ├── plotspec.py # PlotSpec model
│ │ ├── plotting.py # Plotting helpers + plot()
│ │ └── wavedataset.py # WaveDataset + low-level loaders
│ ├── loader.py # load_spice_raw convenience wrapper
│ ├── cli.py # Command-line interface
│ └── __init__.py # Public symbols (plot, PlotSpec, load_spice_raw,...)
├── tests/ # Test suite
├── examples/ # Usage examples
├── docs/ # Documentation
└── pyproject.toml # Packaging
Requirements
- Python: 3.8+
- Core Dependencies:
plotly>= 5.0.0 (Interactive plotting)numpy>= 1.20.0 (Numerical operations)PyYAML>= 6.0 (Configuration files)spicelib>= 1.0.0 (SPICE file reading)click>= 8.0.0 (Command line interface)
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Documentation
Comprehensive documentation is available with:
- User Guides: Installation, quickstart, and configuration
- API Reference: Complete function documentation
- Examples: Practical use cases and tutorials
- Development: Contributing guidelines and setup
Build Documentation Locally
# Install documentation dependencies
pip install -e ".[docs]"
# Build documentation
make docs
# Serve documentation locally
make docs-serve # Opens at http://localhost:8000
Links
- Documentation: Read the Docs
- PyPI Package: PyPI
- Issue Tracker: GitHub Issues
- Changelog: CHANGELOG.md
Version
Current version: 1.1.0
Wave View - Making SPICE waveform visualization simple and interactive! 🌊📈
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wave_view-1.1.0.tar.gz.
File metadata
- Download URL: wave_view-1.1.0.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa482396e4e715bd9fef9118f34a432f8ce984119483d6ea140214020e562ab2
|
|
| MD5 |
b41e4da962b75b778e4c0a982abae5cc
|
|
| BLAKE2b-256 |
62d7a140d4119221cb704a3545e0806fbec5b147fdab7017ca69de681d7ce354
|
File details
Details for the file wave_view-1.1.0-py3-none-any.whl.
File metadata
- Download URL: wave_view-1.1.0-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf4faad0061d4fae6502407c685310c5f1829ddb5d6736745ca41a4b62790b7f
|
|
| MD5 |
64494920d46f431d8f6cf1ae64ed708f
|
|
| BLAKE2b-256 |
95f21b31c23e1bf9f7e08aac1521a9f80e247288fdb3adf5d97be20b46fc708a
|