From d3c7a6845a01ef356d6f7a92dde00b0ef86edb8e Mon Sep 17 00:00:00 2001 From: Nina Forde Date: Tue, 25 Jan 2022 14:28:54 +0100 Subject: [PATCH] code eeglab de janvier --- data/README.md | 7 +++++++ src/codeR/fig2A.R | 7 +------ src/eeglabcode/janvier/100 sujets/version100sujets.m | 8 ++++---- src/eeglabcode/janvier/10sujets/sujetsv2.m | 11 +++++++---- src/eeglabcode/janvier/figure1/variablespourfig1.m | 6 +++--- src/eeglabcode/janvier/vhdr copiemod/eeglabhist5.m | 2 +- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/data/README.md b/data/README.md index e69de29..dbe9d36 100644 --- a/data/README.md +++ b/data/README.md @@ -0,0 +1,7 @@ +Automagic ne peut lire que les format de données BIDS ie on met sous un dossier tous les sujets et on donne ce dossier parent comme dossier source +Automagic crée tout seul son dossir résultat, si on le souhaite il fournit une variable project_stat.mat qui contient tous les paramètres nécessaires pour re créer le projet. Exemple: params (pour les options de preprocessing) + +Raw Data : c'est les données non pré-traitées fournies par l'article +Stage 2.3 : c'est les données déjà prétraitées + +ChanlocsMaster.mat : localisation des electrodes diff --git a/src/codeR/fig2A.R b/src/codeR/fig2A.R index ea22a48..f2798c2 100644 --- a/src/codeR/fig2A.R +++ b/src/codeR/fig2A.R @@ -9,7 +9,7 @@ library(Rfast) library(Hmisc) -nbparticipants=90; +nbparticipants=100; #Plotting Setup @@ -50,11 +50,6 @@ FFT_APA_Style = theme(axis.line.x = element_line(color="black", size = 0.5), #Ad data = read.csv('RewP_Waveforms.csv',header = FALSE) #Load ERP data -pdata = read.csv('RewP_Waveforms_AllPs.csv',header = FALSE) #Load participant ERP data -pdata$subject = as.factor(1:nbparticipants) #Add participant ID -pdata$condition = as.factor(c(rep(1,nbparticipants),rep(2,nbparticipants))) #Add condition ID -pdata_original = pdata #Re-allocate variable so not to lose it (later it gets modified) -data_Latency = read.csv('RewP_Latency.csv',header = FALSE) #Load ERP peak time data diff --git a/src/eeglabcode/janvier/100 sujets/version100sujets.m b/src/eeglabcode/janvier/100 sujets/version100sujets.m index 615bea0..64098f3 100644 --- a/src/eeglabcode/janvier/100 sujets/version100sujets.m +++ b/src/eeglabcode/janvier/100 sujets/version100sujets.m @@ -17,8 +17,8 @@ dirdata='/home/nforde/Documents/StageEEGpre/data/Raw Data Part 13'; cd(dirdata); filenames = dir('*.vhdr') - -for participant = 10:length(filenames) %Cycle through participants +nb=100; +for participant = 50:nb %Cycle through participants %Get participant name information @@ -67,7 +67,7 @@ [ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET); %identifier differents artifacts correspondants -[EEG, varargout] = pop_iclabel(EEG, 'default') +[EEG, varargout] = pop_iclabel(EEG, 'default'); EEG = eeg_checkset( EEG ); @@ -94,7 +94,7 @@ % EEG = eeg_checkset( EEG ); % eeglab redraw; %baseline correction -EEG = pop_rmbase( EEG, [-0,2 0] ,[]); +EEG = pop_rmbase( EEG, [-200/1000,0]); %[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 5,'gui','off'); %bad segment diff --git a/src/eeglabcode/janvier/10sujets/sujetsv2.m b/src/eeglabcode/janvier/10sujets/sujetsv2.m index 0bf8ed9..e40a39c 100644 --- a/src/eeglabcode/janvier/10sujets/sujetsv2.m +++ b/src/eeglabcode/janvier/10sujets/sujetsv2.m @@ -19,7 +19,7 @@ filenames = dir('*.vhdr') %for participant = 1:length(filenames) %Cycle through participants -for participant = 1:1%Cycle through participants +for participant = 1:2%Cycle through participants %Get participant name information disp(['Participant: ', num2str(participant)]) %Display current participant being processed @@ -68,7 +68,7 @@ [ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET); %identifier differents artifacts correspondants -[EEG, varargout] = pop_iclabel(EEG, 'default') +[EEG, varargout] = pop_iclabel(EEG, 'default'); EEG = eeg_checkset( EEG ); @@ -95,9 +95,12 @@ % EEG = eeg_checkset( EEG ); % eeglab redraw; %baseline correction -EEG = pop_rmbase( EEG, [-200 0] ,[]); +EEG = pop_rmbase( EEG, [-200/1000,0]); %[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 5,'gui','off'); - + + %Baseline Correction +%[EEG] = doBaseline(EEG,[-200/1000,0]); %Baseline correction in ms + %bad segment % EEG = eeg_checkset( EEG ); EEG = pop_eegthresh(EEG,1,[1:31] ,-50,50,-1,1.998,0,0); diff --git a/src/eeglabcode/janvier/figure1/variablespourfig1.m b/src/eeglabcode/janvier/figure1/variablespourfig1.m index ef78743..aa2afca 100644 --- a/src/eeglabcode/janvier/figure1/variablespourfig1.m +++ b/src/eeglabcode/janvier/figure1/variablespourfig1.m @@ -21,9 +21,9 @@ cd(dirdata); %Find and change working folder to raw EEG data %Find and change working folder to saved data from last for loop filenames = dir('RewardProcessing_S2Final*'); %Compile list of all data - +nb=100; % for participant = 1:length(filenames) %Cycle through participants -for participant = 1:90 %Cycle through participants +for participant = 1:nb %Cycle through participants disp(['Participant: ', num2str(participant)]); %Display current participant being processed @@ -76,7 +76,7 @@ WAV_data1 = permute(squeeze(All_WAV(26,:,151:750,1,:)),[3,1,2]); %Extract participants time-frequency condition 1 WAV_data2 = permute(squeeze(All_WAV(26,:,151:750,2,:)),[3,1,2]); %Extract participants time-frequency condition 2 WAV_diff = WAV_data1-WAV_data2; %Create difference wave -nb=3; + for participant = 1:nb %Cycle through participants WAV_Delta(participant,:,:) = squeeze(WAV_diff(participant,:,:)).*delta_extract; %Confine data to significant delta activity for difference WAV WAV_Theta(participant,:,:) = squeeze(WAV_diff(participant,:,:)).*theta_extract; %Confine data to significant theta activity for difference WAV diff --git a/src/eeglabcode/janvier/vhdr copiemod/eeglabhist5.m b/src/eeglabcode/janvier/vhdr copiemod/eeglabhist5.m index 65c4228..673e6b2 100644 --- a/src/eeglabcode/janvier/vhdr copiemod/eeglabhist5.m +++ b/src/eeglabcode/janvier/vhdr copiemod/eeglabhist5.m @@ -1,3 +1,3 @@ -% EEGLAB history file generated on the 19-Jan-2022 +% EEGLAB history file generated on the 21-Jan-2022 % ------------------------------------------------ eeglab redraw;