Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.88 KB | None | 0 0
  1. clear all
  2. close all
  3. clc
  4.  
  5. % This code collects all computed spectrograms across datasets and then
  6. % creates a grand average of selective sites during Riv and during PA_FS
  7. % for comparison
  8.  
  9. %% Enumerate the datasets
  10.  
  11. % Specgrams according to Selectivity during Rivalry
  12.  
  13. datasetsDS{1} = 'B:\H07\12-06-2016\PPC\Bfsgrad1\LFPSpectrograms\MM_cleanDomSpecgrams_0.5s_back_0.5s.mat';
  14. datasetsDS{2} = 'B:\H07\13-07-2016\PPC\Bfsgrad1\LFPSpectrograms\MM_cleanDomSpecgrams_0.5s_back_0.5s.mat';
  15. datasetsDS{3} = 'B:\H07\20161019\PPC\Bfsgrad1\LFPSpectrograms\MM_cleanDomSpecgrams_0.5s_back_0.5s.mat';
  16. datasetsDS{4} = 'B:\H07\20161025\PPC\Bfsgrad1\LFPSpectrograms\MM_cleanDomSpecgrams_0.5s_back_0.5s.mat';
  17. %datasetsDS{5} = 'B:\A11\20170305\PPC\Bfsgrad1\LFPSpectrograms\cleanDomSpecgrams_0.5s_back_0.5s.mat';
  18. %datasetsDS{6} = 'B:\A11\20170302\PPC\Bfsgrad1\LFPSpectrograms\cleanDomSpecgrams_0.5s_back_0.5s.mat';
  19.  
  20.  
  21. %% Plot grand average for DomSels
  22.  
  23. % collect
  24.  
  25. specgrams90BR_norm1 = [];
  26. specgrams270BR_norm1 = [];
  27. specgrams90PA_norm1 = [];
  28. specgrams270PA_norm1 = [];
  29.  
  30.  
  31. for iDataset = 1:length(datasetsDS)
  32.    
  33.     tic;
  34.    
  35.     load(datasetsDS{iDataset});
  36.    
  37.     for iChan = 1:96
  38.    
  39.     specgrams90BR_norm1 = cat(3,specgrams90BR_norm1,cleanDomSpectrograms(iChan).BR.dom90_norm1);
  40.     specgrams90PA_norm1 = cat(3,specgrams90PA_norm1,cleanDomSpectrograms(iChan).PA.dom90_norm1);
  41.     specgrams270BR_norm1 = cat(3,specgrams270BR_norm1,cleanDomSpectrograms(iChan).BR.dom270_norm1);
  42.     specgrams270PA_norm1 = cat(3,specgrams270PA_norm1,cleanDomSpectrograms(iChan).PA.dom270_norm1);
  43. %    
  44.    
  45.     end
  46.     toc
  47. end
  48.  
  49. gaBR_norm1 = nanmean(cat(3,specgrams90BR_norm1,specgrams270BR_norm1),3);
  50. gaPA_norm1 = nanmean(cat(3,specgrams90PA_norm1,specgrams270PA_norm1),3);
  51.  
  52.  
  53. t = cleanDomSpectrograms(1).t;
  54. f = cleanDomSpectrograms(1).f;
  55.  
  56.  
  57. %% Plot log scales
  58.  
  59. cd B:\Results\Spectrograms
  60. mkdir PPC
  61. cd PPC
  62. mkdir('Pooled_Spectrograms')
  63. cd Pooled_Spectrograms
  64. mkdir MM
  65. cd MM
  66. mkdir('05s')
  67. cd 05s
  68.  
  69. Yticks = 2.^(round(log2(min(f))):round(log2(max(f))));
  70.  
  71.  
  72.  
  73. % Normalised
  74.  
  75. figure(6)
  76. subplot(1,2,1)
  77. imagesc(t,log2(f),gaPA_norm1); shading('interp')
  78. xlabel('time in s');
  79. ylabel('Hz')
  80. vline(0,'--w'); AX = gca;
  81. set(AX, 'YTick',log2(Yticks(:)), 'YTickLabel',num2str(sprintf('%g\n',Yticks)))
  82. AX.YLim = log2([min(f), max(f)]);
  83. axis xy
  84. colormap jet
  85. AX = gca;
  86. AX.CLim = [0 0.7];
  87. title('PA - Pooled')
  88.  
  89. subplot(1,2,2)
  90. imagesc(t,log2(f),gaBR_norm1); shading('interp')
  91. xlabel('time in s');
  92. ylabel('Hz')
  93. vline(0,'--w'); AX = gca;
  94. set(AX, 'YTick',log2(Yticks(:)), 'YTickLabel',num2str(sprintf('%g\n',Yticks)))
  95. AX.YLim = log2([min(f), max(f)]);
  96. axis xy
  97. colormap jet
  98. AX = gca;
  99. AX.CLim = [-0.1 0.5];
  100. title('BR - Pooled')
  101. set(gcf, 'Position', get(0, 'Screensize'));
  102. saveas(gcf,'FreqZscored_LogScale_05s_UnBaselined_Specgrams','png')
  103. saveas(gcf,'FreqZscored_LogScale_05s_UnBaselined_Specgrams','fig')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement