Fitting oscillations and one-over-F (FOOOF) enquiry

Hello. I have a question about the FOOOF models on Welch's Power Spectral Density (PSD), described here: https://neuroimage.usc.edu/brainstorm/Tutorials/Fooof

My objective is to compute the power spectrum density for a selection of electrodes using the Welch estimation density and determine the discrete frequency with the highest power magnitude within the alpha range (e.g., see: https://direct.mit.edu/jocn/article/32/1/1/95400/Individual-Alpha-Frequency-Predicts-Perceived).

I've followed the tutorial, but I'm not sure how to extract the single value I need. Where is it in the Matlab structure? (see "accessing FOOOF model parameters" in the tutorial)

Thank you very much!

If you are only interested in the frequency that has the maximum power between 8 and 12 Hz, you don't need any model to your spectrum, and you probably don't need FOOOF.

You can get this directly from the PSD file:
https://neuroimage.usc.edu/brainstorm/Tutorials/ArtifactsFilter#On_the_hard_drive

Example based on the EEG/epilepsy tutorial:

PsdMat = in_bst_timefreq('sepi01/@rawtutorial_eeg/timefreq_psd_230117_1242.mat');
for iChannel = 1:size(PsdMat.TF,1)
    % Find the indices of the frequency bins of the alpha band
    iFreqs = find((PsdMat.Freqs >= 8) & (PsdMat.Freqs <= 12));
    % Find the maximum power
    [maxPower, maxIndex] = max(squeeze(PsdMat.TF(iChannel, :, iFreqs)));
    % Get the frequency value that has the max power
    maxFreq = PsdMat.Freqs(iFreqs(maxIndex));
    % Display the result 
    disp(sprintf('Channel %s: maxFreq=%1.2fHz, maxPower=%g', PsdMat.RowNames{iChannel}, maxFreq, maxPower));
end

You need to some basic skills in Matlab programming, and probably some of the information from the Scripting tutorial:
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting

Thanks. Is there any way to do this using the GUI?

You can do it visually...

Hi again. Has this been implemented into Brainstorm, or not yet?

Thanks for checking in: you can proceed as Francois indicated above (script or visual inspection) ; you can also retrieve and process the output parameters of FOOOF using a relatively straightforward script.

Thank you. Unfortunately, I don't have much experience with these kinds of scripts. I couldn't find an example in any tutorial (including the EEG & Epilepsy tutorial cited above). By any chance, do you have any examples?

Thanks, Sylvain. I've managed to make the script work, but unfortunately it has an extremely low resolution. It gives me values in the 9, 10, 11 Hz, but it should have a precision around 0.125 Hz. Do you know what is the problem?

For example, this is what a paper describes:

"For each participant and for all electrodes, including the ROI, a full power spectrum was obtained through a Fast Fourier Transform (FFT) with zero-padded window (nominal frequency resolution 0.125Hz) and individual alpha frequency (IAF) was determined for each participant as the value corresponding to the maximum peak frequency within the 8-14 Hz range"

I believe it's the settings in bold that determines this precision?

The minimum frequency that can be resolved, (aka frequency resolution), is the reciprocal of the window length that was used con compute the Fourier transform (FT). In this case, the FT was computed over 1-s windows.

In Brainstorm, the FT does not use zero padding.

While zero-padding can be used to increase the number of frequency bins, it does not increases the frequency resolution. The only way to increase the frequency resolution is by increasing the window length. Zero-padding (in the time domain), has the same effect that interpolating the spectrum using a sinc kernel.

Few resources on this digital signal processing (DSP) topic:

Thank you very much for your reply, Raymundo. I've just tested this using different window lengths and indeed it seems to be the only way to increase frequency resolution.