Skip to content

Commit 0187eae

Browse files
committed
Updated PREP to version 0.55.4
1 parent 347435f commit 0187eae

File tree

9 files changed

+95
-26
lines changed

9 files changed

+95
-26
lines changed

PrepPipeline/examples/runVEPPrepPipeline.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
params.lineFrequencies = [60, 120, 180, 212, 240];
1616
params.referenceChannels = 1:64;
1717
params.evaluationChannels = 1:64;
18-
params.rereferencedChannels = 1:83;
18+
params.rereferencedChannels = 1:70;
1919
params.detrendChannels = 1:70;
2020
params.lineNoiseChannels = 1:70;
2121

@@ -32,7 +32,7 @@
3232
%% Get the filelist
3333
fileList = getFileList('FILES', indir);
3434
%% Run the pipeline
35-
for k = 1%:length(fileList)
35+
for k = 1:length(fileList)
3636
[~, thisName, ~] = fileparts(fileList{k});
3737
EEG = pop_loadset(fileList{k});
3838
params.name = thisName;

PrepPipeline/examples/runVEPPrepReport.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
%% Run the pipeline
2525

2626
for k = 1:length(inNames)
27-
sessionReportName = [inNames{k}(1:(end-4)) '.pdf'];
27+
[~, theName, theExt] = fileparts(inNames{k});
28+
if ~strcmpi(theExt, '.set') && ~strcmpi(theExt, '.mat')
29+
continue;
30+
end
31+
sessionReportName = [theName '.pdf'];
2832
fname = [dataDir filesep inNames{k}];
2933
load(fname, '-mat');
3034
sessionFileName = [summaryFolder filesep sessionReportName];

PrepPipeline/pop_prepPipeline.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
if isempty(tmp)
4747
myPath = fileparts(which('prepPipeline'));
4848
addpath(genpath(myPath));
49-
end;
49+
end
5050

5151
%% Pop up window
5252
if nargin < 2

PrepPipeline/prepPipeline.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
computationTimes= struct( 'detrend', 0, 'lineNoise', 0, 'reference', 0);
4242
errorMessages = struct('status', 'good', 'boundary', 0, ...
4343
'detrend', 0, 'lineNoise', 0, 'reference', 0, ...
44-
'postprocess', 0);
44+
'postProcess', 0);
4545
[backupOptionsFile, currentOptionsFile, warningsState] = setupForEEGLAB();
4646
finishup = onCleanup(@() cleanup(backupOptionsFile, currentOptionsFile, ...
4747
warningsState));

PrepPipeline/prepPostProcess.m

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,48 @@
99
warningsState));
1010

1111
%% Check the parameters
12-
if nargin < 1 || ~isstruct(EEG)
13-
error('postProcess:NotEnoughArguments', 'first argument must be a structure');
14-
elseif nargin < 2 || ~exist('postIn', 'var') || isempty(postIn)
15-
postIn = struct();
16-
end
17-
if ~isstruct(postIn)
18-
error('postProcess:NoData', 'second argument must be a structure')
19-
end
20-
postOut = struct('keepFiltered', [], 'removeInterpolatedChannels', [], ...
21-
'cleanupReference', []);
22-
defaults = getPrepDefaults(EEG, 'postprocess');
12+
postOut = struct();
2313

