From 9ab8ad61d418591366f51648d7299779739362e0 Mon Sep 17 00:00:00 2001 From: rcassani Date: Wed, 9 Aug 2023 11:20:05 -0400 Subject: [PATCH] Update GUI: WindowOverlap and STFT `process_cohere1n` --- toolbox/process/functions/process_cohere1n.m | 60 ++++++-------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/toolbox/process/functions/process_cohere1n.m b/toolbox/process/functions/process_cohere1n.m index a307d6166..8e6d8aa81 100644 --- a/toolbox/process/functions/process_cohere1n.m +++ b/toolbox/process/functions/process_cohere1n.m @@ -64,55 +64,30 @@ sProcess.options.label2.Comment = 'Time-frequency decomposition:'; 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', 'Time resolution:'; ... '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 = '   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 = '   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 = '   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 = '   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:'; ... @@ -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) @@ -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' @@ -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