Skip to content

Commit c9583cf

Browse files
committed
Merge doc updates from master
2 parents 4257b3f + ec5f59d commit c9583cf

File tree

7 files changed

+29
-50
lines changed

7 files changed

+29
-50
lines changed

fooof_mat/fooof.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% fooof() - Fit the FOOOF model on a neural power spectrum.
22
%
33
% Usage:
4-
% >> fooof_results = fooof(freqs, power_spectrum, f_range, settings);
4+
% >> fooof_results = fooof(freqs, power_spectrum, f_range, settings, return_model);
55
%
66
% Inputs:
77
% freqs = row vector of frequency values
@@ -14,7 +14,7 @@
1414
% settings.peak_threshold
1515
% settings.aperiodic_mode
1616
% settings.verbose
17-
% return_model = boolean of whether to return actual model, optional
17+
% return_model = boolean of whether to return the FOOOF model fit, optional
1818
%
1919
% Outputs:
2020
% fooof_results = fooof model ouputs, in a struct, including:
@@ -30,9 +30,9 @@
3030
% fooof_results.ap_fit
3131
%
3232
% Notes
33-
% Not all settings need to be set. Any settings that are not
34-
% provided as set to default values. To run with all defaults,
35-
% input settings as an empty struct.
33+
% Not all settings need to be defined by the user.
34+
% Any settings that are not provided are set to default values.
35+
% To run with all defaults, input settings as an empty struct.
3636

3737
function fooof_results = fooof(freqs, power_spectrum, f_range, settings, return_model)
3838

@@ -63,7 +63,7 @@
6363
% This will default to not return model, if variable not set
6464
if exist('return_model', 'var') && return_model
6565

66-
% Get the model, and add outputs to foof_results
66+
% Get the model, and add outputs to fooof_results
6767
model_out = fooof_get_model(fm);
6868
for field = fieldnames(model_out)'
6969
fooof_results.(field{1}) = model_out.(field{1});

fooof_mat/fooof_check_settings.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
% settings.aperiodic_mode
1313
% settings.verbose
1414
%
15-
% Returns:
15+
% Outputs:
1616
% settings = struct, with all settings defined:
1717
% settings.peak_width_limts
1818
% settings.max_n_peaks
1919
% settings.min_peak_amplitude
2020
% settings.peak_threshold
2121
% settings.aperiodic_mode
2222
% settings.verbose
23-
23+
%
2424
% Notes:
2525
% This is a helper function, probably not called directly by the user.
2626
% Any settings not specified are set to default values
@@ -36,7 +36,7 @@
3636
'aperiodic_mode', 'fixed', ...
3737
'verbose', true);
3838

39-
% Overwrite any non-existent of nan settings with defaults
39+
% Overwrite any non-existent or nan settings with defaults
4040
for field = fieldnames(defaults)'
4141
if ~isfield(settings, field) || all(isnan(settings.(field{1})))
4242
settings.(field{1}) = defaults.(field{1});

fooof_mat/fooof_get_model.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
% model_fit.ap_fit
1515
%
1616
% Notes
17-
% This function is mostly an internal function, but can be called
18-
% directly by the user if you are interacting with FOOOF objects
19-
% directly.
17+
% This function is mostly an internal function.
18+
% It can be called directly by the user if you are interacting with FOOOF objects directly.
2019

21-
% Get the actual fit model from a FOOOF object
2220
function model_fit = fooof_get_model(fm)
2321

2422
model_fit = struct();

fooof_mat/fooof_plot.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
function fooof_plot(fooof_results, log_freqs)
1414

1515
%% Data Checking
16+
1617
if ~isfield(fooof_results, 'freqs')
1718
error('FOOOF results struct does not contain model output.')
1819
end
1920

2021
%% Set Up
22+
2123
if exist('log_freqs', 'var') && log_freqs
2224
plt_freqs = log10(fooof_results.freqs);
2325
else
@@ -27,17 +29,17 @@ function fooof_plot(fooof_results, log_freqs)
2729
% Plot settings
2830
lw = 2.5;
2931

30-
%% Create the Plots
32+
%% Create the plots
3133

3234
figure()
3335
hold on
36+
3437
% Plot the original data
3538
data = plot(plt_freqs, fooof_results.power_spectrum, 'black');
3639

3740
% Plot the full model fit
3841
model = plot(plt_freqs, fooof_results.fooofed_spectrum, 'red');
3942

40-
4143
% Plot the aperiodic fit
4244
ap_fit = plot(plt_freqs, fooof_results.ap_fit, 'b--');
4345

fooof_mat/fooof_unpack_results.m

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
% fooof_unpack_results() - Extract model fit results from FOOOFResults.
22
%
33
% Usage:
4-
% >> results_out = fooof_unpack_results(fooof_results);
4+
% >> results_out = fooof_unpack_results(results_in);
55
%
66
% Inputs:
77
% fooof_results = FOOOFResults object
8+
%
89
% Outputs:
910
% results_out = fooof model results, in a struct, including:
1011
% results_out.aperiodic_params
@@ -13,10 +14,9 @@
1314
% results_out.error
1415
% results_out.r_squared
1516
%
16-
% Notes:
17-
% This function is mostly an internal function, and doesn't need to be
18-
% called directly by the user - but can be if you are interacting
19-
% directly with FOOOF objects.
17+
% Notes
18+
% This function is mostly an internal function.
19+
% It can be called directly by the user if you are interacting with FOOOF objects directly.
2020

2121
function results_out = fooof_unpack_results(results_in)
2222

@@ -36,10 +36,11 @@
3636
results_out.error = ...
3737
double(py.array.array('d', py.numpy.nditer(results_in.error)));
3838

39-
% Note: r_squared seems to come out as float
40-
% It's not clear why this value is different, but doesn't seem
41-
% to require the type casting like other (code commented below)
4239
results_out.r_squared = results_in.r_squared;
40+
41+
% Note: r_squared seems to come out as float, and does not need type casting
42+
% It is not clear why this value is different
43+
% Just in case, the code for type casting is commented out below:
4344
%results_out.r_squared = ...
4445
% double(py.array.array('d', py.numpy.nditer(results_in.r_squared)));
4546

fooof_mat/fooof_version.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
% fooof_version() - Get FOOOF version information, of both Python & Wrapper.
1+
% fooof_version() - Get FOOOF version information.
22
%
33
% Usage:
44
% >> fooof_version()
5+
%
6+
% Notes
7+
% This function returns versions of both the installed FOOOF in Python, and of this Matlab wrapper.
8+
% The version number of the Matlab FOOOF wrapper is defined in this function.
59

610
function fooof_version()
711

fooof_mat/new_fooof_group.m

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)