Skip to main content

A Python package for visualizing SPICE simulation waveforms in Jupyter notebooks

Project description

Wave View

License: MIT Python 3.8+

A Python package for visualizing SPICE simulation waveforms with interactive Plotly-based plotting, designed for seamless integration with Jupyter notebooks.

Demo

โœจ Features

  • ๐Ÿ“Š Interactive Plotly Visualization: Modern, web-based plots with zoom, pan, and hover
  • ๐Ÿ”ง Simple API: Plot waveforms with a single function call
  • โš™๏ธ YAML Configuration: Flexible, reusable plotting configurations
  • ๐Ÿ”ค Case-Insensitive Signal Access: Access signals regardless of case (V(VDD) = v(vdd))
  • ๐Ÿงฎ Processed Signals: Generate derived signals with lambda functions
  • ๐Ÿ““ Jupyter-First Design: Auto-detection and inline plotting
  • ๐ŸŽ›๏ธ Advanced Plotting: Full control with SpicePlotter class
  • ๐Ÿ“‹ Template Generation: Auto-create configurations from SPICE files

๐Ÿš€ Quick Start

Installation

Option 1: Install from PyPI (Coming Soon)

pip install wave_view

Option 2: Install from GitHub (Latest)

# Install latest version directly from GitHub
pip install git+https://github.com/jianxun/wave_view.git

# Or install a specific branch/tag
pip install git+https://github.com/jianxun/wave_view.git@main
pip install git+https://github.com/jianxun/wave_view.git@v0.1.0

Option 3: Development Installation

# Clone the repository
git clone https://github.com/jianxun/wave_view.git
cd wave_view

# Create and activate virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode (editable install)
pip install -e .

# Install development dependencies (optional)
pip install -r requirements-dev.txt

Verify Installation

python -c "import wave_view as wv; print(f'Wave View {wv.__version__} installed successfully!')"

Basic Usage

import wave_view as wv

# Simple plotting - just provide a SPICE file
fig = wv.plot("simulation.raw")

# With configuration file
fig = wv.plot("simulation.raw", "config.yaml")

# Direct configuration  
config = wv.config_from_yaml("""
title: "Voltage Analysis"
X:
  signal_key: "time"
  label: "Time (s)"
Y:
  - label: "Voltage (V)"
    signals:
      VDD: "v(vdd)"
      OUT: "v(vout)"
      IN: "v(vin)"
""")
fig = wv.plot("simulation.raw", config)

Advanced Usage

import wave_view as wv

# Load SPICE data
data = wv.load_spice("simulation.raw")
print(f"Found {len(data.signals)} signals")

# Advanced plotting with SpicePlotter
plotter = wv.SpicePlotter("simulation.raw")

# Add processed signals
plotter.add_processed_signal("power", lambda d: d["v(vdd)"] * d["i(vdd)"])

# Load configuration and plot
plotter.load_config("plot_config.yaml")
fig = plotter.create_figure()

๐Ÿ“– Documentation

Configuration Format

Wave View uses YAML configuration files for flexible plotting:

title: "Voltage Analysis"
X:
  signal_key: "time"
  label: "Time (s)"
Y:
  - label: "Supply Voltages (V)"
    signals:
      VDD: "v(vdd)"
      VSS: "v(vss)"
  - label: "Signal Voltages (V)"
    signals:
      OUT: "v(vout)"
      IN: "v(vin)"

Configuration Validation

Validate your configurations before plotting:

# Validate configuration
config = wv.config_from_yaml("""
title: "My Plot"
X:
  signal_key: "time"
Y:
  - signals:
      OUT: "v(out)"
""")
warnings = wv.validate_config(config)
if warnings:
    print("Warnings:", warnings)

Jupyter Integration

Wave View automatically detects Jupyter environments and displays plots inline:

# In Jupyter notebook - displays automatically
wv.plot("simulation.raw")

# Manual renderer control
wv.set_renderer("notebook")  # or "browser", "png", etc.

๐Ÿ“ Examples

The examples/ directory contains:

  • examples/scripts/: Python script examples
  • examples/notebooks/: Jupyter notebook tutorials
  • examples/data/: Sample SPICE files for testing

๐Ÿ› ๏ธ Development

Setup Development Environment

# Clone the repository
git clone https://github.com/your-username/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/test_basic.py -v

Code Quality

# Format code
black src/ tests/

# Sort imports
isort src/ tests/

# Lint code
flake8 src/ tests/

# Type checking
mypy src/

๐Ÿ—๏ธ Project Structure

wave_view/
โ”œโ”€โ”€ src/wave_view/           # Main package
โ”‚   โ”œโ”€โ”€ core/               # Core functionality
โ”‚   โ”‚   โ”œโ”€โ”€ reader.py       # SPICE file reading
โ”‚   โ”‚   โ”œโ”€โ”€ config.py       # Configuration handling
โ”‚   โ”‚   โ””โ”€โ”€ plotter.py      # Plotting logic
โ”‚   โ”œโ”€โ”€ utils/              # Utility functions
โ”‚   โ””โ”€โ”€ api.py              # Main API
โ”œโ”€โ”€ tests/                  # Test suite
โ”œโ”€โ”€ examples/               # Usage examples
โ”œโ”€โ”€ docs/                   # Documentation
โ””โ”€โ”€ pyproject.toml          # Package configuration

๐Ÿ“‹ 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)

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass (pytest)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. 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

๐Ÿท๏ธ Version

Current version: 0.1.0 (Alpha)


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

wave_view-0.1.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

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

wave_view-0.1.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wave_view-0.1.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wave_view-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c1907e6b45acbff27e7646445c82666e4af20ffacc4845d24b3c5f3f550737bd
MD5 05dfc938d78dadc63ffecb7a0ae1a732
BLAKE2b-256 c2136e0964a6d272e35adab0c1197ae3c4c0c933c52029e7f7bc247e8f9f056b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wave_view-0.1.0.tar.gz:

Publisher: publish.yml on Jianxun/wave_view

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: wave_view-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wave_view-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f04777fef6252f9f906ad028186379f879a1e8a9fc78d630d299d97f3debdbd3
MD5 6c3086c6c2edf8bfc42baf0e08358efe
BLAKE2b-256 d648d8359003dd2e59820227bf070b61c98a27344c946ed8777341f66f1c30ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for wave_view-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Jianxun/wave_view

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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