Skip to content

Commit

Permalink
Update GUI: WindowOverlap and STFT process_cohere1n
Browse files Browse the repository at this point in the history
  • Loading branch information
rcassani committed Aug 9, 2023
1 parent cad1ca9 commit 9ab8ad6
Showing 1 changed file with 18 additions and 42 deletions.
60 changes: 18 additions & 42 deletions toolbox/process/functions/process_cohere1n.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,55 +64,30 @@
sProcess.options.label2.Comment = '<B>Time-frequency decomposition:</B>';
sProcess.options.label2.Type = 'label';
sProcess.options.tfmeasure.Comment = {'Hilbert transform', 'Morlet wavelets', 'Fourier transform', ''; ...
'hilbert', 'morlet', 'fourier', ''};
'hilbert', 'morlet', 'stft', ''};
sProcess.options.tfmeasure.Type = 'radio_linelabel';
sProcess.options.tfmeasure.Value = 'hilbert';
sProcess.options.tfmeasure.Controller = struct('hilbert', 'hilbert', 'morlet', 'hilbert', 'fourier', 'fourier');
% === TF OPTIONS Panel
sProcess.options.tfedit.Comment = {'panel_timefreq_options', 'Options: '};
sProcess.options.tfedit.Type = 'editpref';
sProcess.options.tfedit.Value = [];
sProcess.options.tfedit.Class = 'hilbert';
% % === Split a Large Signal into Blocks
% sProcess.options.tfsplit.Comment = 'Split large data in';
% sProcess.options.tfsplit.Type = 'value';
% sProcess.options.tfsplit.Value = {1, 'time block(s)', 0};
% sProcess.options.tfsplit.Class = 'hilbert';
% === WINDOW LENGTH
sProcess.options.fftlength.Comment = 'Fourier transform window length:';
sProcess.options.fftlength.Type = 'value';
sProcess.options.fftlength.Value = {1, 's', []};
sProcess.options.fftlength.Class = 'fourier';
% === OVERLAP
sProcess.options.fftoverlap.Comment = 'Fourier transform window overlap:';
sProcess.options.fftoverlap.Type = 'value';
sProcess.options.fftoverlap.Value = {50, '%', []};
sProcess.options.fftoverlap.Class = 'fourier';
% === HIGHEST FREQUENCY OF INTEREST
sProcess.options.maxfreq.Comment = 'Highest frequency of interest:';
sProcess.options.maxfreq.Type = 'value';
sProcess.options.maxfreq.Value = {59,'Hz',2};
sProcess.options.maxfreq.Class = 'fourier';
% === TIME AVERAGING
sProcess.options.timeres.Comment = {'Full (requires epochs)', 'Windowed', 'None', '<B>Time resolution:</B>'; ...
'full', 'windowed', 'none', ''};
sProcess.options.timeres.Type = 'radio_linelabel';
sProcess.options.timeres.Value = 'full';
% === Hilbert/Morlet: WINDOW LENGTH
sProcess.options.timeres.Controller = struct('full', 'nowindowed', 'windowed', 'windowed', 'none', 'nowindowed');
% === WINDOW LENGTH
sProcess.options.avgwinlength.Comment = '&nbsp;&nbsp;&nbsp;Time window length:';
sProcess.options.avgwinlength.Type = 'value';
sProcess.options.avgwinlength.Value = {1, 's', []};
sProcess.options.avgwinlength.Class = 'hilbert';
% % === Hilbert/Morlet: OVERLAP
% sProcess.options.avgwinoverlap.Comment = '&nbsp;&nbsp;&nbsp;Time window overlap:';
% sProcess.options.avgwinoverlap.Type = 'value';
% sProcess.options.avgwinoverlap.Value = {50, '%', []};
% sProcess.options.avgwinoverlap.Class = 'hilbert';
% === Fourier: MOVING AVERAGE
sProcess.options.avgwinnum.Comment = '&nbsp;&nbsp;&nbsp;Time window length:';
sProcess.options.avgwinnum.Type = 'value';
sProcess.options.avgwinnum.Value = {3, 'Fourier transform windows', 0};
sProcess.options.avgwinnum.Class = 'fourier';
sProcess.options.avgwinlength.Class = 'windowed';
% === WINDOW OVERLAP
sProcess.options.avgwinoverlap.Comment = '&nbsp;&nbsp;&nbsp;Time window overlap:';
sProcess.options.avgwinoverlap.Type = 'value';
sProcess.options.avgwinoverlap.Value = {50, '%', []};
sProcess.options.avgwinoverlap.Class = 'windowed';
% === OUTPUT MODE / FILE AVERAGING
% Ideally, 'input' would be disabled for 'full' time resolution.
sProcess.options.outputmode.Comment = {'separately for each file', 'across combined files/epochs', 'Estimate & save:'; ...
Expand Down Expand Up @@ -153,7 +128,7 @@

% === Time-freq method
OPTIONS.tfMeasure = sProcess.options.tfmeasure.Value;
if ismember(OPTIONS.tfMeasure, {'hilbert','morlet'})
if ismember(OPTIONS.tfMeasure, {'hilbert','morlet','stft'})
% Get time-freq panel options
tfOPTIONS = sProcess.options.tfedit.Value;
if isempty(tfOPTIONS)
Expand All @@ -169,7 +144,7 @@
OPTIONS.Freqs = tfOPTIONS.Freqs;
if strcmpi(sProcess.options.timeres.Value, 'windowed')
OPTIONS.WinLen = sProcess.options.avgwinlength.Value{1};
%OPTIONS.WinOverlap = sProcess.options.avgwinoverlap.Value{1}/100;
OPTIONS.WinOverlap = sProcess.options.avgwinoverlap.Value{1}/100;
end
OPTIONS.isMirror = 0;
case 'morlet'
Expand All @@ -178,15 +153,16 @@
OPTIONS.MorletFwhmTc = tfOPTIONS.MorletFwhmTc;
if strcmpi(sProcess.options.timeres.Value, 'windowed')
OPTIONS.WinLen = sProcess.options.avgwinlength.Value{1};
%OPTIONS.WinOverlap = sProcess.options.avgwinoverlap.Value{1}/100;
OPTIONS.WinOverlap = sProcess.options.avgwinoverlap.Value{1}/100;
end
case 'fourier'
case 'stft'
OPTIONS.Freqs = [];
OPTIONS.WinLen = sProcess.options.fftlength.Value{1};
OPTIONS.WinOverlap = sProcess.options.fftoverlap.Value{1}/100;
OPTIONS.MaxFreq = sProcess.options.maxfreq.Value{1};
OPTIONS.StftWinLen = tfOPTIONS.StftWinLen;
OPTIONS.StftWinOvr = tfOPTIONS.StftWinOvr/100;
OPTIONS.MaxFreq = tfOPTIONS.StftFrqMax;
if strcmpi(sProcess.options.timeres.Value, 'windowed')
OPTIONS.nAvgLen = sProcess.options.avgwinnum.Value{1};
OPTIONS.WinLen = sProcess.options.avgwinlength.Value{1};
OPTIONS.WinOverlap = sProcess.options.avgwinoverlap.Value{1}/100;
end
end
% Keep time or not; now option, no longer separate process
Expand Down

0 comments on commit 9ab8ad6

Please sign in to comment.