Skip to content

Commit

Permalink
Merge pull request #9 from sccn/develop
Browse files Browse the repository at this point in the history
Fixing bug to add NSG section and adding option to opt-out if paremet…
  • Loading branch information
nucleuscub authored Jun 17, 2020
2 parents 1155e0a + 7b5018a commit c473b76
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions pop_pac.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
% when creating surrogate data. Default: [0.05]
% forcecomp - [0,1] Flag to force (1) or not (0) the computation of PAC
% in the case it is detected that the measure has been
% computed already. Default:[0]
% computed already or the parameters used are different to the ones saved.
% Default:[0]
% Outputs:
% EEG - EEGLAB EEG structure. Results of computing CFC are
% stored in EEG.etc.pac
Expand Down Expand Up @@ -209,18 +210,18 @@
callback_chkcbx_logphs = 'set(findobj(''tag'',''chckbx_logamp''), ''value'', get(findobj(''tag'',''chckbx_logphs''),''value''))';
callback_chkcbx_logamp = 'set(findobj(''tag'',''chckbx_logphs''), ''value'', get(findobj(''tag'',''chckbx_logamp''),''value''))';

if nsginstalled_flag
guiheight = 12;
guiwidth = 2.6;
nsgdefaultopt = ['''runtime'',' num2str(g.runtime) ',''jobid'',''' g.jobid ''''];
nsgmenugeom = {{guiwidth guiheight [0 10] [1 1]} {guiwidth guiheight [0.5 10] [0.5 1]}...
{guiwidth guiheight [0.1 11] [1 1]} {guiwidth guiheight [0.5 11] [2.1 1]}...
{guiwidth guiheight [0 12] [1 1]}};
nsgmenuuilist = {{'style' 'text' 'string' 'Compute via NSG' 'fontweight' 'bold'} {'style' 'checkbox' 'tag' 'chckbx_nsgt' 'callback' nsgcheck 'value' fastif(strcmpi(g.compflag,'nsg'), 1, 0)}...
{'style' 'text' 'string' 'NSG options'} {'style' 'edit' 'string' nsgdefaultopt 'tag' 'nsgopt' 'enable' fastif( strcmpi(g.compflag,'nsg'), 'on','off')}...
{}};
if nsginstalled_flag
nsgdefaultopt = ['''runtime'',' num2str(g.runtime) ',''jobid'',''' g.jobid ''''];
nsgmenugeom = {{guiwidth guiheight [0 10] [1 1]} {guiwidth guiheight [0.5 10] [0.5 1]}...
{guiwidth guiheight [0.1 11] [1 1]} {guiwidth guiheight [0.5 11] [2.1 1]}...
{guiwidth guiheight [0 12] [1 1]}};
nsgmenuuilist = {{'style' 'text' 'string' 'Compute via NSG' 'fontweight' 'bold'} {'style' 'checkbox' 'tag' 'chckbx_nsgt' 'callback' nsgcheck 'value' fastif(strcmpi(g.compflag,'nsg'), 1, 0)}...
{'style' 'text' 'string' 'NSG options'} {'style' 'edit' 'string' nsgdefaultopt 'tag' 'nsgopt' 'enable' fastif( strcmpi(g.compflag,'nsg'), 'on','off')}...
{}};
else
guiheight = 9
guiheight = 9;
nsgmenugeom = {{guiwidth guiheight [0 10] [1 1]}};
nsgmenuuilist = {{}};
end
Expand Down Expand Up @@ -363,7 +364,7 @@
g.freq2_trialindx = 1:dim_trial;
end

% Check if parameters are the sa
% Check if parameters are the same
%--
if ~g.cleanup
methodindx = find(strcmp(options,'method' ));
Expand All @@ -372,7 +373,22 @@
optionshash = gethashcode(std_serialize({'pooldata', pooldata, opttmp{:}}));
if isfield(EEG.etc,'eegpac') && isfield(EEG.etc.eegpac, 'cache')
[~, tmpstruct] = eeg_cache(EEG.etc.eegpac(1).cache, optionshash);
if isempty(tmpstruct)
if isempty(tmpstruct)
if ~g.forcecomp
prompt = 'PACTools is about to remove previous saved PAC computations:';
guititle = 'pop_pac - PAC results deletion';
abortcomp = 'Exit';
ignorewarn = 'Continue';
answer = questdlg2(prompt,guititle,abortcomp,ignorewarn,ignorewarn);

switch answer
case 'Continue'
disp('pop_pac: Proceeding to delete saved PAC results per user request');
case 'Exit'
disp('pop_pac: PAC computation has been canceled per user request. If you want to avoid this check use the ''forcecomp'' argument');
return;
end
end
% Cleanup if different parameters
EEG.etc.pacplotopt = [];
EEG.etc.eegpac = [];
Expand Down

0 comments on commit c473b76

Please sign in to comment.