fooof-tools/fooof_mat

Plotting outputs Matlab wrapper

mgm248 opened this issue ยท 8 comments

Hello,

I was hoping to be able to save plots using the Matlab wrapper, but I am running into a problem. I was hoping, after running FOOOF with fm.fit, where fm is the FOOOF object, I could run fm.save_report(filename), or fm.report and generate a report without having to leave matlab. However, both of these commands led to this error:

matlab_error_8_28

Any idea where this came from / suggestions? I checked and I do have Matplotlib installed. Any help is appreciated :)

As of right now - this wrapper is super minimal, and only really supports the basics of running the model and getting the results.

I would like to extend it a bit as soon as I can a chance (hopefully will take some time to work on it next week). Of the top of my head, I don't know if / how the reports / plotting / saving, etc will work - but I will try to get back to you soon!

Ok, no problem -- thanks for the quick response!

I am attempting to recreate the plots with the data you get from fooof_results, but I'm having trouble with generating the background. I am using the line:

fooofed_psd = fooof_results.background_params(1,1) - log(fooof_results.background_params(1,2) + freqs.^fooof_results.background_params(1,3));

Using the equation ๐ฟ = ๐‘ โˆ’ log (๐‘˜ + ๐น^X) (from the paper), where fooof_results.background_params(1,1) = offset, fooof_results.background_params(1,2) = knee, and fooof_results.background_params(1,3) = slope.

My plots sometimes look ok, and sometimes look like this:

baselineeeg09

I'm thinking it might be something to do with the knee parameter, because I haven't really seen this when I run fooof with a fixed background. Any ideas? Am I interpreting the equation correctly?

Thanks!

^ Just figured this out -- I was using log(), which is natural log in matlab, instead of log10().

Hey @mgm248 : sorry I didn't get back to this earlier - I was traveling back then. If you have some Matlab code to regenerate the model from FOOOF-results, and re-create a plot, would you mind sharing that code? It might something useful to add into this wrapper in general, so that everyone can do that same as you set up. I can help organize the code to merge into the repo here, if you'd like.

Also, @mgm248 : perhaps of interest, I just added support for getting the fooof model, and plotting it.

I would still be curious for the code you used to regenerate the model!

I wrote a plot function at some point

https://github.com/vpapadourakis/fooof_mat/blob/master/matlab_wrapper_examples/plot_one_foof_results.m

It's been a while but it should work.

Great, I'll check it out.

Here's what I wrote:
fooof_plotting_script.zip