Fig1_example.m 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. % load stimulus images
  2. % Natural images 1-300
  3. % Black image 301
  4. % Gray image 302
  5. % While image 303
  6. load('ImageData.mat');
  7. imSize = 256; % 256x256 pixels
  8. % load Raster spikes and Receptive fields
  9. load('DATA.mat');
  10. % example cell and image in Fig.1
  11. CellID = 44;
  12. ImageID = 228;
  13. figure;
  14. set(gcf,'Position', [120 100 120+1000 100+850 ]);
  15. subplot(2,2,1)
  16. % Generate stimulus image
  17. buf = ImageData(:,ImageID);
  18. buf = reshape(buf,imSize,imSize);
  19. imagesc(buf);
  20. hold on;
  21. set(gca,'YDir','normal');
  22. colormap gray;
  23. caxis([-0.5 0.5])
  24. % Generate RF outline with 3 standard deviation
  25. RF = RF_parameter(CellID);
  26. i = zeros(2,1e3);
  27. for j=1:size(i,2)
  28. alpha = 2*pi*(j-1)/(size(i,2)-1);
  29. i(:,j) = 3*sqrtm(RF.sigma)*[cos(alpha);sin(alpha)]+RF.mu;
  30. end
  31. plot(i(1,:),i(2,:),'b','LineWidth',2);
  32. % Get Raster
  33. data = squeeze(Raster_data(CellID,:,:,:));
  34. Raster = squeeze(data(ImageID,:,:));
  35. % Get all the trials for this cell
  36. NTrial = nnz(sum(Raster,1));
  37. Raster = Raster(:,1:NTrial)';
  38. subplot(2,2,[2 4])
  39. imagesc(Raster)
  40. set(gca,'YDir','normal');
  41. xlabel('Time')
  42. ylabel('Trial')