FF_FIGURES.m 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. %% Generate the FEEDFORWARD MS figure panels ============================
  2. fprintf('== GENERATING FEEDFORWARD MS EFFECT FIGURES ==================\n')
  3. % Effect Windows
  4. EffWin.V1toV4.Exc = [0 0.050];
  5. EffWin.V1toV4.Sup = [0.050 0.120];
  6. EffWin.V4toV1.Exc = [0 0.030];
  7. EffWin.V4toV1.Sup = [0.030 0.150];
  8. % FEEDFORWARD V1 to V4
  9. EffectWindow.exc = EffWin.V1toV4.Exc;
  10. EffectWindow.sup = EffWin.V1toV4.Sup;
  11. fprintf(['Calculating V4 effect sizes in the following post-stimulation windows:\n'...
  12. 'Excitation: ' num2str(EffectWindow.exc(1)*1e3) ' to ' num2str(EffectWindow.exc(2)*1e3) ' ms\n'...
  13. 'Suppression: ' num2str(EffectWindow.sup(1)*1e3) ' to ' num2str(EffectWindow.sup(2)*1e3) ' ms\n']);
  14. V1MS = preProcessV1MS(V1MS,EffectWindow);
  15. %% FIGURE 3D - Example unit V1 ==========================================
  16. fprintf('\n -- FIGURE 3D ----------\n');
  17. % Set unit to plot as example.
  18. INDS = find(V1MS.RFDATA(:,5)>-1);
  19. indCH = 31; soa = 1; S = 8;
  20. % Normalized based on peak of blank (no MS) average.
  21. BL_EX = smooth(V1MS.CLEAN.UNITS(:,INDS(indCH),1),S );
  22. MAX = nanmax(BL_EX); BL_EX = BL_EX/MAX;
  23. MS_EX = smooth(V1MS.CLEAN.UNITS(:,INDS(indCH),soa+1),S )/MAX;
  24. FSZ = 12;
  25. figure (44);clf; hold all;
  26. set(gca,'FontSize',FSZ)
  27. xlim([-0.1 0.35]); ylim([-0.15 1.6]); YL = ylim;
  28. p = patch([-0.05 -0.05 -0.05+0.025 -0.05+0.025],[YL(1) ...
  29. YL(2) YL(2) YL(1)],0.8*[1 1 1],'EdgeColor','none','FaceColor',[230 220 110]/255);
  30. hms = plot(V1MS.TIME,smooth(MS_EX,1),'Color',V1MS.META.COLS(soa+1,:),'LineWidth',2);
  31. hbl = plot(V1MS.TIME,smooth(BL_EX,1),'Color',V1MS.META.COLS(1,:)*0,'LineWidth',2);
  32. legend([hbl hms],{'MS' 'BL'})
  33. xlabel('Time [s]'); ylabel('MUA');
  34. print_figure('figure3D',[0 0 7 7],fullfile(fld.figs,'FIG_3'),save_figs)
  35. cd(fld.scripts);
  36. %% FIGURE 3B - Make RF figure FF ========================================
  37. fprintf('\n -- FIGURE 3B ----------\n');
  38. load(fullfile(fld.data,'MAPPINGS','RF_B.mat'));
  39. % Compute and plot V4 RF.
  40. figure(18);
  41. set(gca,'FontSize',FSZ)
  42. V4Lims=[0 9; -9 0];
  43. NV1RFs=[3]; % Say how many V1 RF there are.
  44. v1ch = 3; % Say which one do you want to plot
  45. % (if you want only RF 1 and 3 for example you can use v1ch=[1 3] )
  46. NV4CH=27; % Set the V4 channel that you want to plot.
  47. YTicks=[-9:2:0];
  48. XTicks=[0:2:9];
  49. [X,Y]=meshgrid(V4Lims(1,1):V4Lims(1,2),V4Lims(2,1):V4Lims(2,2));
  50. ST=0.01;
  51. [XI,YI]=meshgrid([V4Lims(1,1):ST:V4Lims(1,2)],...
  52. [V4Lims(2,1):ST:V4Lims(2,2)]);
  53. SM=3; count=0;
  54. wh=[0.5 0.5]; POS=[0.5 1; 1 1; 0.5 0.5; 1 0.5];
  55. count=count+1;
  56. TEMP=squeeze(RESPMATV4(NV4CH,:,:));
  57. if SM~=0
  58. TEMP3=TEMP;
  59. for j=1:size(TEMP,1)
  60. TEMP3(j,:)=smooth(TEMP(j,:),SM);
  61. end
  62. for i=1:size(TEMP3,2)
  63. TEMP3(:,i)=smooth(TEMP3(:,i),SM);
  64. end
  65. else
  66. TEMP3=TEMP;
  67. end
  68. Z=interp2(X,Y,TEMP3,XI,YI);
  69. colormap('default')
  70. imagesc(V4Lims(1,:),V4Lims(2,:),Z/max(max(Z)));
  71. set(gca,'YDir','normal')
  72. hold on; axis('square')
  73. % Plot v1 channel RF.
  74. COLORS=[159/255, 29/255, 53/255; 0 128/255 0; ...
  75. 125/255, 249/255, 1; 244/255, 196/255, 48/255];
  76. for v1=v1ch
  77. TEMP=DATAV1(v1);
  78. DAT=TEMP.DAT;
  79. sampf=TEMP.Sampf;
  80. MP=TEMP.MP;
  81. DegperS=TEMP.DegperS;
  82. OFF.rho=TEMP.RFPecc;
  83. OFF.angle=TEMP.RFPangle;
  84. RF_INFO(v1)= RFpos(DAT, sampf, MP, DegperS, OFF);
  85. Mid=RF_INFO(v1).Mid;
  86. WH=RF_INFO(v1).WH;
  87. clr=RF_INFO(v1).clr;
  88. Ic=RF_INFO(v1).Ic;
  89. if v1==1;channs=[14];
  90. elseif v1==2;channs=[1 2 3 4 6 11 12 14 15];
  91. elseif v1==3;channs=[2];
  92. end
  93. for chan = channs
  94. M = [Mid.x(chan) Mid.y(chan)];
  95. P = patch([Mid.x(chan)-WH(chan).w2 Mid.x(chan)+WH(chan).w2 ...
  96. Mid.x(chan)+WH(chan).w2 Mid.x(chan)-WH(chan).w2], ...
  97. [Mid.y(chan)-WH(chan).h2 Mid.y(chan)-WH(chan).h2 ...
  98. Mid.y(chan)+WH(chan).h2 Mid.y(chan)+WH(chan).h2],COLORS(v1,:), ...
  99. 'EdgeColor', 'w','LineWidth',4);
  100. set(P,'FaceColor','none')
  101. end
  102. end
  103. set(gca,'XAxisLocation','top'); set(gca,'Color',[0 0 1]);
  104. xlabel('Horizontal Position [deg]'); ylabel('Vertical Position [deg]');
  105. print_figure('figure3B',[0 0 7 7],fullfile(fld.figs,'FIG_3'),save_figs)
  106. cd(fld.scripts);
  107. %% FIGURE 4A - Test Overlap RF ==========================================
  108. fprintf('\n -- FIGURE 4A ----------\n');
  109. OVER = V1MS.RFDATA(:,5); % Overlapp between V1 anv V4 RFs.
  110. EFFE = 50*V1MS.EFFECT(1,:); % Effect size for ALL channels.
  111. AMP = V1MS.RFDATA(:,8); % MS current amplitude.
  112. % Same as before but only for unit with a significant EFFECT and there is
  113. % RF data for both V1 and V4 electrode.
  114. OVER_SIG = OVER(logical(V1MS.CLEAN.UNITSIND) & ~isnan(OVER));
  115. EFFE_SIG = EFFE(logical(V1MS.CLEAN.UNITSIND) & ~isnan(OVER));
  116. AMP_SIG = AMP(logical(V1MS.CLEAN.UNITSIND) & ~isnan(OVER));
  117. % Compute correlation for current normalized effect size.
  118. eff = EFFE_SIG./AMP_SIG';
  119. over = OVER_SIG;
  120. iNAN = isnan(eff);
  121. eff(iNAN) = [];
  122. over(iNAN) = [];
  123. X = [ones(length(eff),1) over];
  124. y = eff';
  125. [b,bint,r,rint,stats] = regress(y,X);
  126. % Same as before with both significant and non significant units.
  127. OVER = OVER(~isnan(OVER));
  128. EFFE = EFFE(~isnan(OVER));
  129. AMP = AMP(~isnan(OVER));
  130. eff = EFFE./AMP';
  131. over = OVER;
  132. iNAN = isnan(eff);
  133. eff(iNAN) = [];
  134. over(iNAN) = [];
  135. X = [ones(length(eff),1) over];
  136. y = eff';
  137. [b,bint,r,rint,stats] = regress(y,X);
  138. %Significante of the correlations.
  139. fprintf('\n-- Regression RF vs Exc Effect --\n');
  140. [r,n,p,t] = regressionTTest(y,stats);
  141. disp(['R = ' num2str(r)])
  142. disp(['N = ' num2str(n)])
  143. disp(['P = ' num2str(p)])
  144. disp(['T = ' num2str(t)])
  145. figure(132);clf;hold all
  146. set(gca,'FontSize',FSZ)
  147. scatter(OVER,EFFE./AMP',60,[0.75 0.75 0.9],'filled','LineWidth',1)
  148. scatter(OVER_SIG,EFFE_SIG./AMP_SIG',60,V1MS.META.COLS(4,:),...
  149. 'filled','LineWidth',1)
  150. xlim([0 1]); ylim([-0.01 0.055]*50);
  151. plot([0.1 0.97],b(2)*[0.15 0.99]+b(1),'Color',0*V1MS.META.COLS(2,:))
  152. ylabel('Effect Size'); plot(xlim,[0 0],'k:','LineWidth',2);
  153. xlabel('RFs Overlap');
  154. print_figure('figure4A',[0 0 7 7],fullfile(fld.figs,'FIG_4'),save_figs)
  155. cd(fld.scripts);
  156. %% FIGURE S3A - SOA per Monkey ==========================================
  157. fprintf('\n -- SUPP FIGURE 3A ----------\n');
  158. S = 10; SS = [-0.05 0.05 .15];
  159. monkeys = {'B' 'C'};
  160. for M = 1:2
  161. figure (800+M);clf;
  162. iM = strcmp(V1MS.MONKEY,monkeys{M});
  163. temp = nanmean(nanmean(V1MS.CLEAN.UNITS(:,iM,:),3),1);
  164. ncount=sum(~isnan(temp));
  165. fprintf(['Monkey ' monkeys{M} ', n = ' num2str(ncount) '\n']);
  166. AVE = squeeze(nanmean(V1MS.CLEAN.UNITS(:,iM,:),2));
  167. for soa = 1:3
  168. subplot(1,3,soa);hold all;
  169. set(gca,'FontSize',FSZ)
  170. xlim([-0.1 0.35])
  171. if strcmp(monkeys{M},'C')
  172. ylim([-1 3.3])
  173. else
  174. ylim([-0.2 1.7])
  175. end
  176. YL = ylim;
  177. p = patch([SS(soa) SS(soa) SS(soa)+0.025 ...
  178. SS(soa)+0.025],[YL(1) YL(2) YL(2) YL(1)],0.8*[1 1 1],...
  179. 'EdgeColor','none','FaceColor',[230 220 110]/255);
  180. hms = plot(V1MS.TIME,smooth(AVE(:,soa+1)/nanmax(smooth(AVE(:,1),S)),S),...
  181. 'Color',V1MS.META.COLS(soa+1,:), 'LineWidth',2);
  182. hbl = plot(V1MS.TIME,smooth(AVE(:,1),S)/nanmax(smooth(AVE(:,1),S)),...
  183. 'Color',V1MS.META.COLS(1,:)*0,'LineWidth',2);
  184. legend([hbl hms],{'no MS' 'MS'}); xlabel('Time [s]');
  185. title(['SOA ' num2str(SS(soa)*1000) ' ms']);
  186. end
  187. print_figure(['suppfigure3A_Monkey' monkeys{M}],[0 0 7 7],...
  188. fullfile(fld.figs,'SUPPFIG_3'),save_figs);
  189. cd(fld.scripts);
  190. end
  191. %% FIGURE 3E - SOA both monkeys =========================================
  192. fprintf('\n -- FIGURE 3E ----------\n');
  193. S = 10; SS = [-0.05 0.05 .15];
  194. figure(55);clf;
  195. for soa = 1:3
  196. subplot(1,3,soa);hold all;
  197. set(gca,'FontSize',FSZ)
  198. xlim([-0.1 0.35])
  199. ylim([-0.7 3.4])
  200. YL = ylim;
  201. p = patch([SS(soa) SS(soa) SS(soa)+0.025 SS(soa)+0.025],...
  202. [YL(1) YL(2) YL(2) YL(1)],0.8*[1 1 1],'EdgeColor','none','FaceColor',...
  203. [230 220 110]/255);
  204. hms = plot(V1MS.TIME,smooth(V1MS.CLEAN.AVE(:,soa+1)/...
  205. nanmax(smooth(V1MS.CLEAN.AVE(:,1),S)),S),...
  206. 'Color',V1MS.META.COLS(soa+1,:), 'LineWidth',2);
  207. hbl = plot(V1MS.TIME,smooth(V1MS.CLEAN.AVE(:,1),S)/...
  208. nanmax(smooth(V1MS.CLEAN.AVE(:,1),S)),...
  209. 'Color',V1MS.META.COLS(1,:)*0,'LineWidth',2);
  210. legend([hbl hms],{'no MS' 'MS'})
  211. title(['SOA ' num2str(SS(soa)*1000) ' ms']);
  212. xlabel('Time [s]')
  213. end
  214. print_figure('figure3E' ,[0 0 7 7],fullfile(fld.figs,'FIG_3'),save_figs);
  215. cd(fld.scripts);
  216. %% FIGURE 3F - Difference for every SOA locked to MS ====================
  217. fprintf('\n -- FIGURE 3F ----------\n');
  218. figure(8);clf;hold all;
  219. set(gca,'FontSize',FSZ)
  220. ylim([-0.8 3.45])
  221. YL = ylim;
  222. p = patch([0 0 0.025 0.025],[YL(1) YL(2) YL(2) YL(1)],0.8*[1 1 1],...
  223. 'EdgeColor','none','FaceColor',[230 220 110]/255);
  224. S = 10; SAOS = [-0.05 0.05 0.15];
  225. hds = [];
  226. for soa = 1:3
  227. hds(end+1) = plot(V1MS.TIME-SAOS(soa),...
  228. smooth(-V1MS.CLEAN.AVE(:,1)+V1MS.CLEAN.AVE(:,soa+1),S)/...
  229. nanmax(smooth(V1MS.CLEAN.AVE(:,1),S)),...
  230. 'Color',V1MS.META.COLS(soa+1,:),'LineWidth',2);
  231. xlim([-0.1 0.2])
  232. end
  233. plot(xlim,[0 0],'k:')
  234. legend(hds,{'-50ms' '50ms' '150ms'},'Location','NorthEast')
  235. xlabel('Time [s]')
  236. print_figure('figure3F' ,[0 0 7 7],fullfile(fld.figs,'FIG_3'),save_figs);
  237. cd(fld.scripts);
  238. %% FIGURE S4B - 25% of electrodes with smalles effect size at SOA 2 =====
  239. fprintf('\n -- SUPP FIGURE 4B ----------\n');
  240. eff = V1MS.CLEAN.EFFECT(2,:)';
  241. amp = V1MS.RFDATA(:,8);
  242. units = V1MS.CLEAN.UNITS;
  243. iNotNan = ~isnan(eff) & ~isnan(amp);
  244. eff = eff(iNotNan);amp = amp(iNotNan);units = units(:,iNotNan,:);
  245. [v,indSort] = sort(abs(eff));
  246. i25percent = 1:round(0.25*length(amp));
  247. avUnits = squeeze(nanmean(units,2));
  248. av25units = squeeze(nanmean(units(:,indSort(i25percent),:),2));
  249. subUnits = avUnits(:,2:4) - repmat(avUnits(:,1),1,3);
  250. sub25units = av25units(:,2:4) - repmat(av25units(:,1),1,3);
  251. figure(856);clf;hold all;
  252. set(gca,'FontSize',FSZ)
  253. ylim([-0.6 1.8])
  254. YL = ylim;p = patch([0 0 0.025 0.025],[YL(1) YL(2) YL(2) YL(1)],...
  255. 0.8*[1 1 1],'EdgeColor','none','FaceColor',[230 220 110]/255);
  256. S = 3;
  257. SAOS = [-0.05 0.05 0.15];
  258. hds = [];
  259. for soa = 1:3
  260. hds(end+1) = plot(V1MS.TIME-SAOS(soa),...
  261. smooth(-av25units(:,1)+av25units(:,soa+1),S)/...
  262. nanmax(smooth(av25units(:,1),S)),'Color',...
  263. V1MS.META.COLS(soa+1,:),'LineWidth',2);
  264. xlim([-0.1 0.3])
  265. end
  266. plot(xlim,[0 0],'k:')
  267. legend(hds,{'-50ms' '50ms' '150ms'},'Location','NorthEast')
  268. ylabel('MS - BL'); xlabel('Time [s]')
  269. print_figure('suppfigure4B' ,[0 0 7 7],...
  270. fullfile(fld.figs,'SUPPFIG_4'),save_figs);
  271. cd(fld.scripts);
  272. %% FIGURE S4A - MUA for 25% electrodes with smallest effect at SOA 2 ====
  273. fprintf('\n -- SUPP FIGURE 4A ----------\n');
  274. S = 10; SS = [-0.05 0.05 .15];
  275. figure (soa+3737);clf;
  276. for soa = 1:3
  277. subplot(1,3,soa);hold all;
  278. set(gca,'FontSize',FSZ)
  279. xlim([-0.1 0.35])
  280. ylim([-0.3 1.7])
  281. YL = ylim;p = patch([SS(soa) SS(soa) SS(soa)+0.025 SS(soa)+0.025],...
  282. [YL(1) YL(2) YL(2) YL(1)],0.8*[1 1 1],...
  283. 'EdgeColor','none','FaceColor',[230 220 110]/255);
  284. hms = plot(V1MS.TIME,smooth(av25units(:,soa+1)/...
  285. nanmax(smooth(av25units(:,1),S)),S),'Color',...
  286. V1MS.META.COLS(soa+1,:), 'LineWidth',2);
  287. hbl = plot(V1MS.TIME,smooth(av25units(:,1),S)/...
  288. nanmax(smooth(av25units(:,1),S)),'Color',...
  289. V1MS.META.COLS(1,:)*0,'LineWidth',2);
  290. legend([hbl hms],{'no MS' 'MS'})
  291. xlabel('Time [s]')
  292. title(['SOA ' num2str(SS(soa)*1000) ' ms']);
  293. end
  294. print_figure('suppfigure4A' ,[0 0 7 7],...
  295. fullfile(fld.figs,'SUPPFIG_4'),save_figs);
  296. cd(fld.scripts);
  297. %% FIGURE S4C - Scatter plots for these conditions ======================
  298. fprintf('\n -- SUPP FIGURE 4C ----------\n');
  299. EFF = V1MS.CLEAN.EFFECT(:,iNotNan);
  300. SS = [-0.05 0.05 .15];
  301. COMBS = [1 2; 1 3; 2 3];
  302. LIMS = [-0.3 1.5];
  303. figure(178);clf;
  304. plotCount = 0;
  305. for comb = [1 3]
  306. plotCount = plotCount + 1;
  307. subplot(1,2,plotCount)
  308. hold all;
  309. scatter(V1MS.CLEAN.EFFECT(COMBS(comb,1),indSort((i25percent+1):end)),...
  310. V1MS.CLEAN.EFFECT(COMBS(comb,2),...
  311. indSort((i25percent+1):end)),10,[0 0 0],'filled');
  312. scatter(EFF(COMBS(comb,1),indSort(i25percent)),EFF(COMBS(comb,2),...
  313. indSort(i25percent)),10,[0.8 0.2 0.5],'filled');
  314. plot(LIMS,LIMS,':k');
  315. xlim(LIMS);ylim(LIMS);
  316. plot([0 0],ylim,':','Color',0.5*[1 1 1])
  317. plot(xlim,[0 0],':','Color',0.5*[1 1 1])
  318. xlabel(['SOA ' num2str(1000*SS(COMBS(comb,1))) ' ms']);
  319. ylabel(['SOA ' num2str(1000*SS(COMBS(comb,2))) ' ms']);
  320. axis square
  321. end
  322. print_figure('suppfigure4C' ,[0 0 7 7],...
  323. fullfile(fld.figs,'SUPPFIG_4'),save_figs);
  324. cd(fld.scripts);
  325. %% FIGURE 3G - Average Effect Size per SOA ==============================
  326. fprintf('\n -- SUPP FIGURE 3G ----------\n');
  327. ANOVA_DATA = [];ANOVA_DATA2 = [];
  328. figure(103);clf;hold all
  329. subplot(1,2,1);hold on;
  330. set(gca,'FontSize',FSZ)
  331. for soa = 1:3
  332. EFFE = V1MS.EFFECT(soa,:);
  333. EFFE_SIG = EFFE(logical(V1MS.CLEAN.UNITSIND))/...
  334. nanmax(smooth(V1MS.CLEAN.AVE(:,1),S));
  335. mEFF = nanmean(EFFE_SIG);
  336. sEFF = nanstd(EFFE_SIG)/sqrt(sum(~isnan(EFFE_SIG)));
  337. errorbar(soa,mEFF,sEFF,'sk','LineWidth',2);
  338. bar(soa,mEFF,'FaceColor',V1MS.META.COLS(soa+1,:))
  339. ANOVA_DATA = [ANOVA_DATA EFFE_SIG'];
  340. end
  341. ylim([0 1.65]); xlim([0.5 3.5]);
  342. set(gca,'XTick',[1 2 3],'XTickLabel',{'-20' '50' '150'})
  343. ylabel('Mean Difference'); xlabel('SOA [ms]');
  344. title('Excitation');
  345. subplot(1,2,2);hold on;
  346. set(gca,'FontSize',FSZ)
  347. for soa = 1:3
  348. EFFE2 = V1MS.SUPPR_EFFECT(soa,:);
  349. EFFE_SIG2 = EFFE2(logical(V1MS.CLEAN.UNITSIND))/...
  350. nanmax(smooth(V1MS.CLEAN.AVE(:,1),S));
  351. mEFF2 = nanmean(EFFE_SIG2);
  352. sEFF2 = nanstd(EFFE_SIG2)/sqrt(sum(~isnan(EFFE_SIG2)));
  353. errorbar(soa,mEFF2,sEFF2,'sk','LineWidth',2);
  354. bar(soa,mEFF2,'FaceColor',V1MS.META.COLS(soa+1,:))
  355. ANOVA_DATA2 = [ANOVA_DATA2 EFFE_SIG2'];
  356. end
  357. ylim([-0.55 0.05])
  358. xlim([0.5 3.5])
  359. set(gca,'XTick',[1 2 3],'XTickLabel',{'-20' '50' '150'})
  360. ylabel('Mean Difference');xlabel('SOA [ms]');
  361. title('Suppression');
  362. print_figure('figure3G' ,[0 0 7 7],fullfile(fld.figs,'FIG_3'),save_figs);
  363. cd(fld.scripts);
  364. %% STATS for FIG 3G =====================================================
  365. fprintf('Statistics for FIG 3G\n');
  366. fprintf('- Excitation -\n');
  367. anova_data = ANOVA_DATA;
  368. anova_data(isnan(ANOVA_DATA(:,1)),:) = [];
  369. [P,ANOVATAB,STATS] = anova1(anova_data);
  370. [c,m,h,names] = multcompare(STATS,'Alpha',10^-6,'CType','tukey-kramer');
  371. for i=1:3
  372. fprintf(['SOA ' num2str(c(i,1)) ' vs ' num2str(c(i,2)) ': p = ' ...
  373. num2str(c(i,6)) '\n']);
  374. end
  375. fprintf('- Suppression -\n');
  376. anova_data2 = ANOVA_DATA2;
  377. anova_data2(isnan(ANOVA_DATA2(:,1)),:) = [];
  378. [P2,ANOVATAB2,STATS2] = anova1(anova_data2);
  379. [c2,m2,h2,names2] = multcompare(STATS2,'Alpha',10^-6,'CType','tukey-kramer');
  380. for i=1:3
  381. fprintf(['SOA ' num2str(c2(i,1)) ' vs ' num2str(c2(i,2)) ': p = ' ...
  382. num2str(c2(i,6)) '\n']);
  383. end
  384. %% FIGURE 4B - Exc effect size vs MUA of Blank trials during stim. ======
  385. fprintf('\n -- FIGURE 4B ----------\n');
  386. S = 10; SS = [-0.05 0.05 .15];
  387. % Compute activity during blank trials.
  388. BASES = nan(size(V1MS.CLEAN.UNITS,2),3);
  389. for soa = 1:3
  390. indT = V1MS.TIME > (SS(soa)+0) & V1MS.TIME < (SS(soa)+0.05);
  391. BASES(:,soa) = squeeze(nanmean(V1MS.UNITS(indT,:,1),1));
  392. end
  393. % Get effect size per soa per unit
  394. EFFS = nan(size(V1MS.CLEAN.UNITS,2),3);
  395. for soa = 1:3
  396. EFFE = V1MS.EFFECT(soa,:);
  397. EFFS(:,soa) = EFFE;
  398. end
  399. figure(104);clf;hold on
  400. set(gca,'FontSize',FSZ)
  401. for soa = 3 % only the 150 ms SOA
  402. scatter(BASES(:,soa),EFFS(:,soa),60,[0.75 0.75 0.9],...
  403. 'filled','LineWidth',1),
  404. scatter(BASES(logical(V1MS.CLEAN.UNITSIND),soa),...
  405. EFFS(logical(V1MS.CLEAN.UNITSIND),soa),60,...
  406. V1MS.META.COLS(soa+1,:),'filled','LineWidth',1);
  407. % compute regressions
  408. eff = EFFS(:,soa);
  409. over = BASES(:,soa);
  410. iNAN = isnan(eff);eff(iNAN) = [];over(iNAN) = [];
  411. iNAN = isnan(over);eff(iNAN) = [];over(iNAN) = [];
  412. X = [ones(length(eff),1) over];
  413. y = eff;
  414. [b,bint,r,rint,stats] = regress(y,X);
  415. disp(['Regression stats for SOA #' num2str(soa)])
  416. [r,n,p,t] = regressionTTest(y,stats);
  417. disp(['R = ' num2str(r)])
  418. disp(['N = ' num2str(n)])
  419. disp(['P = ' num2str(p)])
  420. disp(['T = ' num2str(t)])
  421. end
  422. h = lsline;
  423. ylim([-0.3 1.4]); xlim([-0.28 0.62]);
  424. set(h(1),'Color','k','LineStyle','--')
  425. set(h(2),'LineStyle','none')
  426. xlabel('Average MUA'); ylabel('Effect Size')
  427. print_figure('figure4B' ,[0 0 7 7],fullfile(fld.figs,'FIG_4'),save_figs);
  428. cd(fld.scripts);