% Sample using rasterized array
% Monkey data from Sakurai lab

% Raster, PSTH, ISIH
figure;
colormap([1 1 1; 0 0 0]);	% black on white background

[ras1,ps1,is1] = rasterize( sak1, sakTrials);
subplot(3,3,1); imagesc(ras1');
subplot(3,3,4); plot(ps1);
subplot(3,3,7); plot(is1); drawnow;

[ras2,ps2,is2] = rasterize( sak2, sakTrials);
subplot(3,3,2); imagesc(ras2');
subplot(3,3,5); plot(ps2);
subplot(3,3,8); plot(is2); drawnow;

[ras3,ps3,is3] = rasterize( sak3, sakTrials);
subplot(3,3,3); imagesc(ras3');
subplot(3,3,6); plot(ps3);
subplot(3,3,9); plot(is3); drawnow;

% Correlograms
figure;
ts = 100;	% time span

[cov11,cor11,rcor11]= correl( ras1, ras1, ts);
subplot(3,3,1); plot( -ts:ts, [cor11,rcor11,cov11]); drawnow;

[cov12,cor12,rcor12]= correl( ras1, ras2, ts);
subplot(3,3,2); plot( -ts:ts, [cor12,rcor12,cov12]); drawnow;

[cov13,cor13,rcor13]= correl( ras1, ras3, ts);
subplot(3,3,3); plot( -ts:ts, [cor13,rcor13,cov13]); drawnow;

[cov22,cor22,rcor22]= correl( ras2, ras2, ts);
subplot(3,3,5); plot( -ts:ts, [cor22,rcor22,cov22]); drawnow;

[cov23,cor23,rcor23]= correl( ras2, ras3, ts);
subplot(3,3,6); plot( -ts:ts, [cor23,rcor23,cov23]); drawnow;

[cov33,cor33,rcor33]= correl( ras3, ras3, ts);
subplot(3,3,9); plot( -ts:ts, [cor33,rcor33,cov33]); drawnow;

% Joint PSTH: 
%jpsth = ras1*ras2';	% big matrix
%figure; imagesc( jpsth); axis('xy'); axis('equal');
