Skip to content

Commit

Permalink
Scout: Add RMS as scout function
Browse files Browse the repository at this point in the history
  • Loading branch information
rcassani committed Mar 13, 2024
1 parent bcb346f commit de84a95
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions toolbox/gui/panel_scout.m
Expand Up @@ -586,6 +586,7 @@ function CreateMenuFunction(jMenu)
jMenuNorm = gui_component('RadioMenuItem', jMenu, [], 'Mean(norm)', [], [], @(h,ev)bst_call(@SetScoutFunction,'Mean_norm'));
jMenuMax = gui_component('RadioMenuItem', jMenu, [], 'Max', [], [], @(h,ev)bst_call(@SetScoutFunction,'Max'));
jMenuPow = gui_component('RadioMenuItem', jMenu, [], 'Power', [], [], @(h,ev)bst_call(@SetScoutFunction,'Power'));
jMenuRms = gui_component('RadioMenuItem', jMenu, [], 'RMS', [], [], @(h,ev)bst_call(@SetScoutFunction,'RMS'));
jMenuAll = gui_component('RadioMenuItem', jMenu, [], 'All', [], [], @(h,ev)bst_call(@SetScoutFunction,'All'));
% Get the selected functions
allFun = unique({sScouts.Function});
Expand All @@ -600,6 +601,7 @@ function CreateMenuFunction(jMenu)
case 'Mean_norm', jMenuNorm.setSelected(1);
case 'Max', jMenuMax.setSelected(1);
case 'Power', jMenuPow.setSelected(1);
case 'RMS', jMenuRms.setSelected(1);
case 'All', jMenuAll.setSelected(1);
end
end
Expand Down
13 changes: 10 additions & 3 deletions toolbox/math/bst_scout_value.m
Expand Up @@ -189,14 +189,21 @@
% STD : Standard deviation of the patch activity at each time instant
case 'std'
Fs = std(F,[],1);

% STDERR : Standard error
case 'stderr'
%% This formula was incorrect for standard error (fixed 2023-04). Is it used anywhere?
Fs = std(F,[],1) ./ sqrt(nRow);
% RMS

% RMS : Root mean square, square root of the average of the square of the all the signals
case 'rms'
Fs = sqrt(sum(F.^2,1));

if (nComponents == 1)
Fs = mean(F.^2, 1);
else
Fs = mean(sum(F.^2, 3), 1);
end
Fs = sqrt(Fs);

% MEAN_NORM : Average of the norms of all the vertices each time instant
% If only one components: computes mean(abs(F)) => Compatibility with older versions
case 'mean_norm'
Expand Down
7 changes: 4 additions & 3 deletions toolbox/process/functions/process_extract_scout.m
Expand Up @@ -55,11 +55,11 @@
sProcess.options.flatten.Value = 1;
sProcess.options.flatten.InputTypes = {'results'};
% === SCOUT FUNCTION ===
sProcess.options.scoutfunc.Comment = {'Mean', 'Power', 'Max', 'PCA', 'Std', 'All', 'Scout function:'; ...
'mean', 'power', 'max', 'pca', 'std', 'all', ''};
sProcess.options.scoutfunc.Comment = {'Mean', 'Power', 'Max', 'PCA', 'Std', 'RMS', 'All', 'Scout function:'; ...
'mean', 'power', 'max', 'pca', 'std', 'rms', 'all', ''};
sProcess.options.scoutfunc.Type = 'radio_linelabel';
sProcess.options.scoutfunc.Value = 'pca';
sProcess.options.scoutfunc.Controller = struct('pca', 'pca', 'mean', 'notpca', 'power', 'notpca', 'max', 'notpca', 'std', 'notpca', 'all', 'notpca');
sProcess.options.scoutfunc.Controller = struct('pca', 'pca', 'mean', 'notpca', 'power', 'notpca', 'max', 'notpca', 'std', 'notpca', 'rms', 'notpca', 'all', 'notpca');
% === PCA Options
sProcess.options.pcaedit.Comment = {'panel_pca', ' PCA options: '};
sProcess.options.pcaedit.Type = 'editpref';
Expand Down Expand Up @@ -151,6 +151,7 @@
case {4, 'std'}, ScoutFunc = 'std';
case {5, 'all'}, ScoutFunc = 'all';
case {6, 'power'}, ScoutFunc = 'power';
case {7, 'rms'}, ScoutFunc = 'rms';
otherwise, bst_report('Error', sProcess, [], 'Invalid scout function.'); return;
end
else
Expand Down

0 comments on commit de84a95

Please sign in to comment.