scipy / scipy

SciPy library main repository
https://scipy.org
BSD 3-Clause "New" or "Revised" License
13.15k stars 5.2k forks source link

Wigner and other quasi-probability distributions in scipy.signal. #3533

Open danweflen opened 10 years ago

danweflen commented 10 years ago

I'd like to request that scipy.signal include functions to calculate the Wigner, Glauber–Sudarshan P, and Husimi Q distributions. I've seen a few packages online that calculate specific transforms, but the only unified library I've found that includes these transformations in a unified, coherent way is the Time-Frequency Toolbox for matlab and octave.

ev-br commented 10 years ago

IMO this could be a valuable addition. That being said, the highest chance of these being added is you submitting a PR :-).

danweflen commented 10 years ago

While I don't have P and Q distributions, I've written what I consider to be a pretty good Wigner distribution function. I have a few questions before submitting a PR though, since I've never done it before:

  1. Is it acceptable to use scipy.fft to do fourier transforms, or should numpy's fft package be used instead?
  2. What is the procedure for submitting a PR on this project? Should I create a new branch for the feature I want to add?
  3. How should I organize this? It's just one function, so should I just add it to scipy.signal as a standalone file? Should I add it to signaltools.py, which seems to be the file that matches its uses most closely?

Thanks for the encouragement earlier!

rgommers commented 10 years ago
  1. you can use scipy.fftpack, no problem. It's already used in several places in the signal module.
  2. You create a new branch, push to your own Github branch, then send a PR to scipy master. See http://docs.scipy.org/doc/numpy-dev/dev/gitwash/development_workflow.html for more details.
  3. I'd think it would go better with the functions in signal/spectral.py? You can add it there if the function is not too long. And tests in the corresponding signal/tests/test_spectral.py
rgommers commented 5 years ago

no follow-up in 5 years, we close enhancement request after that time. PR still welcome, but not urgent from our perspective

lucascolley commented 1 year ago

there is active discussion in gh-14141 about this

DietBru commented 1 year ago

Just for reference: