Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

process_Spectral_Coherence_V1V4_PreFirstDim.m 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. addpath(genpath('./support_routines'));
  2. addpath(genpath('./support_tools'));
  3. clear all; close all; clc;
  4. sSubjectName='monkey 2';
  5. sVisualArea='V1V4';
  6. subjectInfos=getSubjectInfos(sSubjectName);
  7. subjectDataV1=getSubjectData(sSubjectName,'V1','ALL','LFPs','ALL');
  8. subjectDataV4=getSubjectData(sSubjectName,'V4','ALL','LFPs','ALL');
  9. SAMPLING_FREQ=1017.38;
  10. NUM_TIME_SAMPLES=512;
  11. NUM_FREQ_SAMPLES=NUM_TIME_SAMPLES/2+1;
  12. timeAxis=linspace(0,NUM_TIME_SAMPLES/SAMPLING_FREQ,NUM_TIME_SAMPLES);
  13. freqAxis=linspace(0,SAMPLING_FREQ/2,NUM_FREQ_SAMPLES);
  14. freqIndices2Plot=find(freqAxis<=100);
  15. lamLayerTag={'Supra','Granr','Infra'};
  16. gratCondTag={'RF','OUT1','OUT2'};
  17. plotPmtsPenAvgOutMeanPoolLayers=1;
  18. % REMOVE DATA IN TIME WINDOWS OTHER THAN PREFIRSTDIM TO SAVE MEMORY
  19. rmpp=[];
  20. for pp=1:length(subjectDataV1.LfpStruct)
  21. if ~isempty(subjectDataV1.LfpStruct(pp).Sorted)
  22. rmfn=fieldnames(subjectDataV1.LfpStruct(pp).Sorted.Full.Supra.RF);
  23. rmfn(cellfun(@(fnm) strcmpi(fnm,'PreFirstDimDataBiZSc'),rmfn))=[];
  24. for ll=1:3
  25. subjectDataV1.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).RF=rmfield(subjectDataV1.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).RF,rmfn);
  26. subjectDataV1.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT1=rmfield(subjectDataV1.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT1,rmfn);
  27. subjectDataV1.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT2=rmfield(subjectDataV1.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT2,rmfn);
  28. end
  29. else
  30. rmpp=cat(1,rmpp,pp);
  31. end
  32. end
  33. subjectDataV1.LfpStruct(rmpp)=[]; subjectDataV1.penInfos(rmpp)=[]; subjectDataV1.penIDs(rmpp)=[];
  34. rmpp=[];
  35. for pp=1:length(subjectDataV4.LfpStruct)
  36. if ~isempty(subjectDataV4.LfpStruct(pp).Sorted)
  37. rmfn=fieldnames(subjectDataV4.LfpStruct(pp).Sorted.Full.Supra.RF);
  38. rmfn(cellfun(@(fnm) strcmpi(fnm,'PreFirstDimDataBiZSc'),rmfn))=[];
  39. for ll=1:3
  40. subjectDataV4.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).RF=rmfield(subjectDataV4.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).RF,rmfn);
  41. subjectDataV4.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT1=rmfield(subjectDataV4.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT1,rmfn);
  42. subjectDataV4.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT2=rmfield(subjectDataV4.LfpStruct(pp).Sorted.Full.(lamLayerTag{ll}).OUT2,rmfn);
  43. end
  44. else
  45. rmpp=cat(1,rmpp,pp);
  46. end
  47. end
  48. subjectDataV4.LfpStruct(rmpp)=[]; subjectDataV4.penInfos(rmpp)=[]; subjectDataV4.penIDs(rmpp)=[];
  49. %% Chronux settings (support_tools) - http://chronux.org/
  50. % "Observed Brain Dynamics", P. Mitra and H. Bokil, Oxford University Press, New York, 2008.
  51. paramsMT=[];
  52. paramsMT.Fs=SAMPLING_FREQ;
  53. paramsMT.tapers = [2 3]; % TW K K=2*TW-1
  54. paramsMT.trialave = 1;
  55. paramsMT.pad=0;
  56. %% FIND PENs W/SAME TRIALS IN V1 AND V4
  57. penIDsV1=arrayfun(@(jj) subjectDataV1.LfpStruct(jj).penNum,1:length(subjectDataV1.LfpStruct));
  58. penIDsV4=arrayfun(@(jj) subjectDataV4.LfpStruct(jj).penNum,1:length(subjectDataV4.LfpStruct));
  59. penIDsV1V4=intersect(penIDsV1,penIDsV4);% penIDsV1(arrayfun(@(jj) any(penIDsV4==penIDsV1(jj)), 1:length(penIDsV1)));
  60. penIndicesV1=arrayfun(@(jj) find(penIDsV1==penIDsV1V4(jj)), 1:length(penIDsV1V4));
  61. penIndicesV4=arrayfun(@(jj) find(penIDsV4==penIDsV1V4(jj)), 1:length(penIDsV1V4));
  62. counter=0;
  63. for pp=1:length(penIDsV1V4)
  64. for cnd=1:3 % LOOP OVER ATTENTIONAL CONDITIONS
  65. % FIND TRIALS WITH SAME NLX EVENT IDs FOR V1 AND V4
  66. currPenCndTrialIDsV1=subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Labels.selectedNlxEvents(remod(ceil(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Labels.GratCondition/6),3)==cnd);
  67. currPenCndTrialIDsV4=subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Labels.selectedNlxEvents(remod(ceil(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Labels.GratCondition/6),3)==cnd);
  68. currPenCndTrialIDsV1V4=intersect(currPenCndTrialIDsV1,currPenCndTrialIDsV4);
  69. currPenCndTrialIndicesV1=arrayfun(@(jj) find(currPenCndTrialIDsV1==currPenCndTrialIDsV1V4(jj)), 1:length(currPenCndTrialIDsV1V4));
  70. currPenCndTrialIndicesV4=arrayfun(@(jj) find(currPenCndTrialIDsV4==currPenCndTrialIDsV1V4(jj)), 1:length(currPenCndTrialIDsV1V4));
  71. % check that trial IDs actually match
  72. if ~all(currPenCndTrialIDsV1(currPenCndTrialIndicesV1) == currPenCndTrialIDsV4(currPenCndTrialIndicesV4))
  73. error('Some of the trials IDs for V1 do not match trial IDs for V4.');
  74. end
  75. % FIND TRIALS WITH SAME FIRST DIM DELAY FOR V1 AND V4
  76. currPenCndFirstDimDelayV1=subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Delays.FirstDim(remod(ceil(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Labels.GratCondition/6),3)==cnd);
  77. currPenCndFirstDimDelayV4=subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Delays.FirstDim(remod(ceil(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Labels.GratCondition/6),3)==cnd);
  78. if ~all(currPenCndFirstDimDelayV1(currPenCndTrialIndicesV1)==currPenCndFirstDimDelayV4(currPenCndTrialIndicesV4))
  79. error('FirstDim Delays not matching in V1 and V4 trials');
  80. end
  81. % Computing Sp Coh V1
  82. for ll1=1:3 % LOOP OVER LAMINAR LAYER 1
  83. for ll2=ll1:3 % LOOP OVER LAMINAR LAYER 2
  84. currNChll1=size(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Full.(lamLayerTag{ll1}).(gratCondTag{cnd}).PreFirstDimDataBiZSc,1);
  85. currNChll2=size(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Full.(lamLayerTag{ll2}).(gratCondTag{cnd}).PreFirstDimDataBiZSc,1);
  86. currSpCoh=nan(currNChll1*currNChll2,NUM_FREQ_SAMPLES);
  87. currSpPhi=nan(currNChll1*currNChll2,NUM_FREQ_SAMPLES);
  88. if currNChll1>0
  89. for ii=1:currNChll1
  90. currData1ch=squeeze(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Full.(lamLayerTag{ll1}).(gratCondTag{cnd}).PreFirstDimDataBiZSc(ii,currPenCndTrialIndicesV1,end-NUM_TIME_SAMPLES+1:end))';
  91. for jj=((ii+1)*(ll1==ll2)+1*(ll1~=ll2)):currNChll2
  92. currData2ch=squeeze(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Full.(lamLayerTag{ll2}).(gratCondTag{cnd}).PreFirstDimDataBiZSc(jj,currPenCndTrialIndicesV1,end-NUM_TIME_SAMPLES+1:end))';
  93. [currSpCoh((ii-1)*currNChll2+jj,:),currSpPhi((ii-1)*currNChll2+jj,:),~,~,~]=coherencyc(currData1ch,currData2ch,paramsMT);
  94. end
  95. end
  96. end
  97. sCohV1Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpCoh=currSpCoh;
  98. sCohV1Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpPhi=currSpPhi;
  99. eval(clearoutmem('currN* currD* currS*')); % saves memory at runtime
  100. end
  101. end
  102. % Computing Sp Coh V4
  103. for ll1=1:3 % LOOP OVER LAMINAR LAYER 1
  104. for ll2=ll1:3 % LOOP OVER LAMINAR LAYER 2
  105. currNChll1=size(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Full.(lamLayerTag{ll1}).(gratCondTag{cnd}).PreFirstDimDataBiZSc,1);
  106. currNChll2=size(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Full.(lamLayerTag{ll2}).(gratCondTag{cnd}).PreFirstDimDataBiZSc,1);
  107. currSpCoh=nan(currNChll1*currNChll2,NUM_FREQ_SAMPLES);
  108. currSpPhi=nan(currNChll1*currNChll2,NUM_FREQ_SAMPLES);
  109. if currNChll1>0
  110. for ii=1:currNChll1
  111. currData1ch=squeeze(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Full.(lamLayerTag{ll1}).(gratCondTag{cnd}).PreFirstDimDataBiZSc(ii,currPenCndTrialIndicesV4,end-NUM_TIME_SAMPLES+1:end))';
  112. for jj=((ii+1)*(ll1==ll2)+1*(ll1~=ll2)):currNChll2
  113. currData2ch=squeeze(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Full.(lamLayerTag{ll2}).(gratCondTag{cnd}).PreFirstDimDataBiZSc(jj,currPenCndTrialIndicesV4,end-NUM_TIME_SAMPLES+1:end))';
  114. [currSpCoh((ii-1)*currNChll2+jj,:),currSpPhi((ii-1)*currNChll2+jj,:),~,~,~]=coherencyc(currData1ch,currData2ch,paramsMT);
  115. end
  116. end
  117. end
  118. sCohV4Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpCoh=currSpCoh;
  119. sCohV4Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpPhi=currSpPhi;
  120. eval(clearoutmem('currN* currD* currS*')); % saves memory at runtime
  121. end
  122. end
  123. % Computing Sp Coh V1V4
  124. for ll1=1:3 % LOOP OVER LAMINAR LAYER 1
  125. for ll2=ll1:3 % LOOP OVER LAMINAR LAYER 2
  126. currNChll1=size(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Full.(lamLayerTag{ll1}).(gratCondTag{cnd}).PreFirstDimDataBiZSc,1);
  127. currNChll2=size(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Full.(lamLayerTag{ll2}).(gratCondTag{cnd}).PreFirstDimDataBiZSc,1);
  128. currSpCoh=nan(currNChll1*currNChll2,NUM_FREQ_SAMPLES);
  129. currSpPhi=nan(currNChll1*currNChll2,NUM_FREQ_SAMPLES);
  130. if currNChll1>0 && currNChll2>0
  131. for ii=1:currNChll1
  132. currData1ch=squeeze(subjectDataV1.LfpStruct(penIndicesV1(pp)).Sorted.Full.(lamLayerTag{ll1}).(gratCondTag{cnd}).PreFirstDimDataBiZSc(ii,currPenCndTrialIndicesV1,end-NUM_TIME_SAMPLES+1:end))';
  133. for jj=1:currNChll2
  134. currData2ch=squeeze(subjectDataV4.LfpStruct(penIndicesV4(pp)).Sorted.Full.(lamLayerTag{ll2}).(gratCondTag{cnd}).PreFirstDimDataBiZSc(jj,currPenCndTrialIndicesV4,end-NUM_TIME_SAMPLES+1:end))';
  135. if size(currData1ch,2)~=size(currData2ch,2)
  136. warning(['#trials for V1 (' num2str(size(currData1ch,2)) ') do not match #trials for V4 (' num2str(size(currData2ch,2)) ')']);
  137. end
  138. [currSpCoh((ii-1)*currNChll2+jj,:),currSpPhi((ii-1)*currNChll2+jj,:),~,~,~]=coherencyc(currData1ch,currData2ch,paramsMT);
  139. end
  140. end
  141. end
  142. sCohV1V4Struct(pp).([lamLayerTag{ll1} 'V1to' lamLayerTag{ll2} 'V4']).(gratCondTag{cnd}).PreFirstDimSpCoh=currSpCoh;
  143. sCohV1V4Struct(pp).([lamLayerTag{ll1} 'V1to' lamLayerTag{ll2} 'V4']).(gratCondTag{cnd}).PreFirstDimSpPhi=currSpPhi;
  144. eval(clearoutmem('currN* currD* currS*')); % saves memory at runtime
  145. end
  146. end
  147. end
  148. end
  149. %% Pool Sp. Coh. Magnitude / Phase across sessions
  150. PoolSpCohStructV1.AllLayers.RF.PreFirstDimSpCoh=[];
  151. PoolSpCohStructV1.AllLayers.OUT1.PreFirstDimSpCoh=[];
  152. PoolSpCohStructV1.AllLayers.OUT2.PreFirstDimSpCoh=[];
  153. PoolSpCohStructV4.AllLayers.RF.PreFirstDimSpCoh=[];
  154. PoolSpCohStructV4.AllLayers.OUT1.PreFirstDimSpCoh=[];
  155. PoolSpCohStructV4.AllLayers.OUT2.PreFirstDimSpCoh=[];
  156. PoolSpCohStructV1V4.AllLayers.RF.PreFirstDimSpCoh=[];
  157. PoolSpCohStructV1V4.AllLayers.OUT1.PreFirstDimSpCoh=[];
  158. PoolSpCohStructV1V4.AllLayers.OUT2.PreFirstDimSpCoh=[];
  159. for ll1=1:3
  160. for ll2=ll1:3
  161. for cnd=1:3
  162. currPoolPreFirstDimSpCoh1=[];
  163. currPoolPreFirstDimSpPhi1=[];
  164. currPoolPreFirstDimSpCoh2=[];
  165. currPoolPreFirstDimSpPhi2=[];
  166. currPoolPreFirstDimSpCoh3=[];
  167. currPoolPreFirstDimSpPhi3=[];
  168. for pp=1:length(sCohV1V4Struct)
  169. currPoolPreFirstDimSpCoh1=cat(1, currPoolPreFirstDimSpCoh1, sCohV1Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpCoh);
  170. currPoolPreFirstDimSpPhi1=cat(1, currPoolPreFirstDimSpPhi1, sCohV1Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpPhi);
  171. currPoolPreFirstDimSpCoh2=cat(1, currPoolPreFirstDimSpCoh2, sCohV4Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpCoh);
  172. currPoolPreFirstDimSpPhi2=cat(1, currPoolPreFirstDimSpPhi2, sCohV4Struct(pp).([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpPhi);
  173. currPoolPreFirstDimSpCoh3=cat(1, currPoolPreFirstDimSpCoh3, sCohV1V4Struct(pp).([lamLayerTag{ll1} 'V1to' lamLayerTag{ll2} 'V4']).(gratCondTag{cnd}).PreFirstDimSpCoh);
  174. currPoolPreFirstDimSpPhi3=cat(1, currPoolPreFirstDimSpPhi3, sCohV1V4Struct(pp).([lamLayerTag{ll1} 'V1to' lamLayerTag{ll2} 'V4']).(gratCondTag{cnd}).PreFirstDimSpPhi);
  175. end
  176. currPoolPreFirstDimSpCoh1(all(isnan(currPoolPreFirstDimSpCoh1')),:)=[];
  177. currPoolPreFirstDimSpPhi1(all(isnan(currPoolPreFirstDimSpPhi1')),:)=[];
  178. currPoolPreFirstDimSpCoh2(all(isnan(currPoolPreFirstDimSpCoh2')),:)=[];
  179. currPoolPreFirstDimSpPhi2(all(isnan(currPoolPreFirstDimSpPhi2')),:)=[];
  180. currPoolPreFirstDimSpCoh3(all(isnan(currPoolPreFirstDimSpCoh3')),:)=[];
  181. currPoolPreFirstDimSpPhi3(all(isnan(currPoolPreFirstDimSpPhi3')),:)=[];
  182. PoolSpCohStructV1.AllLayers.(gratCondTag{cnd}).PreFirstDimSpCoh=cat(1,PoolSpCohStructV1.AllLayers.(gratCondTag{cnd}).PreFirstDimSpCoh,currPoolPreFirstDimSpCoh1);
  183. PoolSpCohStructV4.AllLayers.(gratCondTag{cnd}).PreFirstDimSpCoh=cat(1,PoolSpCohStructV4.AllLayers.(gratCondTag{cnd}).PreFirstDimSpCoh,currPoolPreFirstDimSpCoh2);
  184. PoolSpCohStructV1V4.AllLayers.(gratCondTag{cnd}).PreFirstDimSpCoh=cat(1,PoolSpCohStructV1V4.AllLayers.(gratCondTag{cnd}).PreFirstDimSpCoh,currPoolPreFirstDimSpCoh3);
  185. PoolSpCohStructV1.([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpCoh=currPoolPreFirstDimSpCoh1;
  186. PoolSpCohStructV1.([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpPhi=currPoolPreFirstDimSpPhi1;
  187. PoolSpCohStructV4.([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpCoh=currPoolPreFirstDimSpCoh2;
  188. PoolSpCohStructV4.([lamLayerTag{ll1} 'to' lamLayerTag{ll2}]).(gratCondTag{cnd}).PreFirstDimSpPhi=currPoolPreFirstDimSpPhi2;
  189. PoolSpCohStructV1V4.([lamLayerTag{ll1} 'V1to' lamLayerTag{ll2} 'V4']).(gratCondTag{cnd}).PreFirstDimSpCoh=currPoolPreFirstDimSpCoh3;
  190. PoolSpCohStructV1V4.([lamLayerTag{ll1} 'V1to' lamLayerTag{ll2} 'V4']).(gratCondTag{cnd}).PreFirstDimSpPhi=currPoolPreFirstDimSpPhi3;
  191. eval(clearoutmem('curr*')); % saves memory at runtime
  192. end
  193. end
  194. end
  195. %% PLOT MEAN ACROSS PENS PRE-FIRST-DIM OUT=OUT1/2+OUT2/2, LAYERS POOLED
  196. if plotPmtsPenAvgOutMeanPoolLayers
  197. figure('units','normalized','outerposition',[0 0 1 .6]);
  198. subplot(1,3,1);
  199. currSpectCohRF=PoolSpCohStructV1.AllLayers.(gratCondTag{1}).PreFirstDimSpCoh;
  200. currSpectCohOUT=[nanmean(cat(4,PoolSpCohStructV1.AllLayers.(gratCondTag{2}).PreFirstDimSpCoh,...
  201. PoolSpCohStructV1.AllLayers.(gratCondTag{3}).PreFirstDimSpCoh),4)];
  202. plotmsem(freqAxis,currSpectCohRF,'r');
  203. plotmsem(freqAxis,currSpectCohOUT,'b');
  204. xlim([0 100]);
  205. xlabel('Frequency [Hz]');
  206. pValuesVec=nan(1,sum(freqAxis<100));
  207. for ff=1:sum(freqAxis<100)
  208. pValuesVec(ff)=signrank(currSpectCohRF(:,ff),currSpectCohOUT(:,ff));
  209. end
  210. [~,~,~,pValuesVecFDR]=fdr_bh(pValuesVec);
  211. pValuesBar05FDR=nan(1,sum(freqAxis<=100));
  212. pValuesBar05FDR(pValuesVecFDR<=.05)=0;
  213. plot(freqAxis(freqAxis<100),pValuesBar05FDR,'color',[0 0 0],'linewidth',2.5);
  214. set(gca,'XTick',0:20:100);
  215. title('field-field Sp. Coh. within V1 depths');
  216. subplot(1,3,2);
  217. currSpectCohRF=PoolSpCohStructV4.AllLayers.(gratCondTag{1}).PreFirstDimSpCoh;
  218. currSpectCohOUT=[nanmean(cat(4,PoolSpCohStructV4.AllLayers.(gratCondTag{2}).PreFirstDimSpCoh,...
  219. PoolSpCohStructV4.AllLayers.(gratCondTag{3}).PreFirstDimSpCoh),4)];
  220. plotmsem(freqAxis,currSpectCohRF,'r');
  221. plotmsem(freqAxis,currSpectCohOUT,'b');
  222. xlim([0 100]);
  223. xlabel('Frequency [Hz]');
  224. pValuesVec=nan(1,sum(freqAxis<=100));
  225. for ff=1:sum(freqAxis<100)
  226. pValuesVec(ff)=signrank(currSpectCohRF(:,ff),currSpectCohOUT(:,ff));
  227. end
  228. [~,~,~,pValuesVecFDR]=fdr_bh(pValuesVec);
  229. pValuesBar05FDR=nan(1,sum(freqAxis<100));
  230. pValuesBar05FDR(pValuesVecFDR<=.05)=0;
  231. plot(freqAxis(freqAxis<100),pValuesBar05FDR,'color',[0 0 0],'linewidth',2.5);
  232. set(gca,'XTick',0:20:100);
  233. title('field-field Sp. Coh. within V4 depths');
  234. subplot(1,3,3);
  235. currSpectCohRF=PoolSpCohStructV1V4.AllLayers.(gratCondTag{1}).PreFirstDimSpCoh;
  236. currSpectCohOUT=[nanmean(cat(4,PoolSpCohStructV1V4.AllLayers.(gratCondTag{2}).PreFirstDimSpCoh,...
  237. PoolSpCohStructV1V4.AllLayers.(gratCondTag{3}).PreFirstDimSpCoh),4)];
  238. plotmsem(freqAxis,currSpectCohRF,'r');
  239. plotmsem(freqAxis,currSpectCohOUT,'b');
  240. xlim([0 100]);
  241. xlabel('Frequency [Hz]');
  242. pValuesVec=nan(1,sum(freqAxis<=100));
  243. for ff=1:sum(freqAxis<100)
  244. pValuesVec(ff)=signrank(currSpectCohRF(:,ff),currSpectCohOUT(:,ff));
  245. end
  246. [~,~,~,pValuesVecFDR]=fdr_bh(pValuesVec);
  247. pValuesBar05FDR=nan(1,sum(freqAxis<100));
  248. pValuesBar05FDR(pValuesVecFDR<=.05)=0;
  249. plot(freqAxis(freqAxis<100),pValuesBar05FDR,'color',[0 0 0],'linewidth',2.5);
  250. set(gca,'XTick',0:20:100);
  251. title('field-field Sp. Coh. V1-V4');
  252. supertitle([sSubjectName ' - Avg across PENs - LFPs Pre First Dim Spectral Coherence']);
  253. end