Skip to content

Conversation

@X9X0
Copy link
Owner

@X9X0 X9X0 commented Nov 18, 2025

Summary

Implements comprehensive advanced waveform analysis capabilities for professional-grade signal characterization and testing. This feature elevates LabLink's oscilloscope functionality to match high-end test equipment with 7 major analysis categories.

Features Implemented

🔬 Spectral Analysis

  • Spectrogram: Time-frequency analysis using STFT with configurable windows (Hann, Hamming, Blackman)
  • Cross-Correlation: Signal similarity and propagation delay measurement between channels
  • Transfer Function: H(f) = Y(f)/X(f) with magnitude, phase, and coherence analysis

⏱️ Jitter Analysis (5 Types)

  • TIE (Time Interval Error): Cumulative timing error from ideal positions
  • Period Jitter: Variation from mean period
  • Cycle-to-Cycle Jitter: Consecutive period differences (critical for high-speed serial)
  • Half-Period Jitter: Both edge analysis for dual-edge clocks
  • N-Period Jitter: Configurable long-term stability assessment
  • Complete statistics: mean, RMS, peak-to-peak, histograms

👁️ Eye Diagram Analysis

  • Professional eye diagram generation for serial data links
  • 13 measurements: eye height/width, crossing %, RMS/pk-pk jitter, RMS noise, Q-factor, SNR, eye opening %
  • Persistence visualization with 2D histogram
  • Logic level detection and rise/fall time analysis

✅ Mask Testing

  • Polygon-based pass/fail testing with violation tracking
  • Support for normalized and absolute coordinates
  • Margin analysis (min/mean distance to mask boundaries)
  • Per-region failure counts and location reporting

🔍 Waveform Search (6 Event Types)

  • Edges: Rising/falling edge detection
  • Pulses: Positive/negative pulse detection with width filtering
  • Runts: Incomplete pulse detection
  • Glitches: Narrow spike detection using derivative analysis
  • Event statistics and timing analysis

📊 Reference Waveform Comparison

  • Golden unit comparison with configurable tolerances
  • Voltage error analysis (RMS, max, mean)
  • Correlation coefficient and phase shift measurement
  • Similarity percentage and failure point reporting

📈 Parameter Trending

  • Track 13+ parameters over time (frequency, amplitude, jitter, eye metrics, etc.)
  • Drift detection using linear regression
  • Trend direction classification (up/down/stable)
  • Long-term monitoring for aging and predictive maintenance

Implementation Details

New Files (3,250+ lines)

  • server/waveform/advanced_models.py (700+ lines) - Pydantic data models
  • server/waveform/advanced_analysis.py (1,287 lines) - Core analysis algorithms
  • server/api/waveform_advanced.py (650+ lines) - REST API endpoints
  • server/ADVANCED_WAVEFORM_ANALYSIS.md (800+ lines) - User guide

API Endpoints (20+)

Spectral:

  • POST /api/waveform/advanced/spectrogram
  • POST /api/waveform/advanced/cross-correlation
  • POST /api/waveform/advanced/transfer-function

Jitter & Eye:

  • POST /api/waveform/advanced/jitter
  • POST /api/waveform/advanced/eye-diagram

Mask Testing:

  • POST /api/waveform/advanced/mask/define
  • GET /api/waveform/advanced/mask/list
  • POST /api/waveform/advanced/mask/test

Search & Reference:

  • POST /api/waveform/advanced/search
  • POST /api/waveform/advanced/reference/add
  • POST /api/waveform/advanced/reference/compare

Trending:

  • POST /api/waveform/advanced/trend/update
  • GET /api/waveform/advanced/trend/get/{equipment_id}/{channel}/{parameter}

Technology Stack

  • NumPy/SciPy: Efficient signal processing algorithms
  • Pydantic: Request/response validation
  • FastAPI: REST API framework
  • Proper error handling and type hints throughout

Use Cases

  • Serial Data Validation: Eye diagrams, jitter analysis, mask testing for high-speed links
  • System Characterization: Transfer functions, spectrograms for filter/amplifier analysis
  • Quality Control: Reference comparison, mask testing, parameter trending for production
  • Signal Integrity: Comprehensive jitter analysis, eye diagrams, event search for debugging
  • Compliance Testing: Mask testing against industry standards (IEEE, JEDEC, etc.)

Documentation

  • Comprehensive User Guide (800+ lines) with examples, API reference, and best practices
  • Inline API Documentation on all endpoints with use cases and configuration details
  • Updated README with full feature list and documentation links

Testing Notes

This implementation provides the algorithmic foundation and API layer. Integration testing will require:

  • Initialization in main.py to create AdvancedWaveformAnalyzer instance
  • Router registration for /api/waveform/advanced endpoints
  • Waveform manager integration for cached waveform access

Breaking Changes

None - purely additive feature.

Closes

  • Feature: Advanced waveform analysis tools (from "In Development" section)

Implements comprehensive advanced waveform analysis capabilities:

**Spectral Analysis:**
- Spectrogram (time-frequency analysis with STFT)
- Cross-correlation between channels
- Transfer function H(f) = Y(f)/X(f) with coherence

