Skip to content

Commit

Permalink
updating gitignore and preproc function
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneMcKeon committed Nov 22, 2024
1 parent 52381c1 commit dd1d1af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ choice-landscape/
0c43526d20387f01a0f149d0888f1f5d27d85850
preprocessed_data/
Signal_Complexity/
EEGcoordinates/
attic/
2 changes: 1 addition & 1 deletion Preprocessing_Functions/all_remarked_set.m
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Preprocessing_Functions/preprocessing_pipeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,7 +61,7 @@
return
end

if condition == 1
if condition == 1
xEEG = load_if_exists(subj_files.filter);
end

Expand Down
29 changes: 11 additions & 18 deletions Preprocessing_Functions/run_preprocessing_pipeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -67,6 +59,7 @@
end
end


%% select ICA values to reject

ICA_Path = [taskdirectory '/ICAwhole'];
Expand Down

0 comments on commit dd1d1af

Please sign in to comment.