Comments (10)
I'm able to reproduce this and this is indeed a bug in the instantaneous frequency estimation. @WRAR891 in your example, the input is not an analytic signal, and those are required for instantaneous frequencies to be well defined. Converting your signal into an analytic one with the scipy.signal.hilbert
function should produce a better, more meaningful results - but they would still not be perfect. Give me a couple of days and I'll get this fixed.
Thanks
from pyhht.
I, too, have questions about how to interpret the results of utils.inst_freq(). I tried
f, ts = utils.inst_freq(np.sin(2.0 * np.pi *10.0 * t))
plt.xlabel('Ts')
plt.ylabel('Freq')
plt.plot(ts, f)
plt.show()
and get an unexpected result. Clearly, the inst. freq should be a constant value for this. Is there some usage detail that is being overlooked?
from pyhht.
@WRAR891 I think it's a major bug in this package. Waiting the confirmation from the author
from pyhht.
Thanks for pointing this out, @hbake001 and @WRAR891
This implementation of instantaneous frequency detection was adapted from the MATLAB toolbox for time frequency analysis - http://tftb.nongnu.org/
I don't think it is meant to work with IMFs at all, since the definition of the instantaneous frequency of an IMF is the derivative of the arctan of the Hilbert transform of the IMF. I'll dig deeper into this over the weekend.
from pyhht.
@WRAR891 As I said earlier, the problem was the analyticity of the signal. Converting the input to an analytical signal seems to be giving reasonable, almost identical results in both MATLAB and pyhht. Here are the instantaneous frequency plots for your specific example,
@hbake001 Can you provide an example so I can debug your problem? Also please mention which MATLAB package you are using to generate instantaneous frequencies.
Thanks,
from pyhht.
I agree, that for analytical or complex-valued signals, inst_freq() appears to give a reasonable result. One could compare it to:
1.0 / (2.0 * np.pi) * np.diff(np.unwrap(np.angle(m)))
where m is a mode expressed as the hilbert xform of a real-valued signal.
Note: if the mode itself is complex-valued, one does not need to hilbert-transform it.
from pyhht.
Hi everyone,
I am also trying to get instant frequencies from my signal, I tried using hilbert() to convert my signal to analytic one but, I believe I am missing something, somewhere. My result looks like below:
And below is my codepiece:
https://github.com/atilileri/Thesis01/blob/master/insFrqPyhht.py
Am I doing something wrong?
Thanks in advance.
from pyhht.
Hi @atilileri
I looked at your code, and it appears that you're reading an audio file and converting the waveforms into an analytic signal using scipy.signal.hilbert
. However, please note that the analyticity of the signal alone does not guarantee well behaved instantaneous frequency. For that to happen, two conditions must be met:
- Signal must be an IMF
- Signal should be analytic.
In your script, it doesn't look like you have done anything to decompose the signal into purely amplitude/frequency modulated modes. Without that, there is no reason to expect the instantaneous frequency calculation to be meaningful.
Hope this helps.
from pyhht.
Hi again,
As you said; I extracted imfs from the original signal and then applied hilbert()
, got better results. Adding a sample screenshot for reference. Hope it helps some more googlers like me :). Thanks for the help again @jaidevd
And below is my codepiece again:
https://github.com/atilileri/Thesis01/blob/master/insFrqPyhht.py
from pyhht.
Hi,
Why could not I find the method about instantaneous frequencies?
from pyhht.
Related Issues (20)
- Force stopping for complex signals HOT 9
- bivariate EMD has some bugs HOT 12
- preserving the decomposition memory HOT 2
- emd.py divide by zero & other uncaught exceptions HOT 2
- suggestion to add reference to pip HOT 4
- unnecessary print in plot ? HOT 1
- more meaningful representation of orthogonality HOT 12
- y labels rotation HOT 6
- more detailed ref to paper HOT 5
- computation of full Hilbert spectrum HOT 3
- EEMD algorithm HOT 1
- Clarification of boundary_conditions() example HOT 2
- EMD not stable while data rolling on HOT 1
- marginal spectrum and energy spectrum HOT 3
- According to which article
- I got some negative instantaneous frequencies HOT 2
- why this pyhht.emd diffrent with matlab 2018a emd result! HOT 5
- Docs do not build with Sphinx 4.0.2 HOT 4
- problem with tutorials
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyhht.