A Python application for visualizing and analyzing multiple waveforms in real-time with envelope analysis capabilities.
-
Activate the virtual environment:
# Windows env\Scripts\activate
-
Install dependencies (if not already done):
pip install -r requirements.txt
python main.pyOr with the virtual environment:
env\Scripts\python.exe main.py-
Launch the application - The app starts with one default waveform using values from
default.cfg -
Adjust waveform parameters:
- Use the Frequency input to change the wave frequency (0.1-100 Hz)
- Use the Amplitude input to adjust the wave amplitude (0-10)
- Use the Offset input to adjust the Y-axis offset (0-10)
- For Square waves, use the Duty Cycle input (1-100%)
-
Change waveform type:
- Use the Type dropdown to select: Sine, Square, Sawtooth, or Triangle
-
Add more waveforms:
- Click + Add Waveform button (max 5 waveforms)
- Each waveform gets a unique color automatically
-
Manage waveforms:
- Click on a waveform in the list to select and edit it
- Click the ON/OFF button to show/hide a waveform
- Click the X button to remove a waveform (minimum 1 required)
- Right-click a waveform button to rename it or change its color (custom names appear in the plot legend and CSV export)
When you have 2 or more enabled waveforms:
- Show Max Envelope - Displays the maximum amplitude at each time point (green glowing line)
- Show Min Envelope - Displays the minimum amplitude at each time point (red glowing line)
- Show RMS Envelope - Displays the root-mean-square across all enabled waveforms (orange glowing line)
- Peak-to-Peak Fill - When both Max and Min envelopes are enabled, a cyan shaded region fills the area between them
All envelopes can be enabled simultaneously. Source waveforms are automatically hidden when envelopes are shown.
Measurement cursors are always active — no toggle needed:
- Move the mouse over the plot — a live cursor line tracks the mouse position
- Hover near a waveform or envelope line — the cursor color matches the nearest line and a highlight dot appears at the intersection
- Left-click on the plot to pin a reference cursor (dashed gray line) for comparison
Each waveform has the following adjustable parameters:
- Type - Waveform type (Sine, Square, Sawtooth, Triangle)
- Wave Duration - Adjusts the time window for visualization (0.5-120 seconds)
- Frequency - Wave frequency in Hz (0.1-100 Hz)
- Amplitude - Wave amplitude (0-10)
- Offset - Y-axis offset (0-10)
- Duty Cycle - For Square waves only (1-100%)
Default settings are stored in default.cfg (INI format) alongside the application. You can edit this file directly or use the built-in Configure dialog:
- Open File → Configure...
- Adjust settings in three sections:
- Global — Wave duration default
- Waveform — Type, frequency, amplitude, offset, duty cycle (applied on next launch)
- Display — Y-axis title, Y-axis min/max (applied immediately)
- Click Save to persist changes to
default.cfg
Note: Display settings (Y-axis title and range) take effect immediately. Waveform settings apply the next time the application is launched.
Switch between dark and light mode via File → Toggle Theme. The theme choice persists across sessions in default.cfg.
Move the plot to a separate window for multi-monitor setups or flexible workspace layouts:
- Detach: Click File → Detach Plot to move the plot to a separate 800×600 resizable window
- Use: The detached window includes pan/zoom navigation and responds immediately to parameter changes in the main window
- Re-attach: Close the detached window, click the "Re-attach Plot" button in the main window placeholder, or use File → Attach Plot
All interactive features (cursors, envelopes, pan/zoom) work identically in both attached and detached modes.
- Click Export to CSV (button exports to any supported format)
- A native file dialog will open — choose format from the file type dropdown:
- CSV (.csv) — time + amplitude columns with metadata comments
- MATLAB (.mat) — named variables per waveform/envelope
- JSON (.json) — structured document with parameters and data arrays
- Exported data includes:
- All enabled waveforms
- Active envelopes (if enabled)
- Metadata (waveform type, frequency, amplitude, etc.)
- 4 Waveform Types: Sine, Square, Sawtooth, Triangle
- Up to 5 simultaneous waveforms
- Custom waveform naming and colors via right-click context menu
- Real-time visualization with responsive performance
- Envelope analysis with glowing Max/Min/RMS envelope lines and Peak-to-Peak fill
- Live measurement cursors with real-time tracking, proximity highlight, and pinned reference
- Auto-hide source waveforms when envelopes are enabled
- Detachable plot window for multi-monitor setups (File → Detach Plot)
- Multi-format export (CSV, MATLAB .mat, JSON) with native OS file dialog
- Independent waveform control
- Configurable defaults via File → Configure... dialog and
default.cfg - Help menu with About dialog (version, author info)
- Modern Windows 11 UI with CustomTkinter
- Dark/Light theme toggle via File → Toggle Theme (persists across sessions)
waveform_analyzer/
├── main.py # Application entry point
├── app_state.py # State management
├── waveform_generator.py # Waveform generation functions
├── ui_components.py # UI and callbacks
├── data_export.py # CSV export functionality
├── config.py # Configuration loader/saver
├── winui_theme.json # WinUI/Windows 11 color theme for CustomTkinter
├── test_waveform_analyzer.py # Automated pre-commit tests (106 tests)
├── default.cfg # User-editable default settings (INI format)
├── icon.ico # Application icon
├── requirements.txt # Python dependencies
├── README.md # This file
└── docs/ # Sphinx documentation source
├── conf.py # Sphinx configuration
├── index.rst # Documentation landing page
├── make.bat # Windows build script
├── Makefile # Linux/macOS build script
└── *.rst # Per-module API reference pages
- Python 3.11 or higher
- Windows/Linux/macOS
- Minimum resolution: 1000x800 (recommended: 1200x900)
- CustomTkinter >= 5.2.0 - Modern GUI framework
- CTkMenuBar >= 0.9 - Dark-themed menu bar for CustomTkinter
- matplotlib >= 3.8.0 - Plotting library
- NumPy >= 1.24.0 - Numerical computing
- SciPy >= 1.11.0 - Signal processing
- Target frame rate: >30 FPS
- Plot update latency: <100ms
- Memory usage: <200MB
- Startup time: <2 seconds
Run the automated test suite (requires pytest):
pip install pytest
python -m pytest test_waveform_analyzer.py -vThe 106 tests cover all pre-commit checklist items: wave types, edge cases, duty cycle, durations, envelope calculations, enabled/disabled state, CSV export, waveform limits, error handling, and performance SLAs.
API documentation is auto-generated from source code docstrings using Sphinx.
pip install sphinx sphinx-rtd-theme
cd docs
make.bat htmlThe generated HTML will be in build/sphinx/html/. Open build/sphinx/html/index.html to browse.
- Use +/- buttons for fine control of parameters
- Click and drag on the plot to pan
- Scroll to zoom in/out on the plot
Application won't start:
- Ensure Python 3.11+ is installed:
python --version - Verify dependencies are installed:
pip list - Activate virtual environment first
Performance issues:
- Reduce the number of visible waveforms
- Decrease the wave duration
- Disable envelopes if not needed
Export fails:
- Check file path permissions
- Ensure filename doesn't contain invalid characters
- The app will auto-correct the filename and add
.csvif needed
Current version: 2.0.0
- ✨ Detachable Plot Window - Move the plot to a separate window for multi-monitor workflows
- 🎯 All existing features from v1.x (envelopes, cursors, themes, export formats, custom colors)