neurofractal / fBOSC

fooof+BOSC: A repository for the robust detection of oscillations at the single-trial level
GNU General Public License v3.0
22 stars 4 forks source link

Unable to replicate Example fBOSC/FOOOF fit from test_fBOSC.m #9

Open neuropil opened 3 months ago

neuropil commented 3 months ago

I was able to install and execute the necessary functions to run Matlab FOOOF/fBOSC - (thank you for the excellent code/scripts/functions!!)

However, I am unable to replicate the example output from test_fBOSC.m file. I was wondering if you could suggest any help for how to trouble-shoot. Thanks! See below for the two figures: Figure on the Left shows that I am able to replicate the simulated signal code, however, the Figure on the Right indicates that the fit is not quite correct.

2024-06-30_11-03-48

neuropil commented 3 months ago

I believe I found the issue!

In the function drop_peak_cf.m called within the fit_peaks.m function, you need to change the following lines ---- Lines 19-20

Change the conditional from exclusive to inclusive:

Old line: keep_peak = abs(cf_params-freq_range(1)) > bw_params & ... abs(cf_params-freq_range(2)) > bw_params;

New line:

keep_peak = abs(cf_params-freq_range(1)) >= bw_params & ... abs(cf_params-freq_range(2)) >= bw_params;

image