FFT Plot Background
in OpenBCI_GUI
1) What is the frequency resolution of the FFT plot? That is, how many FFT points are used?
2) What method is used to calculate the spectrum? A method like Welch and multitaper or plain FFT?
3) Apparently the Fourier Transform is applied to the time series data. The diagram of the FFT plot changes dynamically in respect with new time series data, so I want to understand how is this done? What is happening if I increase the window length from 10 to 20 seconds or from 10 to 5? I mean the FFT is applied to the length of the window which is selected every time(5, 10, 20 etc) or it is applied to a smaller window?
Thank you
Comments
Thanks for reaching out here on the forums! I will need some time to gather details from the OpenBCI GUI code to share here. If @wjcroft or any other community members can answer some of these questions in the meantime, I can make sure to address the remaining questions.
Here are a few links. Source code for the widget:
https://github.com/OpenBCI/OpenBCI_GUI/blob/master/OpenBCI_GUI/W_FFT.pde
FFT function from 'minim' library:
http://code.compartmental.net/minim/javadoc/ [click 'FFT' in left column]
That page mentions the window functions, if you want to change.
So if you wanted to modify the W_FFT.pde widget source, you could do that, by setting up Processing IDE,
https://docs.openbci.com/docs/06Software/01-OpenBCISoftware/GUIDocs#running-the-openbci-gui-from-the-processing-ide
You'll have to check the minim docs for details on the FFT algorithm specifics.
Regards, William
It depends on the sampling rate and follows https://en.wikipedia.org/wiki/Nyquist–Shannon_sampling_theorem
https://github.com/OpenBCI/OpenBCI_GUI/blob/9634ae767007eaa7b0f7d888e4f56ce9886ba17c/OpenBCI_GUI/DataProcessing.pde#L707
Here is the code for updating the FFT:
https://github.com/OpenBCI/OpenBCI_GUI/blob/9634ae767007eaa7b0f7d888e4f56ce9886ba17c/OpenBCI_GUI/DataProcessing.pde#L676
We are using Minim Java Library:
http://code.compartmental.net/minim/index_analysis.html
And HAMMING window:
https://github.com/OpenBCI/OpenBCI_GUI/blob/9634ae767007eaa7b0f7d888e4f56ce9886ba17c/OpenBCI_GUI/DataProcessing.pde#L254
The core of the code that I have shared here has been in place for some time.
If you tunnel down through the FFT code in DataProcessing.pde, you eventually find the variable Nfft, which is defined according to the code here: https://github.com/OpenBCI/OpenBCI_GUI/commit/84459f63b2de2fbcbb96a0d11c5294e632697c76
as:
125Hz, 200Hz, 250Hz -> 256points.
1000Hz -> 1024points.
1600Hz -> 2048 points.