**Jitter Analysis:**
- TIE (Time Interval Error)
- Period jitter
- Cycle-to-cycle jitter
- Half-period jitter
- N-period jitter
- Complete statistics and histograms

**Eye Diagram Analysis:**
- Eye diagram generation for serial data
- Comprehensive measurements (height, width, opening, Q-factor)
- Jitter and noise analysis
- Persistence visualization

**Mask Testing:**
- Polygon mask definitions
- Pass/fail testing with violation tracking
- Margin analysis
- Support for standard and auto-generated masks

**Waveform Search:**
- Rising/falling edge detection
- Positive/negative pulse detection with width filtering
- Runt pulse detection
- Glitch detection
- Event statistics and timing

**Reference Waveform Comparison:**
- Golden unit comparison
- Voltage error analysis (RMS, max, mean)
- Correlation and phase shift
- Configurable tolerances

**Parameter Trending:**
- Long-term parameter tracking
- Drift analysis with linear regression
- Trend direction detection (up/down/stable)
- Multiple parameter support

**New Files:**
- server/waveform/advanced_models.py (700+ lines)
- server/waveform/advanced_analysis.py (1,287 lines)
- server/api/waveform_advanced.py (650+ lines)
- server/ADVANCED_WAVEFORM_ANALYSIS.md (comprehensive documentation)

**API Endpoints:**
- 20+ new REST API endpoints
- Complete request/response models
- Extensive inline documentation

**Documentation:**
- 800+ line user guide with examples
- API reference for all features
- Best practices and troubleshooting

Closes feature: Advanced waveform analysis tools
@X9X0 X9X0 merged commit cda1385 into main Nov 18, 2025
25 checks passed
@X9X0 X9X0 deleted the claude/waveform-analysis-tools-01Eo68MHTxxv8gLqCbtEJu1P branch November 18, 2025 04:23
X9X0 added a commit that referenced this pull request Dec 7, 2025
…ecture

## Summary
Unified version management across all components (server, client, launcher, Docker)
using a single VERSION file as the source of truth. Updated to v1.2.0 to accurately
reflect work completed since v1.0.0 (30+ PRs merged).

## Version System Changes

### Unified to v1.2.0
- Analyzed git history from v1.0.0 through current main
- Determined v1.2.0 accurately represents features and fixes delivered
- All components now read from single VERSION file

### Components Updated
- VERSION file: 0.28.0 → 1.2.0
- README badge: 1.0.1 → 1.2.0
- Server: Now reads VERSION (already implemented)
- Client: Added dynamic VERSION reading at startup
- Launcher: Added __version__ variable from VERSION
- Docker images: Labels updated to 1.2.0
- Copyright: Updated to © 2025 (project start year)

## CHANGELOG Updates

Added comprehensive release notes for missing versions:

### v1.2.0 (2025-12-06)
- Server update system with stable/development modes (#114, #118, #119)
- Smart branch filtering and UI consolidation (#120)
- Enhanced dropdown visibility
- Multiple bug fixes (#105, #106, #108, #121)

### v1.0.1 (2025-11-28)
- Equipment control panel (#104)
- GUI system launcher with diagnostics (#70-74)
- Raspberry Pi image builder (#75-76)
- Waveform analysis tools (#79)
- Automated test sequence builder (#80)
- Remote firmware update (#81)
- Equipment diagnostics system (#84-87)
- WebSocket integration completion (#77)

## Automation & Documentation

### Created scripts/bump_version.py
Automated version bumping tool with:
- Support for major/minor/patch increments
- Automatic VERSION file updates
- CHANGELOG.md section generation
- Git commit and tag creation
- Dry-run mode for testing

Usage:
  python scripts/bump_version.py patch   # 1.2.0 → 1.2.1
  python scripts/bump_version.py minor   # 1.2.0 → 1.3.0
  python scripts/bump_version.py major   # 1.2.0 → 2.0.0

### Created docs/VERSIONING.md
Complete versioning system documentation covering:
- Single-source architecture
- Semantic versioning guidelines
- Automated bumping procedures
- Manual update processes
- Troubleshooting guide
- Best practices

## Files Modified

Core Version Files:
  - VERSION (0.28.0 → 1.2.0)
  - CHANGELOG.md (added v1.0.1 and v1.2.0 entries)
  - README.md (badge updated to 1.2.0)

Component Updates:
  - client/main.py (dynamic VERSION reading)
  - lablink.py (added __version__ from VERSION)
  - docker/Dockerfile.server (label 1.2.0)
  - docker/Dockerfile.web (label 1.2.0)

Copyright Updates (© 2025):
  - docs/USER_GUIDE.md
  - client/ui/main_window.py

New Files:
  + scripts/bump_version.py (version management tool)
  + docs/VERSIONING.md (complete documentation)

## Benefits

✅ Single source of truth for version (VERSION file)
✅ Consistent versioning across all components
✅ Accurate version history in CHANGELOG
✅ Automated version bumping workflow
✅ Complete documentation for future updates
✅ Git-tagged releases (v1.2.0)

## Testing

Verified:
- VERSION file: 1.2.0 ✓
- Server reads VERSION correctly ✓
- Client would read VERSION at startup ✓
- Launcher reads VERSION correctly ✓
- bump_version.py dry-run works ✓

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants