From dd1d1af47ce26dc91c9a6cd3de5d1ed212cf59e0 Mon Sep 17 00:00:00 2001 From: shanemckeon Date: Fri, 22 Nov 2024 16:27:13 -0500 Subject: [PATCH] updating gitignore and preproc function --- .gitignore | 2 ++ Preprocessing_Functions/all_remarked_set.m | 2 +- .../preprocessing_pipeline.m | 6 ++-- .../run_preprocessing_pipeline.m | 29 +++++++------------ 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 91af1de..d50bb39 100755 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,5 @@ choice-landscape/ 0c43526d20387f01a0f149d0888f1f5d27d85850 preprocessed_data/ Signal_Complexity/ +EEGcoordinates/ +attic/ diff --git a/Preprocessing_Functions/all_remarked_set.m b/Preprocessing_Functions/all_remarked_set.m index 9fbd30c..45bd666 100755 --- a/Preprocessing_Functions/all_remarked_set.m +++ b/Preprocessing_Functions/all_remarked_set.m @@ -1,4 +1,4 @@ -function [setfiles] = all_remarked_set(setfilesDir, varargin) +function [setfiles] = all_remarked_set(setfilesDir,varargin) % ALL_REMARKED_SET - return cell array of paths to initial set files % handle options p = inputParser; diff --git a/Preprocessing_Functions/preprocessing_pipeline.m b/Preprocessing_Functions/preprocessing_pipeline.m index 0f46090..1d01937 100755 --- a/Preprocessing_Functions/preprocessing_pipeline.m +++ b/Preprocessing_Functions/preprocessing_pipeline.m @@ -15,8 +15,8 @@ subj_files = file_locs(inputfile, outpath, task); % to know how far your script is with running -fprintf('==========\n%s:\n\t Initial Preprocessing(%s,%f,%f,%s)\n',... - currentName, inputfile, lowBP, topBP, outpath) +fprintf('==========\n%s:\n\t Initial Preprocessing(%s,%f,%f,%s,%s)\n',... + currentName, inputfile, lowBP, topBP, outpath,task) % where to save things @@ -61,7 +61,7 @@ return end -if condition == 1 +if condition == 1 xEEG = load_if_exists(subj_files.filter); end diff --git a/Preprocessing_Functions/run_preprocessing_pipeline.m b/Preprocessing_Functions/run_preprocessing_pipeline.m index 1358118..07c76f5 100755 --- a/Preprocessing_Functions/run_preprocessing_pipeline.m +++ b/Preprocessing_Functions/run_preprocessing_pipeline.m @@ -33,32 +33,24 @@ % gather all file paths for all subjects remarked data setfilesDir = [taskdirectory, '/remarked/1*_20*.set']; setfiles = all_remarked_set(setfilesDir); - n = size(setfiles,1); %number of EEG sets to preprocess -% first steps of preprocessing then epoch anti data first so we do not lose events -if task == "anti" - path_data = [taskdirectory '/remarked/']; - epoch_folder = [taskdirectory '/epoched/']; - EEGfileNames = dir([path_data, '/*_Rem.set']); - - revisar = {}; - for currentEEG = 1:size(EEGfileNames,1) - % skipping weird participants for now (38 = 11632_201901001, 87 = 11681_2018011, 100 = 11688-20190614, 291 = 11821_320210630) - if currentEEG == 38 || currentEEG == 87 || currentEEG == 100 || currentEEG == 291 - continue - end - filename = [EEGfileNames(currentEEG).name]; - inputfile = [path_data,filename]; - revisar{currentEEG} = epochAS(inputfile,epoch_folder,task,taskdirectory,condition,lowBP,topBP); - end +% some participants are left out from lines 33 and 34 for AS +if task=="anti" + setfilesDir = [taskdirectory, '/remarked/*.set']; + setfiles = all_remarked_setAS(setfilesDir); + n = length(setfiles); end % loop through every subject to preprocess for i = 1:n inputfile = setfiles{i}; try - preprocessing_pipeline(inputfile, taskdirectory, lowBP, topBP, FLAG, condition, task) + if task ~= "anti" + preprocessing_pipeline(inputfile, taskdirectory, lowBP, topBP, FLAG, condition, task) + elseif task == "anti" + preprocessing_pipelineAS(inputfile,taskdirectory,lowBP,topBP,FLAG,condition,task) + end catch e fprintf('Error processing "%s": %s\n',inputfile, e.message) for s=e.stack @@ -67,6 +59,7 @@ end end + %% select ICA values to reject ICA_Path = [taskdirectory '/ICAwhole'];