You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-17Lines changed: 13 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
-
# Matlab Support for Using FOOOF
1
+
# FOOOF - Matlab Wrapper
2
2
3
-
This repository offers support materials and utilities for using [FOOOF](https://github.com/voytekresearch/fooof) with Matlab. All [descriptions](https://github.com/voytekresearch/fooof/README.md) and [tutorials](https://github.com/voytekresearch/fooof/tutorial) for FOOOF are in the [main repository](https://github.com/voytekresearch/fooof), and a full description of the method is available in the [paper](https://www.biorxiv.org/content/early/2018/04/11/299859).
3
+
This repository offers a Matlab wrapper for [FOOOF](https://github.com/fooof-tools/fooof) with Matlab.
4
4
5
-
There are two approaches offered here for using FOOOF with Matlab - a Matlab Wrapper, and a Matlab->Python->Matlab workflow. Note that these options both still use the Python implementation under the hood, and so do require a working Python install - but that should be easy to do, and instructions are provided below to do so.
5
+
All [descriptions](https://github.com/fooof-tools/fooof/README.md) and [tutorials](https://github.com/fooof-tools/fooof/tutorial) for FOOOF are in the [main repository](https://github.com/fooof-tools/fooof), and a full description of the method is available in the [paper](https://www.biorxiv.org/content/early/2018/04/11/299859).
6
+
7
+
This repository describes the Matlab wrapper, in which you call the Python implemnetation of FOOOF from Matlab, never having to interact directly with Python. An alternative approach is to use a primarily
8
+
9
+
There are two approaches offered here for using FOOOF with Matlab - a Matlab Wrapper, and a Matlab->Python->Matlab workflow. Note that these options both still use the Python implementation under the hood, and so do require a working Python install - but that should be easy to do, and instructions are provided below to do so.
6
10
7
11
### Reference
8
12
@@ -12,9 +16,9 @@ If you use this code in your project, please cite:
12
16
Voytek B (2018) Parameterizing Neural Power Spectra. bioRxiv, 299859.
13
17
doi: https://doi.org/10.1101/299859
14
18
15
-
## Matlab Wrapper
19
+
## FOOOF_MAT
16
20
17
-
The Matlab wrapper, in 'matlab_wrapper' is some Matlab code, that calls the Python implementation of FOOOF. This requires that you have Python & FOOOF installed, but does not require you to ever use or write Python code yourself.
21
+
The Matlab wrapper, is Matlab code that calls the Python implementation of FOOOF. This requires that you have Python & FOOOF installed, but does not require you to ever use or write Python code yourself.
18
22
19
23
To use the wrapper, first install Python & FOOOF - there are instructions to do so below. Then clone or download this repository, and then use the the provided matlab code to run FOOOF. The only function you need to run is 'fooof.m', which has documentation on inputs and outputs.
20
24
@@ -30,7 +34,7 @@ Once you have downloaded Python, you shouldn't need to do anything for Matlab to
30
34
31
35
You can run `pyversion` to see which Python you are using. Note that you must do this _after installing Python and FOOOF_ (instruction to do so below).
32
36
```
33
-
% Check which python is being used.
37
+
% Check which python is being used.
34
38
pyversion
35
39
36
40
% The print out from above should tell you which Python you are calling
@@ -40,18 +44,10 @@ pyversion
40
44
41
45
% Set python version to use
42
46
% Note: you must do this first thing after opening Matlab (relaunch if you need to)
43
-
% You should only ever have to run this at most, once.
47
+
% You should only ever have to run this at most, once.
44
48
pyversion('/anaconda/bin/python')
45
49
```
46
50
47
-
## Matlab -> Python -> Matlab
48
-
49
-
Since you need to install Python anyways, another potential workflow is to do all of your processing and analysis in Matlab, up to and including calculating power spectra, which you then save out to mat files. You can then load these files in Python, run and explore FOOOF, then save out the model fit results, that can be loaded back into Matlab, if you prefer.
50
-
51
-
The benefit of this approach, over using the wrapper, is that you have full access to the FOOOF module in Python, which makes it easier to use utilities to plot outputs and see what's happening.
52
-
53
-
An example / template workflow for using this approach, including matlab and python scriptys, is available in 'mat_py_mat'. With this template, you should be able get working with this workflow without having to write almost any Python code.
54
-
55
51
## Installing Python & FOOOF
56
52
57
53
Both workflows above require that Python & FOOOF be installed. The easiest way to do this is as follows:
@@ -70,10 +66,10 @@ FOOOF can be installed through pip, meaning you just have to run the following f
70
66
71
67
`pip install fooof`
72
68
73
-
If you're on mac, 'command line' means terminal - after installing anaconda, just copy the above command into the terminal, and it should work. If you're on windows, you will need to run this in 'anaconda command prompt' which is basically a command line specifically for managing Python with Anaconda.
69
+
If you're on mac, 'command line' means terminal - after installing anaconda, just copy the above command into the terminal, and it should work. If you're on windows, you will need to run this in 'anaconda command prompt' which is basically a command line specifically for managing Python with Anaconda.
74
70
75
71
## Potential Matlab Implementation
76
72
77
-
The above workflows still use the Python implementation of FOOOF. This has some perks, in that running the exact same code means that there are no worries about maintaining and verying the consistency between multiple implementations of the code. However, it does still require this somewhat annoying coordinating between languages, if one wants to use Matlab. The only way to get around this would be to have a re-implemenation of the algorithm in Matlab, in which case it could be used in a stand-alone manner.
73
+
The above workflows still use the Python implementation of FOOOF. This has some perks, in that running the exact same code means that there are no worries about maintaining and verying the consistency between multiple implementations of the code. However, it does still require this somewhat annoying coordinating between languages, if one wants to use Matlab. The only way to get around this would be to have a re-implemenation of the algorithm in Matlab, in which case it could be used in a stand-alone manner.
78
74
79
75
As of right now, there are no plans on our end for a full re-implementation of the algorithm in Matlab - it's non-trivial to re-write, test, confirm equivalence, and then continuously maintain two versions. That said, the code is open, so if want to try and do this yourself, go for it!
0 commit comments