24-
[postOut, errors] = checkPrepDefaults(postIn, postOut, defaults);
25-
if ~isempty(errors)
26-
error('postProcess:BadParameters', ['|' sprintf('%s|', errors{:})]);
27-
end
28-
defaults = getPrepDefaults(EEG, 'general');
29-
[postOut, errors] = checkPrepDefaults(postOut, postOut, defaults);
30-
if ~isempty(errors)
31-
error('postProcess:BadGeneralParameters', ['|' sprintf('%s|', errors{:})]);
14+
%% Initial setup
15+
try
16+
%% Check the input
17+
if nargin < 1 || ~isstruct(EEG)
18+
error('postProcess:NotEnoughArguments', 'first argument must be a structure');
19+
elseif nargin < 2 || ~exist('postIn', 'var') || isempty(postIn)
20+
postIn = struct();
21+
end
22+
if ~isstruct(postIn)
23+
error('postProcess:NoData', 'second argument must be a structure')
24+
end
25+
if ~isfield(EEG, 'etc') || ~isfield(EEG.etc, 'noiseDetection') || ...
26+
hasPrepErrors(EEG.etc.noiseDetection)
27+
error('postProcess:NoPrep', 'Prep has not executed or has errors');
28+
end
29+
30+
%% Set up the output structure
31+
postOut = struct('keepFiltered', [], 'removeInterpolatedChannels', [], ...
32+
'cleanupReference', []);
33+
defaults = getPrepDefaults(EEG, 'postprocess');
34+
35+
[postOut, errors] = checkPrepDefaults(postIn, postOut, defaults);
36+
if ~isempty(errors)
37+
error('postProcess:BadParameters', ['|' sprintf('%s|', errors{:})]);
38+
end
39+
defaults = getPrepDefaults(EEG, 'general');
40+
[postOut, errors] = checkPrepDefaults(postOut, postOut, defaults);
41+
if ~isempty(errors)
42+
error('postProcess:BadGeneralParameters', ['|' sprintf('%s|', errors{:})]);
43+
end
44+
EEG.etc.noiseDetection.postProcess = postOut;
45+
46+
catch mex
47+
errorMessages.setup = ...
48+
['postProcessing failed due to previous issues: ' ...
49+
getReport(mex, 'basic', 'hyperlinks', 'off')];
50+
EEG.etc.noiseDetection.errors.postProcess = errorMessages;
51+
return;
3252
end
33-
EEG.etc.noiseDetection.postProcess = postOut;
34-
53+
3554
%% Perform filtering if requested
3655
try
3756
if postOut.keepFiltered
@@ -100,6 +119,9 @@
100119
end
101120
return;
102121
end
122+
123+
%% If we got this far everything was good
124+
EEG.etc.noiseDetection.errors.postProcess = 0;
103125
end
104126

105127
%% Cleanup callback

PrepPipeline/utilities/getPrepVersion.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
end
77

88
function changeLog = getChangeLog()
9+
changeLog(5) = ...
10+
struct('version', '0', 'status', 'Unreleased', 'date', '', 'changes', '');
11+
12+
changeLog(5).version = '0.55.4';
13+
changeLog(5).status = 'Released';
14+
changeLog(5).date = '7/26/2020';
15+
changeLog(5).changes = { ...
16+
'Correctly restored EEGLAB options after execution'; ...
17+
'Added functions to output errors from etc.noiseDetection'; ...
18+
'Corrected findpeaks naming conflict in Chronux'; ...
19+
'Post process does not execute if Prep had errors'};
20+
921
changeLog(4) = ...
1022
struct('version', '0', 'status', 'Unreleased', 'date', '', 'changes', '');
1123

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function hasErrors = hasPrepErrors(noiseDetection)
2+
% Return false if Prep has executed successfully
3+
%
4+
% Parameters:
5+
% noiseDetection Structure containing prep execution information
6+
% hasErrors (output) true if Prep did not execute or has errors
7+
8+
%% Check for defaults
9+
hasErrors = false;
10+
%% Make sure that noiseDetection has an errors field
11+
if isempty(noiseDetection) || ~isstruct(noiseDetection) ||...
12+
~isfield(noiseDetection, 'errors') || ...
13+
~isstruct(noiseDetection.errors)
14+
hasErrors = true;
15+
return;
16+
end
17+
errors = noiseDetection.errors;
18+
errors = rmfield(errors, 'status');
19+
errorFields = fieldnames(errors);
20+
for k = 1:length(errorFields)
21+
if errors.(errorFields{k}) ~= 0
22+
hasErrors = true;
23+
break;
24+
end
25+
end

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ authorized to reproduce and distribute reprints for Government purposes
3333
notwithstanding any copyright notation herein.
3434

3535
### Releases
36+
Version 0.55.4 Released 7/26/2020
37+
* Correctly restored EEGLAB options after execution
38+
* Added functions to output errors from etc.noiseDetection
39+
* Corrected findpeaks naming conflict in Chronux
40+
* Post process does not execute if Prep had errors
41+
3642
Version 0.55.3 Released 10/19/2017
3743
* Fixed issue with interpolated channels when interpolation order is pre-process
3844
* Fixed issue with correct removal of interpolated channels during post-processing

0 commit comments

Comments
 (0)