How are band powers calculated?
EmotivPRO uses Fast fourier transform (FFT) to obtain band powers in µV2/Hz.
High-pass filter: The data is high-pass filtered before performing the fourier transform. We use the following coefficients:
filter_coeffs”: {
“b”: [0.96588528974407006000, -1.93177057948814010000, 0.96588528974407006000],
“a”: [1.00000000000000000000, -1.93060642721966810000, 0.93293473175661223000]}
DC Removal: We subtract the mean of the data for each epoch/window as the DC value is not usable and only distorts the Fourier transform of the lower frequencies.
eeg_norm = eeg – np.mean(eeg, axis=0)
**EmotivPRO process data in each epoch/window. Generally, 2 seconds epoch/window is used that consists of 256 eeg data samples.
Hanning Window: We use a hanning window size of 256 samples and we slide this window by 16 samples to create the new window. The exact implementation of the Hanning window we use:
hanning_window = []
for i in range(256):
hanning_window.append(0.5 * (1 – np.cos((2.0 * np.pi * (i + 1)) / (256 + 1))))
Band Powers: To compute band powers:
hanning_window = np.hanning(eeg_norm.shape[0]) * 2
eeg_norm_fft = (eeg_norm.T * hanning_window).T
fourier_transform = fft(eeg_norm_fft, axis=0)/eeg_norm_fft.shape[0]
eeg_fft_square_3d = np.absolute(fourier_transform)**2
band = list(range(16, 25))
band_power = np.sum(eeg_fft_square_3d[band, :, :], axis=0) / len(band)
Normalization: To normalize, EmotivPRO divides the output of the fft by the window length, i.e. 256
band_power_norm = band_power / hanning_window.shape[0]