Skip to content

Commit

Permalink
script automagic
Browse files Browse the repository at this point in the history
  • Loading branch information
Nina Forde committed Jan 25, 2022
1 parent 7a429d0 commit 09fd53a
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
Binary file added figures/articke fig2/100sujetseeglabfinal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/articke fig2/janvier20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions src/automagic/janvier/script25janv.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
%Parameter=load('/udd/nforde/Nina/StageEEGpre/data/RAWformat_Test4_results/project_state.mat')
restoredefaultpath;
clear all;
clc; %First, clean the environment

addpath( '/home/nforde/Documents/StageEEGpre/dependencies/automagic-master');


addAutomagicPaths();

name = '24janv2';
dataFolder = '/home/nforde/Documents/StageEEGpre/data/formatBIDS';
resultsFolder = '/home/nforde/Documents/StageEEGpre/data/formatBIDS_24janv_results2';
ext = '.dat';

% Params= struct('FilterParams', struct('high', struct('freq', 0.1000, 'order', []),... % Default order for filtering
% 'low', struct('freq', 35, 'order', [])),...
% 'CRDParams', struct([]),...
% 'PrepParams', struct('lineFrequencies', 50), ...
% 'HighvarParams', struct('sd', 25,...
% 'cutoff', 100, ...
% 'rejRatio', 0.5000), ...
% 'MinvarParams', struct('sd', 1),...
% 'InterpolationParams', struct('method', 'spherical'), ...
% 'ICLabelParams', struct([]),...
% 'EEGSystem', struct('name', 'EGI',...
% 'sys10_20', 0, ...
% 'locFile', '', ...
% 'refChan', struct('idx', []), ...
% 'fileLocType', '',...
% 'eogChans', [], ...
% 'tobeExcludedChans', []), ...
% 'Settings', struct('trackAllSteps', 1, ...
% 'pathToSteps', '/allSteps.mat',...
% 'colormap','Default',...
% 'sortChans', 0)...
% );

Params=load('/home/nforde/Documents/StageEEGpre/data/formatBIDS_24janv_results2/project_state.mat');
Params=Params.self.params;
sRate= [];
VisualisationParams = struct();





% Template for all the parameters



project = Project(name, dataFolder, resultsFolder, ext, Params, VisualisationParams,sRate);
project.preprocessAll();
%project.interpolateSelected();
37 changes: 37 additions & 0 deletions src/automagic/janvier/segmentation.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
%dd
restoredefaultpath;
clear all;
clc;

addpath(genpath('/home/nforde/Documents/StageEEGpre/dependencies/article/MATLAB-EEG-preProcessing-master'))% pour doSegment
addpath(genpath('/home/nforde/Documents/StageEEGpre/dependencies/eeglab_current/eeglab2021.1'))% pour pop rmbase


dataFolder = '/home/nforde/Documents/StageEEGpre/data/formatBIDS_24janv_results2/sujets2';
cd(dataFolder)
filenames = dir('allSteps_RewardProcessing*') %Compile list of all data


for participant = 1:2%Cycle through participants

%Get participant name information
disp(['Participant: ', num2str(participant)]) %Display current participant being processed
participant_number = strsplit(filenames(participant).name(1:end-4),'_') %Split filename into components
participant_varname = ['segmented',participant_number{3}] %Create new file name
EEG = []; %Clear past data
file=load(filenames(participant).name); %Load participant output
EEG=file.EEGFinal




%Determine markers of interest for WAV later
markers = {'S110','S111'}; %Loss, win


[EEG] = doSegmentData(EEG,markers,[-500 1498]); %Segment Data (S110 = Loss, S111 = Win). The segment window of interest is -200 to 1000ms, and we here add 300 ms before and after this because time-frequency edge artifacts (this is different than the first pass because we were being more conservative then)
%baseline correction
EEG = pop_rmbase( EEG, [-200/1000,0]);
save(participant_varname,'EEG') %Save the current output

end

0 comments on commit 09fd53a

Please sign in to comment.