123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- %% Generate the FEEDBACK MS figure panels ===============================
- fprintf('== GENERATING FEEDBACK MS EFFECT FIGURES ==================\n')
- % Effect Windows
- EffWin.V1toV4.Exc = [0 0.050];
- EffWin.V1toV4.Sup = [0.050 0.120];
- EffWin.V4toV1.Exc = [0 0.030];
- EffWin.V4toV1.Sup = [0.030 0.150];
- % FEEDBACK V4 to V1
- EffectWindow.exc = EffWin.V4toV1.Exc;
- EffectWindow.sup = EffWin.V4toV1.Sup;
- fprintf(['Calculating V1 effect sizes in the following post-stimulation windows:\n'...
- 'Excitation: ' num2str(EffectWindow.exc(1)*1e3) ' to ' num2str(EffectWindow.exc(2)*1e3) ' ms\n'...
- 'Suppression: ' num2str(EffectWindow.sup(1)*1e3) ' to ' num2str(EffectWindow.sup(2)*1e3) ' ms\n']);
- V4MS = preProcessV4MS(V4MS,EffectWindow);
- %% FIGURE 6C - EXAMPLE UNIT V1 ==========================================
- fprintf('\n -- FIGURE 6C ----------\n');
- INDS = find(V4MS.RFDATA(:,5)>-1);
- indCH = 36;
- V4MS.META.S = 1;
- soa = 3;
- S = 8;
- BL_EX = smooth(V4MS.CLEAN.UNITS(:,INDS(indCH),1),S );
- MAX = nanmax(BL_EX); BL_EX = BL_EX/MAX;
- MS_EX = smooth(V4MS.CLEAN.UNITS(:,INDS(indCH),soa+1),S )/MAX;
- FSZ = 12;
- figure (44);clf; hold all;
- set(gca,'FontSize',FSZ)
- xlim([-0.1 0.35])
- ylim([-0.15 1.05])
- YL = ylim;p = patch([0.15 0.15 0.15+0.025 0.15+0.025],...
- [YL(1) YL(2) YL(2) YL(1)],0.8*[1 1 1],'EdgeColor','none',...
- 'FaceColor',[230 220 110]/255);
- hms = plot(V4MS.TIME,smooth(MS_EX,1),'Color',...
- V4MS.META.COLS(soa+1,:),'LineWidth',2);
- hbl = plot(V4MS.TIME,smooth(BL_EX,1),'Color',...
- 0*V4MS.META.COLS(1,:),'LineWidth',2);
- legend([hbl hms],{'no MS' 'MS'})
- xlabel('Time [s]'); ylabel('MUA')
- print_figure('figure6C',[0 0 7 7],fullfile(fld.figs,'FIG_6'),save_figs)
- cd(fld.scripts);
- %% FIGURE 6B - Make RF figure FB ========================================
- fprintf('\n -- FIGURE 6B ----------\n');
- load(fullfile(fld.data,'MAPPINGS','RF_B.mat'));
- figure(17);
- set(gca,'FontSize',FSZ)
- V4Lims=[0 9; -9 0];
- NV1RFs=[3]; % Say how many V1 RF there are.
- v1ch = 3; % Say which one do you want to plot
- % (if you want only RF 1 and 3 for example you can use v1ch=[1 3] )
- NV4CH=19; % Set the V4 channel that you want to plot.
- YTicks=[-9:2:0];
- XTicks=[0:2:9];
- [X,Y]=meshgrid(V4Lims(1,1):V4Lims(1,2),V4Lims(2,1):V4Lims(2,2));
- ST=0.01;
- [XI,YI]=meshgrid([V4Lims(1,1):ST:V4Lims(1,2)],[V4Lims(2,1):ST:V4Lims(2,2)]);
- SM=3; count=0;
- wh=[0.5 0.5];
- POS=[0.5 1; 1 1; 0.5 0.5; 1 0.5];
- count=count+1;
- TEMP=squeeze(RESPMATV4(NV4CH,:,:));
- if SM~=0
- TEMP3=TEMP;
- for j=1:size(TEMP,1)
- TEMP3(j,:)=smooth(TEMP(j,:),SM);
- end
- for i=1:size(TEMP3,2)
- TEMP3(:,i)=smooth(TEMP3(:,i),SM);
- end
- else
- TEMP3=TEMP;
- end
- Z=interp2(X,Y,TEMP3,XI,YI);
- colormap('default')
- imagesc(V4Lims(1,:),V4Lims(2,:),Z/max(max(Z)));
- set(gca,'YDir','normal')
- hold on
- axis('square')
- COLORS=[159/255, 29/255, 53/255; 0 128/255 0; ...
- 125/255, 249/255, 1; 244/255, 196/255, 48/255];
- for v1=v1ch
- TEMP=DATAV1(v1);
-
- DAT=TEMP.DAT;
- sampf=TEMP.Sampf;
- MP=TEMP.MP;
- DegperS=TEMP.DegperS;
- OFF.rho=TEMP.RFPecc;
- OFF.angle=TEMP.RFPangle;
-
- RF_INFO(v1)= RFpos(DAT, sampf, MP, DegperS, OFF);
-
- Mid=RF_INFO(v1).Mid;
- WH=RF_INFO(v1).WH;
- clr=RF_INFO(v1).clr;
- Ic=RF_INFO(v1).Ic;
- if v1==1;channs=[2 3 4 7 10 11 12 14];
- elseif v1==2;channs=[1 2 3 4 6 11 12 14 15];
- elseif v1==3;channs=[2];
- end
- for chan = channs
- M = [Mid.x(chan) Mid.y(chan)];
- P = patch([Mid.x(chan)-WH(chan).w2 Mid.x(chan)+WH(chan).w2 Mid.x(chan)+WH(chan).w2 Mid.x(chan)-WH(chan).w2], ...
- [Mid.y(chan)-WH(chan).h2 Mid.y(chan)-WH(chan).h2 Mid.y(chan)+WH(chan).h2 Mid.y(chan)+WH(chan).h2],COLORS(v1,:), ...
- 'EdgeColor', 'w','LineWidth',4); % COLORS(v1,1:3)
- set(P,'FaceColor','none')
- end
- end
- plot(xlim,[0 0],'w:')
- plot([0 0], ylim,'w:')
- scatter(0,0,[],[0 0 0],'Filled')
- set(gca,'XAxisLocation','top')
- set(gca,'Color',[0 0 1])
- xlabel('Horizontal Position [deg]')
- ylabel('Vertical Position [deg]')
- print_figure('figure6B',[0 0 7 7],fullfile(fld.figs,'FIG_6'),save_figs)
- cd(fld.scripts);
- %% FIGURE 4C - RF overlap vs Supp effect ================================
- fprintf('\n -- FIGURE 4C ----------\n');
- OVER = V4MS.RFDATA(:,5);
- EFFE = 50*V4MS.EFFECT(3,:);
- AMP = V4MS.RFDATA(:,12);
- OVER_SIG = OVER(logical(V4MS.CLEAN.UNITSIND) & ~isnan(OVER));
- EFFE_SIG = EFFE(logical(V4MS.CLEAN.UNITSIND) & ~isnan(OVER));
- AMP_SIG = AMP(logical(V4MS.CLEAN.UNITSIND) & ~isnan(OVER));
- OVER = OVER(~isnan(OVER));
- EFFE = EFFE(~isnan(OVER));
- AMP = AMP(~isnan(OVER));
- eff = EFFE./AMP';
- over = OVER;
- iNAN = isnan(eff);
- eff(iNAN) = [];
- over(iNAN) = [];
- X = [ones(length(eff),1) over];
- y = eff';
- [b,bint,r,rint,stats] = regress(y,X);
- [r,n,p,t] = regressionTTest(y,stats);
- disp(['R = ' num2str(r)])
- disp(['N = ' num2str(n)])
- disp(['P = ' num2str(p)])
- disp(['T = ' num2str(t)])
- figure(100);clf;hold all
- set(gca,'FontSize',10)
- scatter(OVER,EFFE./AMP',60,[0.75 0.75 0.9],'filled','LineWidth',1)
- scatter(OVER_SIG,EFFE_SIG./AMP_SIG',60,V4MS.META.COLS(4,:),'filled','LineWidth',1)
- plot([0.1 0.95],b(2)*[0.15 0.99]+b(1),'Color',0*V4MS.META.COLS(2,:))
- xlim([0 1])
- ylabel('Effect Size')
- set(gca,'XTick',[0 0.5 1])
- plot(xlim,[0 0],'k:','LineWidth',2)
- xlabel('RFs Overlap')
- print_figure('figure4C',[0 0 7 7],fullfile(fld.figs,'FIG_4'),save_figs)
- cd(fld.scripts);
- %% FIGURE 6D SOA both monkeys ===========================================
- fprintf('\n -- FIGURE 6D ----------\n');
- S = 10;
- SS = [-0.02 0.05 .15];
- figure;clf;
- for soa = 1:3
- subplot(1,3,soa);hold all;
- set(gca,'FontSize',FSZ)
- xlim([-0.1 0.35]); ylim([-0.15 1.05]); YL = ylim;
- p = patch([SS(soa) SS(soa) SS(soa)+0.025 SS(soa)+0.025],...
- [YL(1) YL(2) YL(2) YL(1)],0.8*[1 1 1],...
- 'EdgeColor','none','FaceColor',[230 220 110]/255);
- hms = plot(V4MS.TIME,smooth(V4MS.CLEAN.AVE(:,soa+1)/...
- nanmax(smooth(V4MS.CLEAN.AVE(:,1),S)),S),...
- 'Color',V4MS.META.COLS(soa+1,:), 'LineWidth',1);
- hbl = plot(V4MS.TIME,smooth(V4MS.CLEAN.AVE(:,1),S)/...
- nanmax(smooth(V4MS.CLEAN.AVE(:,1),S)),...
- 'Color',0*V4MS.META.COLS(1,:),'LineWidth',1);
- legend([hbl hms],{'no MS' 'MS'})
- xlabel('Time [s]')
- title(['SOA ' num2str(SS(soa)*1000) ' ms']);
- end
- fprintf(['N = ' num2str(sum(V4MS.CLEAN.UNITSIND)) '\n']);
- print_figure('figure6D',[0 0 21 7],fullfile(fld.figs,'FIG_6'),save_figs)
- cd(fld.scripts);
- %% FIGURE S3B SOA per MONKEY ============================================
- fprintf('\n -- SUPP FIGURE 3B ----------\n');
- MS = {'B' 'C'};
- for m = 1:2
- S = 10;
- SS = [-0.02 0.05 .15];
- temp = nanmean(nanmean(V4MS.CLEAN.UNITS(:,strcmp(V4MS.MONKEY,MS{m}),:),3),1);
- fprintf(['Monkey ' MS{m} ', n = ' num2str(sum(~isnan(temp))) '\n'])
- AVS = squeeze(nanmean(V4MS.CLEAN.UNITS(:,strcmp(V4MS.MONKEY,MS{m}),:),2));
-
- figure (m+400*m);clf;
- for soa = 1:3
- subplot(1,3,soa);hold all;
- set(gca,'FontSize',FSZ)
- xlim([-0.1 0.35])
- ylim([-0.2 1.05])
- YL = ylim;p = patch([SS(soa) SS(soa) SS(soa)+0.025 SS(soa)+0.025],...
- [YL(1) YL(2) YL(2) YL(1)],0.8*[1 1 1],'EdgeColor','none',...
- 'FaceColor',[230 220 110]/255);
- hms = plot(V4MS.TIME,smooth(AVS(:,soa+1)/nanmax(smooth(AVS(:,1),S)),S),...
- 'Color',V4MS.META.COLS(soa+1,:), 'LineWidth',1);
- hbl = plot(V4MS.TIME,smooth(AVS(:,1),S)/nanmax(smooth(AVS(:,1),S)),...
- 'Color',V4MS.META.COLS(1,:)*0,'LineWidth',1);
-
- legend([hbl hms],{'no MS' 'MS'})
- xlabel('Time [s]')
- end
- print_figure(['suppfigure3B_Monkey' MS{m}],[0 0 21 7],...
- fullfile(fld.figs,'SUPPFIG_3'),save_figs);
- cd(fld.scripts);
- end
- %% FIGURE 6E - Diff MUA by SOA, triggered on MS =========================
- fprintf('\n -- FIGURE 6E ----------\n');
- figure (8);clf;hold all;
- set(gca,'FontSize',FSZ)
- ylim([-0.15 0.06])
- YL = ylim;p = patch([0 0 0.025 0.025],[YL(1) YL(2) YL(2) YL(1)],...
- 0.8*[1 1 1],'EdgeColor','none','FaceColor',[230 220 110]/255);
- S = 10;
- SAOS = [-0.02 0.05 0.15];
- hds = [];
- for soa = 1:3
- hds(end+1) = plot(V4MS.TIME-SAOS(soa),...
- smooth(-V4MS.CLEAN.AVE(:,1)+V4MS.CLEAN.AVE(:,soa+1),S)/...
- nanmax(smooth(V4MS.CLEAN.AVE(:,1),S)),...
- 'Color',V4MS.META.COLS(soa+1,:),'LineWidth',1);
- xlim([-0.1 0.2])
- end
- plot(xlim,[0 0],'k:')
- set(gca,'YTick',[-0.1:0.05:0.05]);
- set(gca,'XTick',[-0.1:0.1:0.1]);
- legend(hds,{'-20ms' '50ms' '150ms'},'Location','SouthWest')
- ylabel('MS - no MS');
- xlabel('Time [s]')
- print_figure('figure6E',[0 0 13 5.5],fullfile(fld.figs,'FIG_6'),save_figs)
- cd(fld.scripts);
- %% FIGURE S3C - Supressive effect per monkey ============================
- fprintf('\n -- SUPP FIGURE 3C ----------\n');
- for m = 1:2
- figure (856+m);clf;hold all;
- set(gca,'FontSize',FSZ)
- ylim([-0.2 0.1])
- YL = ylim;p = patch([0 0 0.025 0.025],[YL(1) YL(2) YL(2) YL(1)],...
- 0.8*[1 1 1],'EdgeColor','none','FaceColor',[230 220 110]/255);
- S = 10;
- SAOS = [-0.02 0.05 0.15];
-
- AVS = squeeze(nanmean(V4MS.CLEAN.UNITS(:,strcmp(V4MS.MONKEY,MS{m}),:),2));
-
- hds = [];
- for soa = 1:3
- hds(end+1) = plot(V4MS.TIME-SAOS(soa),smooth(-AVS(:,1)+AVS(:,soa+1),S)/...
- nanmax(smooth(AVS(:,1),S)),'Color',V4MS.META.COLS(soa+1,:),'LineWidth',1);
- xlim([-0.1 0.2])
- end
- plot(xlim,[0 0],'k:')
- legend(hds,{'-20ms' '50ms' '150ms'},'Location','SouthWest')
- ylabel('MS - no MS'); xlabel('Time [s]');
- print_figure(['suppfigure3C_Monkey' MS{m}],[0 0 7 7],...
- fullfile(fld.figs,'SUPPFIG_3'),save_figs);
- cd(fld.scripts);
- end
- %% FIGURE 6F - Average Effect Sizes per SOA =============================
- fprintf('\n -- FIGURE 6F ----------\n');
- ANOVA_DATA= [];ANOVA_DATA2= [];
- OVER = V4MS.RFDATA(:,5);
- figure(103);clf;hold all
- subplot(1,2,2);hold on;
- set(gca,'FontSize',FSZ)
- for soa = 1:3
- EFFE = V4MS.EFFECT(soa,:);
- EFFE_SIG = EFFE(~isnan(nanmean(V4MS.CLEAN.UNITS(:,:,1),1)))/...
- nanmax(smooth(V4MS.CLEAN.AVE(:,1),10));;
- mEFF = nanmean(EFFE_SIG);
- sEFF = nanstd(EFFE_SIG)/sqrt(sum(~isnan(EFFE_SIG)));
- errorbar(soa,mEFF,sEFF,'sk','LineWidth',2);
- bar(soa,mEFF,'FaceColor',V4MS.META.COLS(soa+1,:))
-
- ANOVA_DATA = [ANOVA_DATA EFFE_SIG'];
- end
- ylim([-0.07 0.032])
- xlim([0.5 3.5])
- set(gca,'XTick',[1 2 3],'XTickLabel',{'-20' '50' '150'})
- ylabel('Mean Difference')
- % plot(xlim,[0 0],'k:','LineWidth',2)
- xlabel('SOA [ms]')
- title('Suppression')
- subplot(1,2,1);hold on;
- set(gca,'FontSize',FSZ)
- for soa = 1:3
- EFFE2 = V4MS.EXCIT_EFFECT(soa,:);
- EFFE_SIG2 = EFFE2(~isnan(nanmean(V4MS.CLEAN.UNITS(:,:,1),1)))/...
- nanmax(smooth(V4MS.CLEAN.AVE(:,1),10));;
- mEFF2 = nanmean(EFFE_SIG2);
- sEFF2 = nanstd(EFFE_SIG2)/sqrt(sum(~isnan(EFFE_SIG2)));
- errorbar(soa,mEFF2,sEFF2,'sk','LineWidth',2);
- bar(soa,mEFF2,'FaceColor',V4MS.META.COLS(soa+1,:))
-
- ANOVA_DATA2 = [ANOVA_DATA2 EFFE_SIG2'];
- end
- ylim([-0.07 0.032])
- xlim([0.5 3.5])
- set(gca,'XTick',[1 2 3],'XTickLabel',{'-20' '50' '150'})
- ylabel('Mean Difference')
- % plot(xlim,[0 0],'k:','LineWidth',2)
- xlabel('SOA [ms]')
- title('Excitation')
- print_figure('figure6F',[0 0 7 7],fullfile(fld.figs,'FIG_6'),save_figs)
- cd(fld.scripts);
- %% STATS for FiG 6F =====================================================
- fprintf('Statistics for FIG 6F\n');
- fprintf('- Excitation -\n');
- anova_data2 = ANOVA_DATA2;
- anova_data2(isnan(ANOVA_DATA2(:,1)),:) = [];
- [P2,ANOVATAB2,STATS2] = anova1(anova_data2);
- [c2,m2,h2,names2] = multcompare(STATS2,'Alpha',10^-15,'CType','tukey-kramer');
- for s=1:3
- [h_soa{s},p_soa{s}] = ttest(anova_data2(:,s));
- fprintf(['SOA ' num2str(c2(s,1)) ' vs ' num2str(c2(s,2)) ': p = ' ...
- num2str(c2(s,6)) '\n']);
- end
- fprintf('- Suppression -\n');
- anova_data = ANOVA_DATA;
- anova_data(isnan(ANOVA_DATA(:,1)),:) = [];
- [P,ANOVATAB,STATS] = anova1(anova_data);
- [c,m,h,names] = multcompare(STATS,'Alpha',10^-15,'CType','tukey-kramer');
- for i=1:3
- fprintf(['SOA ' num2str(c(i,1)) ' vs ' num2str(c(i,2)) ': p = ' ...
- num2str(c(i,6)) '\n']);
- end
- %% FIGURE 4D - Suppression effect size vs MUA ===========================
- fprintf('\n -- FIGURE 4D ----------\n');
- S = 10; SS = [-0.05 0.05 .15];
- % Compute activity during blank trials.
- BASES = nan(size(V4MS.CLEAN.UNITS,2),3);
- for soa = 1:3
- indT = V4MS.TIME > (SS(soa)+0.025) & V4MS.TIME < (SS(soa)+0.125);
- BASES(:,soa) = squeeze(nanmean(V4MS.UNITS(indT,:,1),1));
- end
- EFFS = nan(size(V4MS.CLEAN.UNITS,2),3);
- for soa = 1:3
- EFFE = V4MS.EFFECT(soa,:);
- EFFS(:,soa) = EFFE;
- end
- figure(105);clf;hold on
- set(gca,'FontSize',FSZ)
- xlim([-0.45 0.45])
- for soa = 3 % only the 150 ms SOA
- scatter(BASES(:,soa),EFFS(:,soa),60,[0.75 0.75 0.9],'filled','LineWidth',1),
- scatter(BASES(logical(V4MS.CLEAN.UNITSIND),soa),...
- EFFS(logical(V4MS.CLEAN.UNITSIND),soa),60,...
- V4MS.META.COLS(soa+1,:),'filled','LineWidth',1);
-
- % compute regressions
- indM = logical(V4MS.CLEAN.UNITSIND);
- eff = EFFS(indM,soa);
- over = BASES(indM,soa);
-
- iNAN = isnan(mean([eff over],2));
-
- eff(iNAN) = [];
- over(iNAN) = [];
-
- X = [ones(length(eff),1) over];
- y = eff';
- [b,bint,r,rint,stats] = regress(y',X);
-
- [r,n,p,t] = regressionTTest(y,stats);
- disp(['R = ' num2str(r)])
- disp(['N = ' num2str(n)])
- disp(['P = ' num2str(p)])
- disp(['T = ' num2str(t)])
- end
- h = lsline;
- xlim([-0.45 0.4])
- set(h(1),'Color','k','LineStyle','--')
- set(h(2),'LineStyle','none');
- xlabel('Average MUA')
- ylabel('Effect Size')
- print_figure('figure4D' ,[0 0 7 7],fullfile(fld.figs,'FIG_4'),save_figs);
- cd(fld.scripts);
|