Closed cygerts closed 5 years ago
You should look into the Lomb-Scargle Periodogram.
Great, many thx. Just wondering, do you have any recommendation what should I use when the signal is evenly spaced? Maybe what I am using (scipy.fftpack) is not optimal in that case?
For evenly-spaced signals, a PSD computed with the FFT is the best approach. It's mathematically provable that you cannot do better.
Great, many thanks. This follow up link may be an useful start to many readers - how to calculate frequency between bins https://stackoverflow.com/questions/41783512/fft-calculating-exact-frequency-between-frequency-bins
So my question is how can we get dominating frequency / frequencies from the signal?
That is sth I can achieve with scipy.FFTPACK using code like that: import scipy.fftpack as syfp X = syfp.fft(signal) freqs = syfp.fftfreq(len(signal)) * SamplesPerSecond dominatingFreqId= np.argsort(np.abs(X))[-1] freq = freqs[dominatingFreqId]
How can I achieve that with NFFT, but of course on not equally spaced samples? I.e. it would be nice if I can get the frequency using code sample by jakevdp from this thread: https://github.com/jakevdp/nfft/issues/7