|
@@ -0,0 +1,983 @@
|
|
|
+%% Population analysis of the SOA and Figure-Ground data SPIKES =========
|
|
|
+% ------------------------------------------------------------
|
|
|
+% Loads an overview table of data to potentially include, imports the
|
|
|
+% bandpass filtered data and saves it together in a population data file.
|
|
|
+% Once this has been done, it can also directly load this file and work
|
|
|
+% with that.
|
|
|
+
|
|
|
+% 5 pulse version !!
|
|
|
+
|
|
|
+% after collecting data, we can simply load the presaved population file
|
|
|
+presaved = true;
|
|
|
+MeanAlreadySubtracted = true;
|
|
|
+UseSelected = true;
|
|
|
+
|
|
|
+%% load info ============================================================
|
|
|
+% temp code to make table
|
|
|
+% V1FG = cell2table(V1FG_info(2:end,:),'VariableNames',V1FG_info(1,:));
|
|
|
+% s=[];
|
|
|
+% for i=1:size(V1FG.Monkey);
|
|
|
+% if isempty(V1FG.Monkey{i})
|
|
|
+% s=[s;i];
|
|
|
+% end
|
|
|
+% end
|
|
|
+% V1FG(s,:)=[];
|
|
|
+
|
|
|
+% this file contains the info about individual files
|
|
|
+load(fullfile(fld.data,'V1V1_FG_5p.mat'));
|
|
|
+
|
|
|
+%% load data & get spikes ===============================================
|
|
|
+if ~presaved
|
|
|
+ curr_sel = 0;
|
|
|
+ for ff=1:length(V1FG.Day)
|
|
|
+ indstr = V1FG.indeces(ff);
|
|
|
+ sep = find(indstr{1}=='_'==1);
|
|
|
+ sel_files = ...
|
|
|
+ [str2double(indstr{1}(1:sep-1)) str2double(indstr{1}(sep+1:end))];
|
|
|
+ if curr_sel ~= sel_files(1) % only load files once
|
|
|
+ curr_sel=sel_files(1);
|
|
|
+
|
|
|
+ cd(MAT_PATH);
|
|
|
+ if MeanAlreadySubtracted
|
|
|
+ % << artefact removal in raw
|
|
|
+ cd(fullfile(fld.data,'BANDPASS','BP2','500to5000'));
|
|
|
+ else
|
|
|
+ % << first BP version (no artefact removal in raw)
|
|
|
+ cd(fullfile(fld.data,'BANDPASS','BP','500to5000'));
|
|
|
+ end
|
|
|
+
|
|
|
+ CHMap = [1:16;17:32];
|
|
|
+ CHi = [ones(1,16) ones(1,16).*2 ; 1:16 1:16];
|
|
|
+
|
|
|
+ for df=1:2
|
|
|
+ fprintf(['Loading ' filenames{sel_files(df)} '\n']);
|
|
|
+ load(filenames{sel_files(df)},'Data')
|
|
|
+ D(df)=Data; clear Data; %#ok<*SAGROW>
|
|
|
+ t_vis = D(df).Time;
|
|
|
+ end
|
|
|
+ cd(mpath)
|
|
|
+
|
|
|
+ MStime={'none',-50,50 150};
|
|
|
+ StimType={'Homogenous','Figure','Ground'};
|
|
|
+ typenum=0;
|
|
|
+
|
|
|
+ % categorize trials
|
|
|
+ for m=1:length(MStime)
|
|
|
+ for s=1:length(StimType)
|
|
|
+ typenum=typenum+1;
|
|
|
+ Trial(s,m).num = typenum;
|
|
|
+ Trial(s,m).stim=StimType{s};
|
|
|
+ Trial(s,m).ms = MStime{m};
|
|
|
+ Trial(s,m).sel_trials = ...
|
|
|
+ ~isnan(D(CHi(1,1)).Trials(:,3)) & ...
|
|
|
+ D(CHi(1,1)).Trials(:,end)==typenum;
|
|
|
+ Trial(s,m).i =(find(Trial(s,m).sel_trials==1))';
|
|
|
+ TrialType{1,typenum} = StimType{s};
|
|
|
+ TrialType{2,typenum} = MStime{m};
|
|
|
+ TrialType{3,typenum} = Trial(s,m).i;
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+ sC = V1FG.rec_channel(ff);
|
|
|
+ MUA = cell(12,2);
|
|
|
+ for tt = 1:size(TrialType,2)
|
|
|
+ sel_trials = TrialType{3,tt};
|
|
|
+ sel_trials_clean = [];
|
|
|
+
|
|
|
+ % check for artefacts
|
|
|
+ for t = sel_trials
|
|
|
+ sd = std(D(CHi(1,sC)).Signal(:,CHi(2,sC),t));
|
|
|
+ y = D(CHi(1,sC)).Signal(:,CHi(2,sC),t);
|
|
|
+ y(t_vis < -0.4 | t_vis > 0.4)=nan;
|
|
|
+ nsd=10;
|
|
|
+
|
|
|
+ if tt < 4 % no ms
|
|
|
+ % remove ms window
|
|
|
+ y(t_vis > 1) = nan; % never true, because no MS
|
|
|
+ % find exces values
|
|
|
+ if sum(abs(y)>(nsd*sd)) > 0 % excessive values detected
|
|
|
+ else
|
|
|
+ sel_trials_clean=[sel_trials_clean t]; %#ok<*AGROW>
|
|
|
+ end
|
|
|
+ elseif tt >= 4 && tt < 7 % ms @ -50
|
|
|
+ % remove ms window
|
|
|
+ y(t_vis > -0.07 & t_vis < -0.03) = nan; % never true, because no MS
|
|
|
+ % find exces values
|
|
|
+ if sum(abs(y)>(nsd*sd)) > 0 % excessive values detected
|
|
|
+ else
|
|
|
+ sel_trials_clean=[sel_trials_clean t];
|
|
|
+ end
|
|
|
+ elseif tt >= 7 && tt < 10 % ms @ +50
|
|
|
+ % remove ms window
|
|
|
+ y(t_vis > 0.04 & t_vis < 0.08) = nan; % never true, because no MS
|
|
|
+ % find exces values
|
|
|
+ if sum(abs(y)>(nsd*sd)) > 0 % excessive values detected
|
|
|
+ else
|
|
|
+ sel_trials_clean=[sel_trials_clean t];
|
|
|
+ end
|
|
|
+ elseif tt >= 10 % ms @ +150
|
|
|
+ % remove ms window
|
|
|
+ y(t_vis > 0.140 & t_vis < 0.180) = nan; % never true, because no MS
|
|
|
+ % find exces values
|
|
|
+ if sum(abs(y)>(nsd*sd)) > 0 % excessive values detected
|
|
|
+ else
|
|
|
+ sel_trials_clean=[sel_trials_clean t];
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ %================================================
|
|
|
+ % throw out fluctuating trials ------
|
|
|
+ st_all = sel_trials_clean>0;
|
|
|
+ if sel_files(1) == 0 % only a subset of trial with stable signal
|
|
|
+ st_1to16 = sel_trials_clean>=581 & sel_trials_clean<=1050;
|
|
|
+ st_17to32 = sel_trials_clean<=1050;
|
|
|
+ else
|
|
|
+ st_1to16 = st_all;
|
|
|
+ st_17to32 = st_all;
|
|
|
+ end
|
|
|
+ %================================================
|
|
|
+
|
|
|
+ TrialType{4,tt} = sel_trials_clean;
|
|
|
+ TrialType{5,tt} = [st_all;st_1to16;st_17to32];
|
|
|
+
|
|
|
+ if sC<17
|
|
|
+ sel_trials_clean = sel_trials_clean(st_1to16);
|
|
|
+ else
|
|
|
+ sel_trials_clean = sel_trials_clean(st_17to32);
|
|
|
+ end
|
|
|
+ TrialType{6,tt} = sel_trials_clean;
|
|
|
+
|
|
|
+ BL = mean( D(CHi(1,sC)).Signal(:,CHi(2,sC),sel_trials_clean),3);
|
|
|
+ end
|
|
|
+
|
|
|
+ % threshold spikes ================================================
|
|
|
+ fprintf('Getting spikes\n');
|
|
|
+ TH = [V1FG.TH1(ff) V1FG.TH2(ff)];
|
|
|
+ if TH(1)<0
|
|
|
+ TH=[-TH 1];
|
|
|
+ else
|
|
|
+ TH=[TH -1];
|
|
|
+ end
|
|
|
+ PosNeg = TH(3);
|
|
|
+ for tt = [1:4,7,10:12]
|
|
|
+ spikes(tt).rast=[];
|
|
|
+ n=0;
|
|
|
+ for i=TrialType{6,tt} % 3 is all trials of the type, 4 is cleaned
|
|
|
+ n=n+1;
|
|
|
+ if MeanAlreadySubtracted
|
|
|
+ y=D(CHi(1,sC)).Signal(:,CHi(2,sC),i);
|
|
|
+ else
|
|
|
+ BL = mean( D(CHi(1,sC)).Signal(:,CHi(2,sC),TrialType{6,tt}),3);
|
|
|
+ y=D(CHi(1,sC)).Signal(:,CHi(2,sC),i)-BL;
|
|
|
+ end
|
|
|
+ [yp,xp] = findpeaks(double(PosNeg.*y),t_vis,...
|
|
|
+ 'MinPeakHeight',TH(1));
|
|
|
+ xp(yp>TH(2))=[];
|
|
|
+ yp(yp>TH(2))=[];
|
|
|
+
|
|
|
+ % REMOVE SPIKES THAT ARE WIWTHIN THE ARTEFACT WINDOW ======
|
|
|
+ if tt<4
|
|
|
+ msi=0;
|
|
|
+ elseif tt<7
|
|
|
+ msi=1;
|
|
|
+ elseif tt<10
|
|
|
+ msi=2;
|
|
|
+ else
|
|
|
+ msi=3;
|
|
|
+ end
|
|
|
+ if msi>0
|
|
|
+ msw_5p = [ ...
|
|
|
+ -0.058: 0.005:-0.0375 ;...
|
|
|
+ 0.050: 0.005: 0.0714 ;...
|
|
|
+ 0.150: 0.005: 0.1714 ];
|
|
|
+ msw_w = 0.001;
|
|
|
+ for ii=1:size(msw_5p,2)
|
|
|
+ selspk = (xp >= msw_5p(msi,ii) & xp <= msw_5p(msi,ii)+msw_w);
|
|
|
+ xp(selspk)=[];
|
|
|
+ yp(selspk)=[];
|
|
|
+ end
|
|
|
+ end
|
|
|
+ spikes(tt).rast=[spikes(tt).rast; xp' yp ones(size(yp))*n];
|
|
|
+ end
|
|
|
+
|
|
|
+ % new: sliding window
|
|
|
+ SlidWin.width = 0.010;
|
|
|
+ SlidWin.step = 0.001;
|
|
|
+ SlidWin.Min = -0.200;
|
|
|
+ SlidWin.Max = 0.350;
|
|
|
+
|
|
|
+ spikes(tt).bin=[];spikes(tt).n=[];
|
|
|
+ for t = (SlidWin.Min-(SlidWin.width/2)):SlidWin.step:(SlidWin.Max-(SlidWin.width/2))
|
|
|
+ y=sum(spikes(tt).rast(:,1) >= t & spikes(tt).rast(:,1) <= t+SlidWin.width)/...
|
|
|
+ (SlidWin.width*max(spikes(tt).rast(:,3)));
|
|
|
+ spikes(tt).bin=[spikes(tt).bin t+(SlidWin.width/2)];
|
|
|
+ spikes(tt).n=[spikes(tt).n; y];
|
|
|
+ end
|
|
|
+ BinSpecs=[-200 10 400]./1000;
|
|
|
+
|
|
|
+ end
|
|
|
+ % collect
|
|
|
+ V1_FG(ff).info = V1FG(ff,:);
|
|
|
+ V1_FG(ff).spikes = spikes;
|
|
|
+ V1_FG(ff).TrialType = TrialType;
|
|
|
+ V1_FG(ff).SlidWin=SlidWin;
|
|
|
+ V1_FG(ff).BL = BL;
|
|
|
+ BL=[];
|
|
|
+ for tr = unique(V1_FG(ff).spikes(2).rast(:,3))'
|
|
|
+ [n,b] = ...
|
|
|
+ hist(V1_FG(ff).spikes(2).rast(V1_FG(ff).spikes(2).rast(:,3)==tr,1),...
|
|
|
+ BinSpecs(1):BinSpecs(2):BinSpecs(3));
|
|
|
+ BL=[BL nanmean(n(b>-0.1 & b<0))./BinSpecs(2)];
|
|
|
+ end
|
|
|
+ PK=max(V1_FG(ff).spikes(2).n(V1_FG(ff).spikes(2).bin>0 & V1_FG(ff).spikes(2).bin<0.06));
|
|
|
+ V1_FG(ff).SNR=(PK-mean(BL))/std(BL);
|
|
|
+ end
|
|
|
+ V1_FG_info = V1FG;
|
|
|
+ if MeanAlreadySubtracted
|
|
|
+ save(fullfile(fld.data,'V1FG_Selected2_5p'),...
|
|
|
+ 'V1_FG','V1_FG_info','V1FG','-v7.3');
|
|
|
+ else
|
|
|
+ save(fullfile(fld.data,'V1FG_Selected_5p'),...
|
|
|
+ 'V1_FG','V1_FG_info','V1FG','-v7.3');
|
|
|
+ end
|
|
|
+else
|
|
|
+ if MeanAlreadySubtracted
|
|
|
+ fprintf('Loading V1FG_Selected2_5p.mat\n');
|
|
|
+ load(fullfile(fld.data,'V1FG_Selected2_5p.mat'))
|
|
|
+ else
|
|
|
+ fprintf('Loading V1FG_Selected_5p.mat\n');
|
|
|
+ load(fullfile(fld.data,'V1FG_Selected_5p.mat'))
|
|
|
+ end
|
|
|
+end
|
|
|
+fprintf('DONE!\n');
|
|
|
+
|
|
|
+for entry = 1:size(V1_FG_info.notes,1)
|
|
|
+ if strcmp(V1_FG_info.notes{entry},'ReverseFG')
|
|
|
+ F0 = V1_FG(entry).TrialType(3:end,2);
|
|
|
+ G0 = V1_FG(entry).TrialType(3:end,3);
|
|
|
+ F1 = V1_FG(entry).TrialType(3:end,11);
|
|
|
+ G1 = V1_FG(entry).TrialType(3:end,12);
|
|
|
+ V1_FG(entry).TrialType(3:end,2)=G0;
|
|
|
+ V1_FG(entry).TrialType(3:end,3)=F0;
|
|
|
+ V1_FG(entry).TrialType(3:end,11)=G1;
|
|
|
+ V1_FG(entry).TrialType(3:end,12)=F1;
|
|
|
+
|
|
|
+ F0 = V1_FG(entry).spikes(2);
|
|
|
+ G0 = V1_FG(entry).spikes(3);
|
|
|
+ F1 = V1_FG(entry).spikes(11);
|
|
|
+ G1 = V1_FG(entry).spikes(12);
|
|
|
+ V1_FG(entry).spikes(2)=G0;
|
|
|
+ V1_FG(entry).spikes(3)=F0;
|
|
|
+ V1_FG(entry).spikes(11)=G1;
|
|
|
+ V1_FG(entry).spikes(12)=F1;
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+%% select a subset of combinations ======================================
|
|
|
+% opens a gui for data selection if not already donw
|
|
|
+if ~UseSelected
|
|
|
+ global select
|
|
|
+ select.monkey = 'Both'; select.vis = 'Yes';
|
|
|
+ select.fg = 'Yes'; select.ms = 'Any'; select.SNR = median([V1_FG.SNR]);
|
|
|
+ h = SelectFG;
|
|
|
+ smw=5;
|
|
|
+
|
|
|
+ % For SUP FIGURE 6 A-D: Both, VIS+, FG-BOTH, +|-, SNR>1
|
|
|
+ % For SUP FIGURE 6 F-I: Manny, VIS+, FG+, +|-, SNR>1
|
|
|
+end
|
|
|
+%% UpdateSelection ======================================================
|
|
|
+% updates variable after gui changes
|
|
|
+if ~UseSelected
|
|
|
+ for UpdateSelection=1
|
|
|
+ V1FG.visual(76)=0;
|
|
|
+ switch select.monkey
|
|
|
+ case 'Darwin'
|
|
|
+ monksel = strcmp(V1FG.Monkey,'Darwin');
|
|
|
+ case 'Manny'
|
|
|
+ monksel = strcmp(V1FG.Monkey,'Manny');
|
|
|
+ case 'Both'
|
|
|
+ monksel = ~strcmp(V1FG.Monkey,'NONSENSE');
|
|
|
+ end
|
|
|
+
|
|
|
+ switch select.vis
|
|
|
+ case 'Yes'
|
|
|
+ vissel = V1FG.visual==1;
|
|
|
+ case 'No'
|
|
|
+ vissel = V1FG.visual==0;
|
|
|
+ case 'Both'
|
|
|
+ vissel = V1FG.visual>=0;
|
|
|
+ end
|
|
|
+
|
|
|
+ switch select.fg
|
|
|
+ case 'Yes'
|
|
|
+ fgsel = V1FG.FG==1;
|
|
|
+ case 'No'
|
|
|
+ fgsel = V1FG.FG==0;
|
|
|
+ case 'Both'
|
|
|
+ fgsel = V1FG.FG>=0;
|
|
|
+ end
|
|
|
+
|
|
|
+ switch select.ms
|
|
|
+ case 'Any'
|
|
|
+ mssel = V1FG.HT_ms_exc>=0;
|
|
|
+ case 'Enhancement only'
|
|
|
+ mssel = V1FG.HT_ms_exc==1 & V1FG.HT_ms_inh==0;
|
|
|
+ case 'Supression only'
|
|
|
+ mssel = V1FG.HT_ms_exc==0 & V1FG.HT_ms_inh==1;
|
|
|
+ case 'Enhanced or Supressed'
|
|
|
+ mssel = V1FG.HT_ms_exc==1 | V1FG.HT_ms_inh==1;
|
|
|
+ case 'Enhanced & Supressed'
|
|
|
+ mssel = V1FG.HT_ms_exc==1 & V1FG.HT_ms_inh==1;
|
|
|
+ case 'None'
|
|
|
+ mssel = V1FG.HT_ms_exc==0 & V1FG.HT_ms_inh==0;
|
|
|
+ end
|
|
|
+
|
|
|
+ snrsel = [V1_FG.SNR]>=select.SNR;
|
|
|
+ snrsel = snrsel';
|
|
|
+
|
|
|
+ sel = mean([mssel fgsel vissel monksel snrsel],2)==1;
|
|
|
+ selstring = ['M: ' select.monkey ', Vis: ' select.vis ', FG: ' select.fg ', MS: ' select.ms];
|
|
|
+ end
|
|
|
+ %
|
|
|
+ N=sum(sel);
|
|
|
+ fprintf(['Number of stim-rec combinations in average: ' num2str(N) '\n']);
|
|
|
+
|
|
|
+ for tt=[1:4,7,10:12]
|
|
|
+ Avg(tt).y=[];
|
|
|
+ Avg(tt).yb=[];
|
|
|
+ Avg(tt).yn=[];
|
|
|
+ t = V1_FG(1).spikes(1).bin(2:end-1);
|
|
|
+
|
|
|
+ for s=find(sel>0)'
|
|
|
+ y=V1_FG(s).spikes(tt).n(2:end-1)';
|
|
|
+ %yh=V1_FG(s).spikes(1).n(2:end-1);
|
|
|
+ Avg(tt).y = [Avg(tt).y; y];
|
|
|
+ yb = mean(y(t>-0.150 & t<0));
|
|
|
+ %yhb = yh-mean(yh(t>-0.170 & t<-0.070));
|
|
|
+ Avg(tt).yb = [Avg(tt).yb; yb];
|
|
|
+ %yn = yb ./ max(yhb(t>0 & t<0.1));
|
|
|
+ %Avg(tt).yn = [Avg(tt).yn; yn];
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ bl=[];
|
|
|
+ for i=1:length(Avg)
|
|
|
+ bl=[bl Avg(i).yb];
|
|
|
+ end
|
|
|
+
|
|
|
+ pk=[];
|
|
|
+ for i=1:sum(sel)
|
|
|
+ sy=smooth(Avg(1).y(i,:),7);
|
|
|
+ pk=[pk; max(sy(t>0 & t<0.080))];
|
|
|
+ end
|
|
|
+
|
|
|
+ for tt=[1:4,7,10:12]
|
|
|
+ for s=1:sum(sel)
|
|
|
+ sbl = mean(bl(s,[1:3 5:8]),2);
|
|
|
+ spk = pk(s);
|
|
|
+ Avg(tt).yn(s,:) = (Avg(tt).y(s,:) - sbl)./(spk-sbl) ;
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ ms_win = [...
|
|
|
+ -0.064 -0.034 -0.024 0.126 ; ...
|
|
|
+ 0.050 0.080 0.090 0.240 ; ...
|
|
|
+ 0.150 0.180 0.190 0.340 ; ...
|
|
|
+ ];
|
|
|
+
|
|
|
+ sbin1a = find( (t>=ms_win(1,1) & t<ms_win(1,2))>0 );
|
|
|
+ sbin2a = find( (t>=ms_win(2,1) & t<ms_win(2,2))>0 );
|
|
|
+ sbin3a = find( (t>=ms_win(3,1) & t<ms_win(3,2))>0 );
|
|
|
+ sbin1b = find( (t>=ms_win(1,3) & t<ms_win(1,4))>0 );
|
|
|
+ sbin2b = find( (t>=ms_win(2,3) & t<ms_win(2,4))>0 );
|
|
|
+ sbin3b = find( (t>=ms_win(3,3) & t<ms_win(3,4))>0 );
|
|
|
+
|
|
|
+ for tt=[1:4,7,10:12]
|
|
|
+ Y{tt} = nanmean(Avg(tt).yn,1);
|
|
|
+ YS{tt} = smooth(Y{tt},smw);
|
|
|
+ Y2{tt} = YS{tt};
|
|
|
+ end
|
|
|
+end
|
|
|
+%% Figure/Ground plots ====================================================
|
|
|
+fprintf('FG-MS interaction plots, used in SUPP FIGURE 6F-I\n')
|
|
|
+
|
|
|
+if UseSelected
|
|
|
+ load(fullfile(fld.data,'Hardcoded_SOA_FG_sel.mat'));
|
|
|
+end
|
|
|
+
|
|
|
+t = V1_FG(1).spikes(1).bin(2:end-1);
|
|
|
+smoothing_window_ms = 10;
|
|
|
+smw = (smoothing_window_ms/1000)./mean(diff(t));
|
|
|
+
|
|
|
+figure('Position',[50 50 1800 1000]);
|
|
|
+subplot(2,6,1:2);hold on;
|
|
|
+plot(t,smooth(nanmean(Avg(2).yn,1),smw),'Color',[0 0.4 0],'LineWidth',2)
|
|
|
+plot(t,smooth(nanmean(Avg(3).yn,1),smw),'Color',[0.2 0 0.8],'LineWidth',2)
|
|
|
+legend({'Figure','Ground'},'Location','northwest');
|
|
|
+set(gca,'xlim',[-0.05 0.35],'ylim',[-.1 1]);
|
|
|
+title([selstring ': F&G responses'], 'interpreter', 'none');
|
|
|
+text(0.27,-0.02,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+subplot(2,6,7:8);hold on;
|
|
|
+area(t,smooth(nanmean(Avg(2).yn,1)-nanmean(Avg(3).yn,1),smw),...
|
|
|
+ 'FaceColor',[0.8 0.8 0.8])
|
|
|
+legend({'Figure-Ground'},'Location','northwest');
|
|
|
+set(gca,'xlim',[-0.05 0.35],'ylim',[-.075 0.15]);
|
|
|
+title([selstring ': F-G'], 'interpreter', 'none');
|
|
|
+text(0.27,-0.05,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+% F/G interaction with MS 150 ms -----------------------------------------
|
|
|
+LC={[0 0.4 0],[0 0.8 0.2],[0 0 0.6],[0.2 0.8 0.8]};
|
|
|
+subplot(2,6,3:4); hold on;
|
|
|
+ci=0;
|
|
|
+for tt=[2,11,3,12]
|
|
|
+ ci=ci+1;
|
|
|
+ plot(t,smooth(Y2{tt},smw),'Color',LC{ci},'LineWidth',2)
|
|
|
+end
|
|
|
+legend({'FIG','FIG MS','GND','GND MS'},'Location','northeast');
|
|
|
+set(gca,'xlim',[-0.05 0.35],'ylim',[-.1 1]);
|
|
|
+title('F-G and MS@150ms', 'interpreter', 'none');
|
|
|
+
|
|
|
+for recompose_plots=1
|
|
|
+ y=nanmean(Avg(11).yn,1)-nanmean(Avg(2).yn,1);
|
|
|
+ ynan = y; ynan(sbin3a) = nan;
|
|
|
+ y2=smooth(ynan,smw);
|
|
|
+ y2(sbin3a)=y(sbin3a);
|
|
|
+ yy=nanmean(Avg(12).yn,1)-nanmean(Avg(3).yn,1);
|
|
|
+ yynan = yy; yynan(sbin3a) = nan;
|
|
|
+ yy2=smooth(yynan,smw);
|
|
|
+ yy2(sbin3a)=yy(sbin3a);
|
|
|
+end
|
|
|
+subplot(2,6,9:10);hold on;
|
|
|
+area(t,y2,'FaceColor',LC{1})
|
|
|
+legend({'FIG MS - NoMS'},'Location','southwest');
|
|
|
+plot([ms_win(3,1) ms_win(3,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,2) ms_win(3,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,3) ms_win(3,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(3,4) ms_win(3,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[0.0 0.35],'ylim',[-0.2 0.25]);
|
|
|
+title('F-G and MS@150ms', 'interpreter', 'none');
|
|
|
+
|
|
|
+subplot(2,6,11:12);hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{3})
|
|
|
+legend({'GND MS - NoMS'},'Location','southwest');
|
|
|
+plot([ms_win(3,1) ms_win(3,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,2) ms_win(3,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,3) ms_win(3,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(3,4) ms_win(3,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[0.0 0.35],'ylim',[-0.2 0.25]);
|
|
|
+title('F-G and MS@150ms', 'interpreter', 'none');
|
|
|
+
|
|
|
+% effect size
|
|
|
+FGMS = [ ...
|
|
|
+ sum(Avg(11).yn(:,sbin3a),2)./length(sbin3a) - ...
|
|
|
+ sum(Avg(2).yn(:,sbin3a),2)./length(sbin3a)...
|
|
|
+ sum(Avg(12).yn(:,sbin3a),2)./length(sbin3a) - ...
|
|
|
+ sum(Avg(3).yn(:,sbin3a),2)./length(sbin3a)...
|
|
|
+ sum(Avg(11).yn(:,sbin3b),2)./length(sbin3b) - ...
|
|
|
+ sum(Avg(2).yn(:,sbin3b),2)./length(sbin3b)...
|
|
|
+ sum(Avg(12).yn(:,sbin3b),2)./length(sbin3b) - ...
|
|
|
+ sum(Avg(3).yn(:,sbin3b),2)./length(sbin3b)];
|
|
|
+
|
|
|
+mFGMS = nanmean(FGMS,1);
|
|
|
+semFGMS = nanstd(FGMS)./sqrt(size(FGMS,1));
|
|
|
+subplot(2,6,5);hold on;
|
|
|
+bar(1,mFGMS(1), 'FaceColor',LC{1});
|
|
|
+bar(2,mFGMS(2), 'FaceColor',LC{3});
|
|
|
+errorbar(1:2,mFGMS(1:2),semFGMS(1:2),'k','linestyle','none','linewidth',2)
|
|
|
+set(gca,'xlim',[0.5 2.5],'xtick',[1,2],...
|
|
|
+ 'xticklabel',{'Fig exc','Gnd exc'});
|
|
|
+title('MS effect @150ms', 'interpreter', 'none');
|
|
|
+
|
|
|
+subplot(2,6,6);hold on;
|
|
|
+bar(1,mFGMS(3), 'FaceColor',LC{1});
|
|
|
+bar(2,mFGMS(4), 'FaceColor',LC{3});
|
|
|
+errorbar(1:2,mFGMS(3:4),semFGMS(3:4),'k','linestyle','none','linewidth',2)
|
|
|
+set(gca,'xlim',[0.5 2.5],'xtick',[1,2],...
|
|
|
+ 'xticklabel',{'Fig sup','Gnd sup'});
|
|
|
+title('MS effect @150ms', 'interpreter', 'none');
|
|
|
+
|
|
|
+%% MS timing plots ========================================================
|
|
|
+fprintf('FG-MS SOA plots\n')
|
|
|
+LC={[0 0 0],[0 0.4 0],[0.8 0 0],[0 0 0.6]};
|
|
|
+figure('Position',[50 50 1800 1000]);
|
|
|
+subplot(5,4,[1 5 9])
|
|
|
+hold on;
|
|
|
+ci=0;
|
|
|
+for tt=[1 4 7 10]
|
|
|
+ ci=ci+1;
|
|
|
+ plot(t,Y2{tt},'Color',LC{ci},'LineWidth',2)
|
|
|
+end
|
|
|
+legend({'no MS','-50ms','50ms','150ms'});
|
|
|
+set(gca,'xlim',[-0.1 0.35]);
|
|
|
+title([selstring ': MS-SOA effect'], 'interpreter', 'none');
|
|
|
+text(0.25,-0.4,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+subplot(5,4,[3 7 11])
|
|
|
+hold on;
|
|
|
+ci=0;
|
|
|
+for tt=[1 4 7 10]
|
|
|
+ ci=ci+1;
|
|
|
+ plot(t,Y2{tt},'Color',LC{ci},'LineWidth',2)
|
|
|
+end
|
|
|
+legend({'no MS','-50ms','50ms','150ms'});
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.2 1])
|
|
|
+title('MS-SOA effect', 'interpreter', 'none');
|
|
|
+text(0.25,-0.1,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+yy=nanmean(Avg(4).yn,1)-nanmean(Avg(1).yn,1);
|
|
|
+yynan = yy; yynan(sbin1a) = nan;
|
|
|
+yy2=smooth(yynan,smw);
|
|
|
+yy2(sbin1a)=yy(sbin1a);
|
|
|
+YY{1}=yy2;
|
|
|
+
|
|
|
+subplot(5,4,2)
|
|
|
+hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{2})
|
|
|
+legend({'-50ms'});
|
|
|
+YLIM=get(gca,'ylim');
|
|
|
+plot([ms_win(1,1) ms_win(1,1)],[YLIM(1) YLIM(2)],'k-');
|
|
|
+plot([ms_win(1,2) ms_win(1,2)],[YLIM(1) YLIM(2)],'k-');
|
|
|
+plot([ms_win(1,3) ms_win(1,3)],[YLIM(1) YLIM(2)],'k--');
|
|
|
+plot([ms_win(1,4) ms_win(1,4)],[YLIM(1) YLIM(2)],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35]);
|
|
|
+
|
|
|
+subplot(5,4,4)
|
|
|
+hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{2})
|
|
|
+legend({'-50ms'});
|
|
|
+plot([ms_win(1,1) ms_win(1,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(1,2) ms_win(1,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(1,3) ms_win(1,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(1,4) ms_win(1,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.3 0.4]);
|
|
|
+
|
|
|
+yy=nanmean(Avg(7).yn,1)-nanmean(Avg(1).yn,1);
|
|
|
+yynan = yy; yynan(sbin2a) = nan;
|
|
|
+yy2=smooth(yynan,smw);
|
|
|
+yy2(sbin2a)=yy(sbin2a);
|
|
|
+YY{2}=yy2;
|
|
|
+
|
|
|
+subplot(5,4,6)
|
|
|
+hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{3})
|
|
|
+legend({'50ms'});
|
|
|
+YLIM=get(gca,'ylim');
|
|
|
+plot([ms_win(2,1) ms_win(2,1)],[YLIM(1) YLIM(2)],'k-');
|
|
|
+plot([ms_win(2,2) ms_win(2,2)],[YLIM(1) YLIM(2)],'k-');
|
|
|
+plot([ms_win(2,3) ms_win(2,3)],[YLIM(1) YLIM(2)],'k--');
|
|
|
+plot([ms_win(2,4) ms_win(2,4)],[YLIM(1) YLIM(2)],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35]);
|
|
|
+
|
|
|
+subplot(5,4,8)
|
|
|
+hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{3})
|
|
|
+legend({'50ms'});
|
|
|
+plot([ms_win(2,1) ms_win(2,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(2,2) ms_win(2,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(2,3) ms_win(2,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(2,4) ms_win(2,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.3 0.4]);
|
|
|
+
|
|
|
+yy=nanmean(Avg(10).yn,1)-nanmean(Avg(1).yn,1);
|
|
|
+yynan = yy; yynan(sbin3a) = nan;
|
|
|
+yy2=smooth(yynan,smw);
|
|
|
+yy2(sbin3a)=yy(sbin3a);
|
|
|
+YY{3}=yy2;
|
|
|
+
|
|
|
+subplot(5,4,10)
|
|
|
+hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{4})
|
|
|
+legend({'150ms'});
|
|
|
+YLIM=get(gca,'ylim');
|
|
|
+plot([ms_win(3,1) ms_win(3,1)],[YLIM(1) YLIM(2)],'k-');
|
|
|
+plot([ms_win(3,2) ms_win(3,2)],[YLIM(1) YLIM(2)],'k-');
|
|
|
+plot([ms_win(3,3) ms_win(3,3)],[YLIM(1) YLIM(2)],'k--');
|
|
|
+plot([ms_win(3,4) ms_win(3,4)],[YLIM(1) YLIM(2)],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35]);
|
|
|
+
|
|
|
+subplot(5,4,12)
|
|
|
+hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{4})
|
|
|
+legend({'150ms'});
|
|
|
+plot([ms_win(3,1) ms_win(3,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,2) ms_win(3,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,3) ms_win(3,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(3,4) ms_win(3,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.3 0.4]);
|
|
|
+% ------------------------------------------------------------------
|
|
|
+subplot(5,4,[13,14,17,18]);
|
|
|
+hold on;
|
|
|
+plot(t+0.060,YY{1},'Color',LC{2},'LineWidth',2)
|
|
|
+plot(t-0.050,YY{2},'Color',LC{3},'LineWidth',2)
|
|
|
+plot(t-0.150,YY{3},'Color',LC{4},'LineWidth',2)
|
|
|
+set(gca,'xlim',[-0.1 0.2],'ylim',[-0.3 5]);
|
|
|
+title([selstring ': MS-SOA ALIGNED to MS'], 'interpreter', 'none');
|
|
|
+text(-0.075,1,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+MS_SOA = [sum(Avg(4).yn(:,sbin1a),2)./length(sbin1a) - sum(Avg(1).yn(:,sbin1a),2)./length(sbin1a) ...
|
|
|
+ sum(Avg(7).yn(:,sbin2a),2)./length(sbin2a) - sum(Avg(1).yn(:,sbin2a),2)./length(sbin2a) ...
|
|
|
+ sum(Avg(10).yn(:,sbin3a),2)./length(sbin3a) - sum(Avg(1).yn(:,sbin3a),2)./length(sbin3a) ...
|
|
|
+ sum(Avg(4).yn(:,sbin1b),2)./length(sbin1b) - sum(Avg(1).yn(:,sbin1b),2)./length(sbin1b) ...
|
|
|
+ sum(Avg(7).yn(:,sbin2b),2)./length(sbin2b) - sum(Avg(1).yn(:,sbin2b),2)./length(sbin2b) ...
|
|
|
+ sum(Avg(10).yn(:,sbin3b),2)./length(sbin3b) - sum(Avg(1).yn(:,sbin3b),2)./length(sbin3b)];
|
|
|
+
|
|
|
+mMS_SOA = nanmean(MS_SOA);
|
|
|
+semFGMS = nanstd(MS_SOA)./sqrt(size(MS_SOA,1));
|
|
|
+
|
|
|
+subplot(5,4,[15,19]);
|
|
|
+hold on
|
|
|
+bar(1,mMS_SOA(1), 'FaceColor',LC{2});
|
|
|
+bar(2,mMS_SOA(2), 'FaceColor',LC{3});
|
|
|
+bar(3,mMS_SOA(3), 'FaceColor',LC{4});
|
|
|
+errorbar(1:3,mMS_SOA(1:3),semFGMS(1:3),'k','linestyle','none','linewidth',2)
|
|
|
+set(gca,'xlim',[0.5 3.5],'xtick',1:3,'xticklabel',{'-50','50','150'});
|
|
|
+title('Exc. effect', 'interpreter', 'none');
|
|
|
+
|
|
|
+subplot(5,4,[16,20]);
|
|
|
+hold on
|
|
|
+bar(1,mMS_SOA(4), 'FaceColor',LC{2});
|
|
|
+bar(2,mMS_SOA(5), 'FaceColor',LC{3});
|
|
|
+bar(3,mMS_SOA(6), 'FaceColor',LC{4});
|
|
|
+errorbar(1:3,mMS_SOA(4:6),semFGMS(4:6),'k','linestyle','none','linewidth',2)
|
|
|
+set(gca,'xlim',[0.5 3.5],'xtick',1:3,'xticklabel',{'-50','50','150'});
|
|
|
+title('Supp. effect', 'interpreter', 'none')
|
|
|
+
|
|
|
+%% MS timing second plot ==================================================
|
|
|
+fprintf('These plots are used for SUPP FIGURE 6A-D\n')
|
|
|
+
|
|
|
+LC={[0 0 0],[0 0.4 0],[0.8 0 0],[0 0 0.6]};
|
|
|
+figure('Position',[50 50 1800 1000]);
|
|
|
+
|
|
|
+subplot(3,3,1); hold on;
|
|
|
+plot(t,Y2{1},'Color',LC{1},'LineWidth',2)
|
|
|
+plot(t,Y2{4},'Color',LC{2},'LineWidth',2)
|
|
|
+legend({'no MS','-50ms'});
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.2 1])
|
|
|
+title('MS-SOA effect', 'interpreter', 'none');
|
|
|
+text(0.25,-0.1,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+subplot(3,3,2); hold on;
|
|
|
+plot(t,Y2{1},'Color',LC{1},'LineWidth',2)
|
|
|
+plot(t,Y2{7},'Color',LC{3},'LineWidth',2)
|
|
|
+legend({'no MS','50ms'});
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.2 1])
|
|
|
+title('MS-SOA effect', 'interpreter', 'none');
|
|
|
+text(0.25,-0.1,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+subplot(3,3,3); hold on;
|
|
|
+plot(t,Y2{1},'Color',LC{1},'LineWidth',2)
|
|
|
+plot(t,Y2{10},'Color',LC{4},'LineWidth',2)
|
|
|
+legend({'no MS','150ms'});
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.2 1])
|
|
|
+title('MS-SOA effect', 'interpreter', 'none');
|
|
|
+text(0.25,-0.1,['N = ' num2str(N)],'fontsize',12);
|
|
|
+
|
|
|
+yy=nanmean(Avg(4).yn,1)-nanmean(Avg(1).yn,1);
|
|
|
+yynan = yy; yynan(sbin1a) = nan;
|
|
|
+yy2=smooth(yynan,smw);
|
|
|
+yy2(sbin1a)=yy(sbin1a);
|
|
|
+YY{1}=yy2;
|
|
|
+
|
|
|
+subplot(3,3,4); hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{2})
|
|
|
+legend({'-50ms'});
|
|
|
+plot([ms_win(1,1) ms_win(1,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(1,2) ms_win(1,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(1,3) ms_win(1,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(1,4) ms_win(1,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.3 0.4]);
|
|
|
+
|
|
|
+yy=nanmean(Avg(7).yn,1)-nanmean(Avg(1).yn,1);
|
|
|
+yynan = yy; yynan(sbin2a) = nan;
|
|
|
+yy2=smooth(yynan,smw);
|
|
|
+yy2(sbin2a)=yy(sbin2a);
|
|
|
+YY{2}=yy2;
|
|
|
+
|
|
|
+subplot(3,3,5); hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{3})
|
|
|
+legend({'50ms'});
|
|
|
+plot([ms_win(2,1) ms_win(2,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(2,2) ms_win(2,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(2,3) ms_win(2,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(2,4) ms_win(2,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.3 0.4]);
|
|
|
+
|
|
|
+yy=nanmean(Avg(10).yn,1)-nanmean(Avg(1).yn,1);
|
|
|
+yynan = yy; yynan(sbin3a) = nan;
|
|
|
+yy2=smooth(yynan,smw);
|
|
|
+yy2(sbin3a)=yy(sbin3a);
|
|
|
+YY{3}=yy2;
|
|
|
+
|
|
|
+subplot(3,3,6); hold on;
|
|
|
+area(t,yy2,'FaceColor',LC{4})
|
|
|
+legend({'150ms'});
|
|
|
+plot([ms_win(3,1) ms_win(3,1)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,2) ms_win(3,2)],[-1 1],'k-');
|
|
|
+plot([ms_win(3,3) ms_win(3,3)],[-1 1],'k--');
|
|
|
+plot([ms_win(3,4) ms_win(3,4)],[-1 1],'k--');
|
|
|
+set(gca,'xlim',[-0.1 0.35],'ylim',[-0.3 0.4]);
|
|
|
+
|
|
|
+subplot(3,3,7); hold on;
|
|
|
+plot([-1 1],[0,0],'k');
|
|
|
+plot(t+0.060,YY{1},'Color',LC{2},'LineWidth',2)
|
|
|
+plot(t-0.050,YY{2},'Color',LC{3},'LineWidth',2)
|
|
|
+plot(t-0.150,YY{3},'Color',LC{4},'LineWidth',2)
|
|
|
+set(gca,'xlim',[-0.1 0.2],'ylim',[-0.3 1]);
|
|
|
+title([selstring ': MS-SOA ALIGNED to MS'], 'interpreter', 'none');
|
|
|
+
|
|
|
+MS_SOA = [sum(Avg(4).yn(:,sbin1a),2)./length(sbin1a) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin1a),2)./length(sbin1a) ...
|
|
|
+ sum(Avg(7).yn(:,sbin2a),2)./length(sbin2a) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin2a),2)./length(sbin2a) ...
|
|
|
+ sum(Avg(10).yn(:,sbin3a),2)./length(sbin3a) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin3a),2)./length(sbin3a) ...
|
|
|
+ sum(Avg(4).yn(:,sbin1b),2)./length(sbin1b) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin1b),2)./length(sbin1b) ...
|
|
|
+ sum(Avg(7).yn(:,sbin2b),2)./length(sbin2b) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin2b),2)./length(sbin2b) ...
|
|
|
+ sum(Avg(10).yn(:,sbin3b),2)./length(sbin3b) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin3b),2)./length(sbin3b)];
|
|
|
+
|
|
|
+mMS_SOA = nanmean(MS_SOA);
|
|
|
+semFGMS = nanstd(MS_SOA)./sqrt(size(MS_SOA,1));
|
|
|
+
|
|
|
+subplot(3,3,8); hold on;
|
|
|
+bar(1,mMS_SOA(1), 'FaceColor',LC{2});
|
|
|
+bar(2,mMS_SOA(2), 'FaceColor',LC{3});
|
|
|
+bar(3,mMS_SOA(3), 'FaceColor',LC{4});
|
|
|
+errorbar(1:3,mMS_SOA(1:3),semFGMS(1:3),'k','linestyle','none','linewidth',2)
|
|
|
+set(gca,'xlim',[0.5 3.5],'xtick',1:3,'xticklabel',{'-50','50','150'});
|
|
|
+title('Exc. effect', 'interpreter', 'none');
|
|
|
+
|
|
|
+subplot(3,3,9); hold on;
|
|
|
+bar(1,mMS_SOA(4), 'FaceColor',LC{2});
|
|
|
+bar(2,mMS_SOA(5), 'FaceColor',LC{3});
|
|
|
+bar(3,mMS_SOA(6), 'FaceColor',LC{4});
|
|
|
+errorbar(1:3,mMS_SOA(4:6),semFGMS(4:6),'k','linestyle','none','linewidth',2)
|
|
|
+set(gca,'xlim',[0.5 3.5],'xtick',1:3,'xticklabel',{'-50','50','150'});
|
|
|
+title('Supp. effect', 'interpreter', 'none')
|
|
|
+
|
|
|
+%% Statistics SOA =========================================================
|
|
|
+fprintf('...and the corresponding statistics\n')
|
|
|
+
|
|
|
+% Hardcoded selections
|
|
|
+load(fullfile(fld.data,'Hardcoded_SOA_FG_sel.mat'));
|
|
|
+sel=SOA_sel; N=sum(sel);
|
|
|
+clear sbin
|
|
|
+fprintf('\n\n==== SOA STATISTICS ====\n');
|
|
|
+fprintf(['Number of stim-rec combinations in average: ' num2str(N) '\n']);
|
|
|
+ttail_exc='both'; % right
|
|
|
+ttail_sup='both'; % left
|
|
|
+
|
|
|
+for Collect=1
|
|
|
+ for tt=[1:4,7,10:12]
|
|
|
+ Avg(tt).y=[];
|
|
|
+ Avg(tt).yb=[];
|
|
|
+ Avg(tt).yn=[];
|
|
|
+ t = V1_FG(1).spikes(1).bin(2:end-1);
|
|
|
+ for s=find(sel>0)'
|
|
|
+ y=V1_FG(s).spikes(tt).n(2:end-1)';
|
|
|
+ Avg(tt).y = [Avg(tt).y; y];
|
|
|
+ yb = mean(y(t>-0.150 & t<0));
|
|
|
+ Avg(tt).yb = [Avg(tt).yb; yb];
|
|
|
+ end
|
|
|
+ end
|
|
|
+ bl=[]; for i=1:length(Avg); bl=[bl Avg(i).yb]; end
|
|
|
+ pk=[];
|
|
|
+ for i=1:sum(sel)
|
|
|
+ sy=smooth(Avg(1).y(i,:),7);
|
|
|
+ pk=[pk; max(sy(t>0 & t<0.080))];
|
|
|
+ end
|
|
|
+ for tt=[1:4,7,10:12]
|
|
|
+ for s=1:sum(sel)
|
|
|
+ sbl = mean(bl(s,[1:3 5:8]),2);
|
|
|
+ spk = pk(s);
|
|
|
+ Avg(tt).yn(s,:) = (Avg(tt).y(s,:) - sbl)./(spk-sbl) ;
|
|
|
+ end
|
|
|
+ end
|
|
|
+ ms_win = [...
|
|
|
+ -0.064 -0.034 -0.024 0.136 ; ...
|
|
|
+ 0.050 0.080 0.090 0.250 ; ...
|
|
|
+ 0.150 0.180 0.190 0.350 ; ...
|
|
|
+ ];
|
|
|
+ for mt=1:3
|
|
|
+ for w=1:2
|
|
|
+ sbin{mt,w} = find( (t>=ms_win(mt,2*(w-1)+1) & ...
|
|
|
+ t<ms_win(mt,2*(w-1)+2)>0) );
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+MS_SOA = [...
|
|
|
+ sum(Avg(4).yn(:,sbin{1,1}),2)./length(sbin{1,1}) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin{1,1}),2)./length(sbin{1,1}) ...
|
|
|
+ sum(Avg(7).yn(:,sbin{2,1}),2)./length(sbin{2,1}) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin{2,1}),2)./length(sbin{2,1}) ...
|
|
|
+ sum(Avg(10).yn(:,sbin{3,1}),2)./length(sbin{3,1}) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin{3,1}),2)./length(sbin{3,1}) ...
|
|
|
+ sum(Avg(4).yn(:,sbin{1,2}),2)./length(sbin{1,2}) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin{1,2}),2)./length(sbin{1,2}) ...
|
|
|
+ sum(Avg(7).yn(:,sbin{2,2}),2)./length(sbin{2,2}) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin{2,2}),2)./length(sbin{2,2}) ...
|
|
|
+ sum(Avg(10).yn(:,sbin{3,2}),2)./length(sbin{3,2}) - ...
|
|
|
+ sum(Avg(1).yn(:,sbin{3,2}),2)./length(sbin{3,2}) ];
|
|
|
+
|
|
|
+for mt = 1:3
|
|
|
+ SOA(mt).Exc.val = MS_SOA(:,mt);
|
|
|
+ [SOA(mt).Exc.H,SOA(mt).Exc.p, SOA(mt).Exc.ci, SOA(mt).Exc.stats] = ...
|
|
|
+ ttest(SOA(mt).Exc.val,0,'tail',ttail_exc);
|
|
|
+ fprintf(['\nMicrostim induced excitation @time ' num2str(mt) ':\n' ...
|
|
|
+ 't(' num2str(SOA(mt).Exc.stats.df) ') = ' num2str(SOA(mt).Exc.stats.tstat) ...
|
|
|
+ ', p = ' num2str(SOA(mt).Exc.p) '\n']);
|
|
|
+
|
|
|
+ SOA(mt).Sup.val = MS_SOA(:,3+mt);
|
|
|
+ [SOA(mt).Sup.H,SOA(mt).Sup.p, SOA(mt).Sup.ci, SOA(mt).Sup.stats] = ...
|
|
|
+ ttest(SOA(mt).Sup.val,0,'tail',ttail_sup);
|
|
|
+ fprintf(['\nMicrostim induced suppression @time ' num2str(mt) ':\n' ...
|
|
|
+ 't(' num2str(SOA(mt).Sup.stats.df) ') = ' num2str(SOA(mt).Sup.stats.tstat) ...
|
|
|
+ ', p = ' num2str(SOA(mt).Sup.p) '\n']);
|
|
|
+end
|
|
|
+
|
|
|
+[SOA(4).Exc.p,SOA(4).Exc.ANOVA,SOA(4).Exc.stats] = ...
|
|
|
+ anova1(MS_SOA(:,1:3),{'-58','+50','+150'});
|
|
|
+[SOA(4).Exc.MultComp.c,SOA(4).Exc.MultComp.m,SOA(4).Exc.MultComp.h] = ...
|
|
|
+ multcompare(SOA(4).Exc.stats);
|
|
|
+SOA(4).Exc.MultComp.p = SOA(4).Exc.MultComp.c(:,6)';
|
|
|
+
|
|
|
+[SOA(4).Sup.p,SOA(4).Sup.ANOVA,SOA(4).Sup.stats] = ...
|
|
|
+ anova1(MS_SOA(:,4:6),{'-58','+50','+150'});
|
|
|
+[SOA(4).Sup.MultComp.c,SOA(4).Sup.MultComp.m,SOA(4).Sup.MultComp.h] = ...
|
|
|
+ multcompare(SOA(4).Sup.stats);
|
|
|
+SOA(4).Sup.MultComp.p = SOA(4).Sup.MultComp.c(:,6)';
|
|
|
+
|
|
|
+fprintf(['\nTiming dependence of excitation effect:\n' ...
|
|
|
+ 'ANOVA: F(' num2str(SOA(4).Exc.ANOVA{2,3}) ',' ...
|
|
|
+ num2str(SOA(4).Exc.ANOVA{3,3}) ') = ' ...
|
|
|
+ num2str(SOA(4).Exc.ANOVA{2,5}) ', p = ' num2str(SOA(4).Exc.p) '\n']);
|
|
|
+fprintf(['Multiple comparisons, p-values ['...
|
|
|
+ num2str(SOA(4).Exc.MultComp.p(1)) ' ' ...
|
|
|
+ num2str(SOA(4).Exc.MultComp.p(2)) ' ' ...
|
|
|
+ num2str(SOA(4).Exc.MultComp.p(3)) ']\n']);
|
|
|
+fprintf(['\nTiming dependence of suppression effect:\n' ...
|
|
|
+ 'ANOVA: F(' num2str(SOA(4).Sup.ANOVA{2,3}) ',' ...
|
|
|
+ num2str(SOA(4).Sup.ANOVA{3,3}) ') = ' ...
|
|
|
+ num2str(SOA(4).Sup.ANOVA{2,5}) ', p = ' num2str(SOA(4).Sup.p) '\n']);
|
|
|
+fprintf(['Multiple comparisons, p-values ['...
|
|
|
+ num2str(SOA(4).Sup.MultComp.p(1)) ' ' ...
|
|
|
+ num2str(SOA(4).Sup.MultComp.p(2)) ' ' ...
|
|
|
+ num2str(SOA(4).Sup.MultComp.p(3)) ']\n']);
|
|
|
+
|
|
|
+%% Statistics FG-GND ======================================================
|
|
|
+% Hardcoded selections
|
|
|
+load(fullfile(fld.data,'Hardcoded_SOA_FG_sel.mat'));
|
|
|
+sel=FG_sel; N=sum(sel);
|
|
|
+clear sbin
|
|
|
+fprintf('\n\n==== FIGURE-GROUND STATISTICS ====\n');
|
|
|
+fprintf(['Number of stim-rec combinations in average: ' num2str(N) '\n']);
|
|
|
+ttail_fg='right'; % right
|
|
|
+ttail_exc='right'; % right
|
|
|
+ttail_sup='left'; % left
|
|
|
+
|
|
|
+for Collect=1
|
|
|
+ for tt=[1:4,7,10:12]
|
|
|
+ Avg(tt).y=[];
|
|
|
+ Avg(tt).yb=[];
|
|
|
+ Avg(tt).yn=[];
|
|
|
+ t = V1_FG(1).spikes(1).bin(2:end-1);
|
|
|
+ for s=find(sel>0)'
|
|
|
+ y=V1_FG(s).spikes(tt).n(2:end-1)';
|
|
|
+ Avg(tt).y = [Avg(tt).y; y];
|
|
|
+ yb = mean(y(t>-0.150 & t<0));
|
|
|
+ Avg(tt).yb = [Avg(tt).yb; yb];
|
|
|
+ end
|
|
|
+ end
|
|
|
+ bl=[]; for i=1:length(Avg); bl=[bl Avg(i).yb]; end
|
|
|
+ pk=[];
|
|
|
+ for i=1:sum(sel)
|
|
|
+ sy=smooth(Avg(1).y(i,:),7);
|
|
|
+ pk=[pk; max(sy(t>0 & t<0.080))];
|
|
|
+ end
|
|
|
+ for tt=[1:4,7,10:12]
|
|
|
+ for s=1:sum(sel)
|
|
|
+ sbl = mean(bl(s,[1:3 5:8]),2);
|
|
|
+ spk = pk(s);
|
|
|
+ Avg(tt).yn(s,:) = (Avg(tt).y(s,:) - sbl)./(spk-sbl) ;
|
|
|
+ end
|
|
|
+ end
|
|
|
+ ms_win = [...
|
|
|
+ -0.064 -0.034 -0.024 0.136 ; ...
|
|
|
+ 0.050 0.080 0.090 0.250 ; ...
|
|
|
+ 0.150 0.180 0.190 0.350 ; ...
|
|
|
+ ];
|
|
|
+ fg_win = [0.150 0.350];
|
|
|
+ for mt=1:3
|
|
|
+ for w=1:2
|
|
|
+ sbin{mt,w} = find( (t>=ms_win(mt,2*(w-1)+1) & ...
|
|
|
+ t<ms_win(mt,2*(w-1)+2)>0) );
|
|
|
+ end
|
|
|
+ end
|
|
|
+ fgbin = find( (t>=fg_win(1) & t<fg_win(2)>0) );
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+FG_mod = sum( Avg(2).yn(:,fgbin)-Avg(3).yn(:,fgbin) ,2)./length(fgbin);
|
|
|
+[FG.Mod.H,FG.Mod.p,FG.Mod.ci,FG.Mod.stats] = ...
|
|
|
+ ttest(FG_mod,0,'tail',ttail_fg);
|
|
|
+fprintf(['\nFigure-Ground modulation:\n' ...
|
|
|
+ 't(' num2str(FG.Mod.stats.df) ') = ' num2str(FG.Mod.stats.tstat) ...
|
|
|
+ ', p = ' num2str(FG.Mod.p) '\n']);
|
|
|
+fprintf('---------\n');
|
|
|
+
|
|
|
+MS_FG = [...
|
|
|
+ sum(Avg(11).yn(:,sbin{3,1}),2)./length(sbin{3,1}) - ...
|
|
|
+ sum(Avg(2).yn(:,sbin{3,1}),2)./length(sbin{3,1}) ...
|
|
|
+ sum(Avg(12).yn(:,sbin{3,1}),2)./length(sbin{3,1}) - ...
|
|
|
+ sum(Avg(3).yn(:,sbin{3,1}),2)./length(sbin{3,1}) ...
|
|
|
+ sum(Avg(11).yn(:,sbin{3,2}),2)./length(sbin{3,2}) - ...
|
|
|
+ sum(Avg(2).yn(:,sbin{3,2}),2)./length(sbin{3,2}) ...
|
|
|
+ sum(Avg(12).yn(:,sbin{3,2}),2)./length(sbin{3,2}) - ...
|
|
|
+ sum(Avg(3).yn(:,sbin{3,2}),2)./length(sbin{3,2}) ];
|
|
|
+
|
|
|
+FG.Exc.val = MS_FG(:,1);
|
|
|
+[FG.Exc.H,FG.Exc.p,FG.Exc.ci,FG.Exc.stats] = ...
|
|
|
+ ttest(FG.Exc.val,0,'tail',ttail_exc);
|
|
|
+fprintf(['\nMicrostim induced excitation FIG:\n' ...
|
|
|
+ 't(' num2str(FG.Exc.stats.df) ') = ' num2str(FG.Exc.stats.tstat) ...
|
|
|
+ ', p = ' num2str(FG.Exc.p) '\n']);
|
|
|
+
|
|
|
+GND.Exc.val = MS_FG(:,2);
|
|
|
+[GND.Exc.H,GND.Exc.p,GND.Exc.ci,GND.Exc.stats] = ...
|
|
|
+ ttest(GND.Exc.val,0,'tail',ttail_exc);
|
|
|
+fprintf(['\nMicrostim induced excitation GND:\n' ...
|
|
|
+ 't(' num2str(GND.Exc.stats.df) ') = ' num2str(GND.Exc.stats.tstat) ...
|
|
|
+ ', p = ' num2str(GND.Exc.p) '\n']);
|
|
|
+
|
|
|
+FG.Sup.val = MS_FG(:,3);
|
|
|
+[FG.Sup.H,FG.Sup.p,FG.Sup.ci,FG.Sup.stats] = ...
|
|
|
+ ttest(FG.Sup.val,0,'tail',ttail_sup);
|
|
|
+fprintf(['\nMicrostim induced suppression FIG:\n' ...
|
|
|
+ 't(' num2str(FG.Sup.stats.df) ') = ' num2str(FG.Sup.stats.tstat) ...
|
|
|
+ ', p = ' num2str(FG.Sup.p) '\n']);
|
|
|
+
|
|
|
+GND.Sup.val = MS_FG(:,4);
|
|
|
+[GND.Sup.H,GND.Sup.p,GND.Sup.ci,GND.Sup.stats] = ...
|
|
|
+ ttest(GND.Sup.val,0,'tail',ttail_sup);
|
|
|
+fprintf(['\nMicrostim induced suppression GND:\n' ...
|
|
|
+ 't(' num2str(GND.Sup.stats.df) ') = ' num2str(GND.Sup.stats.tstat) ...
|
|
|
+ ', p = ' num2str(GND.Sup.p) '\n']);
|
|
|
+
|
|
|
+[FgGnd.Exc.p,FgGnd.Exc.ANOVA,FgGnd.Exc.stats] = ...
|
|
|
+ anova1([FG.Exc.val GND.Exc.val],{'FIG','GND'});
|
|
|
+[FgGnd.Sup.p,FgGnd.Sup.ANOVA,FgGnd.Sup.stats] = ...
|
|
|
+ anova1([FG.Sup.val GND.Sup.val],{'FIG','GND'});
|
|
|
+
|
|
|
+fprintf(['\nFig-Gnd dependence of excitation effect:\n' ...
|
|
|
+ 'ANOVA: F(' num2str(FgGnd.Exc.ANOVA{2,3}) ',' ...
|
|
|
+ num2str(FgGnd.Exc.ANOVA{2,3}) ') = ' ...
|
|
|
+ num2str(FgGnd.Exc.ANOVA{3,5}) ', p = ' num2str(FgGnd.Exc.p) '\n']);
|
|
|
+fprintf(['\nFig-Gnd dependence of suppression effect:\n' ...
|
|
|
+ 'ANOVA: F(' num2str(FgGnd.Sup.ANOVA{2,3}) ',' ...
|
|
|
+ num2str(FgGnd.Sup.ANOVA{2,3}) ') = ' ...
|
|
|
+ num2str(FgGnd.Sup.ANOVA{3,5}) ', p = ' num2str(FgGnd.Sup.p) '\n']);
|