A Python Pseudo Wigner Distribution
An Insight into the Python Wigner Distribution Repository
In the realm of signal processing, the Wigner distribution is a powerful tool for time-frequency analysis, offering high-resolution insights into signals. It’s a time-frequency distribution, akin to the spectrogram but with distinct properties and advantages. I have been working on a Python implementation of the Wigner distribution, aiming to provide an efficient solution for those in the field and entice Python standard libraries to adopt it. You can find my work on this GitHub repository: python-wigner-distribution.
I was inspired to create this algorithm based on some work I had to do back in 2021. When searching the web for an implementation I was stumped to find that there was no solid implementation of the algorithm!
Understanding the Wigner Distribution
The Wigner distribution, or Wigner-Ville distribution, is known for its ideal resolution properties, offering clarity in both time and frequency domains. Despite these advantages, it also introduces signal-dependent interference terms, which, while mathematically very interesting, don’t represent true signal terms. These interference patterns are particularly valuable in quantum state analysis but can complicate the interpretation of real-world signals. The implementation in this repository, technically a Pseudo Wigner distribution, was inspired by the work of Mecklenbräuker et al. [1]
To address this, my repository includes a method for reducing interference terms effectively. By applying these techniques, we can minimize the impact on the actual signals, called autoterms, without significantly compromising resolution. This technique was inspired by the paper by Pikula, Stanislav & Beneš. [2]
Visual Examples
The repository features visual examples of the Wigner distribution in action:
- The first illustrates the distribution of a 50Hz sine wave, showcasing its high resolution.
- The second example presents the distribution of two sine waves at 50Hz and 100Hz, with a visible interference pattern at 75Hz.
- The final image demonstrates the effect of interference reduction on the same two sine waves, removing the interference terms while preserving the autoterms.
Repository Goals
The repository’s primary goal is to contribute an efficient and accessible implementation of the Wigner distribution algorithm defined by Claasen and Mecklenbräuker [1], leveraging numpy and scipy for performance and ease of use. While Matlab has an inbuilt function for the Wigner distribution, I believe it’s time for Python standard libraries to include it as well. I plan to contribute my implementation to scipy in the future.
Installation and Testing
Installation is straightforward: download the repository, which depends solely on standard Python libraries like numpy, scipy, and matplotlib—the latter being optional and only required for visualization in tests. The repository is designed for Python3, with Python2 support not explicitly guaranteed.
To install, clone the repository, navigate to its root directory, and
execute pip install .
or pip install -e .
for
development mode.
Running tests is just as simple, with instructions provided to execute specific test scripts from the terminal.
Open Source Contribution
This software is distributed under the MIT License, promoting open source collaboration and improvement. I welcome contributions and feedback as we work towards enhancing Python’s capabilities in signal analysis.
I invite you to explore the repository and contribute. Whether you’re a seasoned signal analyst or an enthusiast in the field, this project opens the door to high-resolution time-frequency signal analysis. Take a look, try it out, and possibly join the effort to integrate the Wigner distribution into scipy’s esteemed collection of tools.
For more information, access to the source code, and visual examples, visit the python-wigner-distribution on GitHub.
References
- [1] T. Claasen, W. Mecklenbräuker, The Wigner Distribution – A Tool For Time-Frequency Signal Analysis, Phillips J. Res. 35, 276-300, 1980
- [2] Pikula, Stanislav & Beneš, Petr. (2020). A New Method for Interference Reduction in the Smoothed Pseudo Wigner-Ville Distribution. International Journal on Smart Sensing and Intelligent Systems. 7. 1-5. 10.21307/ijssis-2019-101.