FFTFilter

Forum for discussion on different signal processing algorithms
Locked
nadoona
Posts: 14
Joined: 10 Aug 2007, 15:31

FFTFilter

Post by nadoona » 28 Sep 2007, 17:32

Hi,

I wonder if there is any documentation explaining the FFTFilter in BCI 2000.

Thanks.

mellinger
Posts: 1208
Joined: 12 Feb 2003, 11:06

Post by mellinger » 04 Oct 2007, 10:38

Hi Nadoona,

currently, there is no full documentation for the FFT filter.
For BCI2000 version 2, full documentation of all "core" filters will be available within the next weeks.

In short, the FFT filter applies a short-term FFT to selected channels of its input signal.
The computed spectrum may be displayed in a visualization window.
Depending on configuration, the FFT filter's output signal will be the spectrum, or the unchanged input. The latter option allows you to view the spectrum without using it in the online computations.
If you are familiar with FFT in general, the filter's parameters should be self-explaining.
Otherwise, feel free to ask more detailed questions.

Hope this helps,
Juergen

aloplop
Posts: 41
Joined: 03 Sep 2008, 07:20

Questions about FFT Filter

Post by aloplop » 06 Nov 2008, 07:13

Hi,

I have some doubts about the use of the FFT Filter.

1º) The newest version I have downloaded of FFTW is the 3.1.3. However I haven´t seen any fftw3.dll so I had to download a previous version, the fftw-3.0.1-w32-pl1 file which seems to contain the fft3w.dll file recquired for the filter to perform the transformation.

2º) If I want to use the power spectrum in mu and beta bands and, let´s say I use a sampling freq. of 128 Hz.

- For example, using a 0.5s window (i.e. 2 Hz) means that I am using a 128/2 = 64 points in the window (i.e. a 64 points FFT ). In the classifier the bins 4 and 6 are chosen so I think they correspond to the 8 and 12 Hz bins. Am I right or the first bin is the one which corresponds to 0 Hz??

- What size of window would you recommend?

- How can I know the 'width' associated with each bin (maybe is the inverse of the size of the window??) ??

- According to your experience, what is the best kind of window to choose for the calculations?? (For example, in the article by Krusienski et al, MAtched filter...., you used a Hamming Window).

Maybe the limits in the FFT Power Spectra window are confusing me...:?
I think we can see some sampling frequency periods...

3º) What is the function used to perform the STFT when in the FFTFilter.cpp is invoked:

Code: Select all

// Compute the power spectrum and visualize it if requested.
    mFFT.Transform();
4º) Using the fftw3.dll from that version I haven´t been able to see the spectrum using the Signal Generator (FFTOutputSignal = InputSignal). This error appears:

Code: Select all

FFTFilter::Process: unhandled exception EAccessViolation,
terminating SignalProcessing module.
I think it´s all for the moment. Thanks.

mellinger
Posts: 1208
Joined: 12 Feb 2003, 11:06

Post by mellinger » 06 Nov 2008, 11:06

ad 1)
Thanks for the note on FFTW 3.1.3. I updated the FFTFilter reference page to reflect file name changes.

ad 2)
DC bin: The DC bin is always the first one to be present in the filter's output.

Window size: I would suggest to choose it based on the desired output bin width, and to adjust window overlap by adjusting BCI2000 sample block size.

Bin width: For an FFT, the number of output bins equals the number of input data points. These bins span the range from the negative to the positive Nyquist frequency; this range's length is identical to the sampling frequency, so a single bin's width equals the sampling rate, divided by the number of FFT input samples. This is also equal to the inverse of the input window's length when measured in seconds.

ad 4)
Thanks for the report, I'll investigate this issue further.

mellinger
Posts: 1208
Joined: 12 Feb 2003, 11:06

Post by mellinger » 06 Nov 2008, 14:19

The issue you reported under 4) is fixed now.

aloplop
Posts: 41
Joined: 03 Sep 2008, 07:20

Post by aloplop » 07 Nov 2008, 05:02

Hi,

thanks for your last fixes, I have tried the FFT Filter ones.

I still have doubts about some aspects (in order to explain properly in the project). Following the proposed example:

1) If the bin width is 2 Hz (because a 0.5s window is used) and the first bin is
the 0Hz bin, the next bin is the 2 Hz bin but, what is the range associated
for each bin??
Is it symmetrical ?? I mean:

Option A: the range for calculate the power spectrum of the 2Hz bin is
form 1 Hz to 3 Hz.

Option B: The range is from 2Hz to 4 Hz.

or what is the exact range taken??

2º) Is there any way to look in a proper way the band from 0-60 Hz ??

I am a bit confused about what you can see in the windows.

If you select in the Visualize tab:

- FFT Filter -> Visualize Power Spectra. Is it the corresponding power
in each moment in time??

- Processing Stages -> Visualize FFT Filter Output.

A) Input Channel : Is it the same signal in time?? Couldn´t you see the FFT of the signal ??

B) Power Spectra: for the Signal Generator I can see somewhat similar to a mu rhythm.


3)What is the function used to perform the STFT when in the FFTFilter.cpp is invoked??:

Code: Select all

// Compute the power spectrum and visualize it if requested.
    mFFT.Transform();
Thanks again.

mellinger
Posts: 1208
Joined: 12 Feb 2003, 11:06

Post by mellinger » 07 Nov 2008, 08:35

ad 1)
The DC bin's range is always centered around 0Hz. For more details about FFT, you might refer to the MATLAB help on MATLAB's fft function, which uses the FFTW library internally, or to a signal processing textbook.

ad 2)
You are right that the window displays the power distribution as computed by the FFT for each data block, so the x axis represents time, the y axis represents frequencies, and power is color-coded. Currently, BCI2000 visualization capabilities are not optimally suited to support visualization of power spectra, so currently there is no frequency axis displayed. Also, when having more than 32 bins, you will need to scroll down the display in order to display the low frequency bins.

ad 3)
http://www.fftw.org/fftw3_doc/The-Halfc ... format-DFT

Locked

Who is online

Users browsing this forum: No registered users and 4 guests