Parcourir la source

Update 'code/neuralAnalysesOfferShiftAligned.m'

Demetrio Ferro il y a 1 mois
Parent
commit
8fcd1ffdf8
1 fichiers modifiés avec 0 ajouts et 360 suppressions
  1. 0 360
      code/neuralAnalysesOfferShiftAligned.m

+ 0 - 360
code/neuralAnalysesOfferShiftAligned.m

@@ -531,366 +531,6 @@ saveas(hfig,[most_recent_folder 'span' num2str(Nspan) 'ms_lag' num2str(Nlag) 'ms
 
 end
 
-% subplot(1,4,2);
-% spy(vectorisen(~isnan(poolspksqmat_shRalgn(:,cumsum(nccs),:)),1:2));
-% subplot(1,4,3);
-% spy(vectorisen(~isnan(pooleposxmat_shLalgn(:,cumsum(nccs),:)),1:2));
-% subplot(1,4,4);
-% spy(vectorisen(~isnan(pooleposxmat_shRalgn(:,cumsum(nccs),:)),1:2));
-% title('Aligned to shifts');
-
-
-%  SET ALIGNMENT
-%  figure('units','normalized','position',[0 0 1 1]);
-%  subplot(2,1,1); shtr=1:length(isSR); plot(rerange(ccpex(isSR(shtr),:)',ccpex(:))); hold on
-%  plot(stR(shtr),arrayfun(@(xx) rerange(ccpex(isSR(xx),stR(xx)),ccpex(:)), shtr),'rx');
-%  plot(get(gca,'XLim'),[0 0],'k:'); ylim([-1 1]); title(sprintf('sample cell, shift R detection, n_s_h_R=%d', sum(nuR)));
-%  
-%  subplot(2,1,2); shtr=1:length(isSL); plot(rerange(ccpex(isSL(shtr),:)',ccpex(:))); hold on
-%  plot(stL(shtr),arrayfun(@(xx) rerange(ccpex(isSL(xx),stL(xx)),ccpex(:)), shtr),'rx');
-%  plot(get(gca,'XLim'),[0 0],'k:'); ylim([-1 1]); title(sprintf('sample cell, shift L detection, n_s_h_L=%d', sum(nuL)));
-% 
-%  %
-%  figure('units','normalized','position',[0 0 1 1]); 
-%  subplot(2,1,1); 
-%  plot(vectorisen(pooleposxmat_shRalgn(:,end,:),1:2)'./max(abs(pooleposxmat_shRalgn(:)))); hold on;
-%  plot(get(gca,'XLim'),[0 0],'k:'); ylim([-1 1]); title(sprintf('sample cell, shift R detection, n_s_h_R=%d', sum(nuR)));
-%  
-%  subplot(2,1,2); 
-%  plot(vectorisen(pooleposxmat_shLalgn(:,end,:),1:2)'./max(abs(pooleposxmat_shLalgn(:)))); hold on;
-%  plot(get(gca,'XLim'),[0 0],'k:'); ylim([-1 1]); title(sprintf('sample cell, shift L detection, n_s_h_L=%d', sum(nuL)));
- 
- 
-% firstL offer1 - thenR delay2
-% firstR offer1 - thenL delay2
-% firstR offer1 - thenR delay2
-
-%%
-if 0
-    % re-defined on vtps_ds
-    o1LLinterval=20; %x10ms=200ms
-    d1LRinterval=20; %x10ms=200ms
-    o2LRinterval=20; %x10ms=200ms
-    d2LLinterval=20; %x10ms=200ms
-    chLLinterval=44;
-    Offer1LLtime=sum(rtmes_ds(1:2))-o1LLinterval+(1:o1LLinterval);
-    Delay1LRtime=sum(rtmes_ds(1:3))-d1LRinterval+(1:d1LRinterval);
-    Offer2LRtime=sum(rtmes_ds(1:4))-o2LRinterval+(1:o2LRinterval);
-    Delay2LLtime=sum(rtmes_ds(1:5))-d2LLinterval+(1:d2LLinterval);
-    ChoiceLLtime=sum(rtmes_ds(1:8))-chLLinterval+(1:chLLinterval);
-
-    
-    pooleposxmat_vds=pooleposxmat_ds(:,:,vtps_ds==1);
-    pooleposxmat_vrds=rmnans(vectorisen(pooleposxmat_ds(:,cumsum(nccs),vtps_ds==1),1:2));
-    xvro1LL=vectorise(nanmean(pooleposxmat_vrds(:,Offer1LLtime),2)<0);
-    xvrd1LR=vectorise(nanmean(pooleposxmat_vrds(:,Delay1LRtime),2)>0);
-    xvro2LR=vectorise(nanmean(pooleposxmat_vrds(:,Offer2LRtime),2)>0);
-    xvrd2LL=vectorise(nanmean(pooleposxmat_vrds(:,Delay2LLtime),2)<0);
-    xvrchLL=vectorise(nanmean(pooleposxmat_vrds(:,ChoiceLLtime),2)<0);
-
-    pooleposxmat_vrdds=pooleposxmat_vrds;
-    pooleposxmat_vrdds(rmnans(vectorise(pooloffer1sd(:,cumsum(nccs))))==0,:)=...
-        -pooleposxmat_vrdds(rmnans(vectorise(pooloffer1sd(:,cumsum(nccs))))==0,:);
-    
-    xvrdo1LL=vectorise(nanmean(pooleposxmat_vrdds(:,Offer1LLtime),2)<0);
-    xvrdd1LR=vectorise(nanmean(pooleposxmat_vrdds(:,Delay1LRtime),2)>0);
-    xvrdo2LR=vectorise(nanmean(pooleposxmat_vrdds(:,Offer2LRtime),2)>0);
-    xvrdd2LL=vectorise(nanmean(pooleposxmat_vrdds(:,Delay2LLtime),2)<0);
-    xvrdchLL=vectorise(nanmean(pooleposxmat_vrdds(:,ChoiceLLtime),2)<0);
-    
-    xo1LL=vectorise(nanmean(pooleposxmat_vds(:,:,Offer1LLtime),3)<0);
-    xo1LR=vectorise(nanmean(pooleposxmat_vds(:,:,Offer1LLtime),3)>0);
-    xd1LR=vectorise(nanmean(pooleposxmat_vds(:,:,Delay1LRtime),3)>0);
-    xo2LR=vectorise(nanmean(pooleposxmat_vds(:,:,Offer2LRtime),3)>0);
-    xd2LL=vectorise(nanmean(pooleposxmat_vds(:,:,Delay2LLtime),3)<0);
-    vvss=vectorisen(pooleposxmat_vds,1:2);
-    vvrss=(pooleposxmat_vrds);
-    iso1LL=nanmean(pooleposxmat_vds(:,:,Offer1LLtime),3)<0;
-    isd1LR=nanmean(pooleposxmat_vds(:,:,Delay1LRtime),3)>0;
-    iso2LR=nanmean(pooleposxmat_vds(:,:,Offer2LRtime),3)>0;
-    isd2LL=nanmean(pooleposxmat_vds(:,:,Delay2LLtime),3)<0;
-    iso1LLd2LL=  iso1LL &  isd2LL;
-    iso1LLd1LR=  iso1LL &(~isd2LL);
-    iso1LLd1LLd2LL=  iso1LL & (~isd1LR) &  isd2LL;
-    iso1LLd1LLd2LR=  iso1LL & (~isd1LR) &(~isd2LL);
-    
-    iso2LRd2LL=  iso2LR &  isd2LL;
-    iso2LRd2LR=  iso2LR &(~isd2LL);
-    iso2LLd2LL=(~iso2LR)&  isd2LL;
-    iso2LLd2LR=(~iso2LR)&(~isd2LL);
-    xebins=linspace(-max(abs(vvss(:))),max(abs(vvss(:))),1e3);
-    
-    
-    firstL  =logical(rmnans(vectorise(pooloffer1sd(:,cumsum(nccs))))==1);
-    firstR  =logical(rmnans(vectorise(pooloffer1sd(:,cumsum(nccs))))==0);
-    chooseR =logical(rmnans(vectorise(poolofferchR(:,cumsum(nccs))))==1);
-    
-    %%
-    % offer1sd==1 if L; 0 if R.
-    clc
-    fprintf('LookL on offer1 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdo1LL(firstL))==1 ])*100);
-    fprintf('LookR on offer1 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdo1LL(firstL))==0 ])*100);
-    fprintf('LookL on offer1 %2.2f%% of the trials where first offer is Right.\n',  mean([double(xvrdo1LL(firstR))==1 ])*100);
-    fprintf('LookR on offer1 %2.2f%% of the trials where first offer is Right.\n\n',mean([double(xvrdo1LL(firstR))==0 ])*100);
-    
-    fprintf('LookL on delay1 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdd1LR(firstL))==0 ])*100);
-    fprintf('LookR on delay1 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdd1LR(firstL))==1 ])*100);
-    fprintf('LookL on delay1 %2.2f%% of the trials where first offer is Right.\n',  mean([double(xvrdd1LR(firstR))==0 ])*100);
-    fprintf('LookR on delay1 %2.2f%% of the trials where first offer is Right.\n\n',mean([double(xvrdd1LR(firstR))==1 ])*100);
-    
-    fprintf('LookL on offer2 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdo2LR(firstL))==0 ])*100);
-    fprintf('LookR on offer2 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdo2LR(firstL))==1 ])*100);
-    fprintf('LookL on offer2 %2.2f%% of the trials where first offer is Right.\n',  mean([double(xvrdo2LR(firstR))==0 ])*100);
-    fprintf('LookR on offer2 %2.2f%% of the trials where first offer is Right.\n\n',mean([double(xvrdo2LR(firstR))==1 ])*100);
-    
-    fprintf('LookL on delay2 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdd2LL(firstL))==1 ])*100);
-    fprintf('LookR on delay2 %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdd2LL(firstL))==0 ])*100);
-    fprintf('LookL on delay2 %2.2f%% of the trials where first offer is Right.\n',  mean([double(xvrdd2LL(firstR))==1 ])*100);
-    fprintf('LookR on delay2 %2.2f%% of the trials where first offer is Right.\n\n',mean([double(xvrdd2LL(firstR))==0 ])*100);
-    
-    fprintf('LookL on choice %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdchLL(firstL))==1 ])*100);
-    fprintf('LookR on choice %2.2f%% of the trials where first offer is Left.\n',   mean([double(xvrdchLL(firstL))==0 ])*100);
-    fprintf('LookL on choice %2.2f%% of the trials where first offer is Right.\n',  mean([double(xvrdchLL(firstR))==1 ])*100);
-    fprintf('LookR on choice %2.2f%% of the trials where first offer is Right.\n\n',mean([double(xvrdchLL(firstR))==0 ])*100);
-    
-    %%
-    Fisbest =logical(rmnans(vectorise(pooloffer1ev(:,cumsum(nccs)))) >rmnans(vectorise(pooloffer2ev(:,cumsum(nccs)))));
-    Sisbest =logical(rmnans(vectorise(pooloffer1ev(:,cumsum(nccs)))) <rmnans(vectorise(pooloffer2ev(:,cumsum(nccs)))));
-    FSssame =logical(rmnans(vectorise(pooloffer1ev(:,cumsum(nccs))))==rmnans(vectorise(pooloffer2ev(:,cumsum(nccs)))));
-    
-    Lisbest_reref= logical([Fisbest & firstL;  Fisbest & firstR]);
-    Risbest_reref= logical([Sisbest & firstL;  Sisbest & firstR]);
-    chR_reref=logical([chooseR==1 & firstL; chooseR==0 & firstR]);
-    
-    clc
-    % LookL and Lis best means LookL(firstL&Fisbest) + LookR(firstR&Risbest) 
-    % LL fL fLbest - LL fR fRbest - LL fL SRbest - LL fR SLbest  
-    % LL fL fLbest - LL fL fLbest - LR fL fRbest - LL fL 
-    fprintf('LookL on offer1 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdo1LL(Fisbest & firstL)==1)  double(xvrdo1LL(Fisbest & firstR)==0)])*100);
-    fprintf('LookL on offer1 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdo1LL(Sisbest & firstL)==1)  double(xvrdo1LL(Sisbest & firstR)==0)])*100);
-    fprintf('LookL on offer1 %2.2f%% of the trials where first, left offer is same.\n',  mean([double(xvrdo1LL(firstL  & FSssame)==1) double(xvrdo1LL(firstR  & FSssame)==0)])*100);
-    fprintf('LookR on offer1 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdo1LL(Fisbest & firstL)==0)  double(xvrdo1LL(Fisbest & firstR)==1)])*100);
-    fprintf('LookR on offer1 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdo1LL(Sisbest & firstL)==0)  double(xvrdo1LL(Sisbest & firstR)==1)])*100);
-    fprintf('LookR on offer1 %2.2f%% of the trials where first, left offer is same.\n\n',mean([double(xvrdo1LL(firstL  & FSssame)==0) double(xvrdo1LL(firstR  & FSssame)==1)])*100);
-
-    fprintf('LookL on delay1 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdd1LR(Fisbest & firstL)==0)  double(xvrdd1LR(Fisbest & firstR)==1)])*100);
-    fprintf('LookL on delay1 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdd1LR(Sisbest & firstL)==0)  double(xvrdd1LR(Sisbest & firstR)==1)])*100);
-    fprintf('LookL on delay1 %2.2f%% of the trials where first, left offer is same.\n',  mean([double(xvrdd1LR(firstL  & FSssame)==0) double(xvrdd1LR(firstR  & FSssame)==1)])*100);
-    fprintf('LookR on delay1 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdd1LR(Fisbest & firstL)==1)  double(xvrdd1LR(Fisbest & firstR)==0)])*100);
-    fprintf('LookR on delay1 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdd1LR(Sisbest & firstL)==1)  double(xvrdd1LR(Sisbest & firstR)==0)])*100);
-    fprintf('LookR on delay1 %2.2f%% of the trials where first, left offer is same.\n\n',mean([double(xvrdd1LR(firstL  & FSssame)==1) double(xvrdd1LR(firstR  & FSssame)==0)])*100);
-    
-    fprintf('LookL on offer2 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdo2LR(Fisbest & firstL)==0)  double(xvrdo2LR(Fisbest & firstR)==1)])*100);
-    fprintf('LookL on offer2 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdo2LR(Sisbest & firstL)==0)  double(xvrdo2LR(Sisbest & firstR)==1)])*100);
-    fprintf('LookL on offer2 %2.2f%% of the trials where first, left offer is same.\n',  mean([double(xvrdo2LR(firstL  & FSssame)==0) double(xvrdo2LR(firstR  & FSssame)==1)])*100);
-    fprintf('LookR on offer2 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdo2LR(Fisbest & firstL)==1)  double(xvrdo2LR(Fisbest & firstR)==0)])*100);
-    fprintf('LookR on offer2 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdo2LR(Sisbest & firstL)==1)  double(xvrdo2LR(Sisbest & firstR)==0)])*100);
-    fprintf('LookR on offer2 %2.2f%% of the trials where first, left offer is same.\n\n',mean([double(xvrdo2LR(firstL  & FSssame)==1) double(xvrdo2LR(firstR  & FSssame)==0)])*100);
-    
-    fprintf('LookL on delay2 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdd2LL(Fisbest & firstL)==1)  double(xvrdd2LL(Fisbest & firstR)==0)])*100);
-    fprintf('LookL on delay2 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdd2LL(Sisbest & firstL)==1)  double(xvrdd2LL(Sisbest & firstR)==0)])*100);
-    fprintf('LookL on delay2 %2.2f%% of the trials where first, left offer is same.\n',  mean([double(xvrdd2LL(firstL  & FSssame)==1) double(xvrdd2LL(firstR  & FSssame)==0)])*100);
-    fprintf('LookR on delay2 %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdd2LL(Fisbest & firstL)==0)  double(xvrdd2LL(Fisbest & firstR)==1)])*100);
-    fprintf('LookR on delay2 %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdd2LL(Sisbest & firstL)==0)  double(xvrdd2LL(Sisbest & firstR)==1)])*100);
-    fprintf('LookR on delay2 %2.2f%% of the trials where first, left offer is same.\n\n',mean([double(xvrdd2LL(firstL  & FSssame)==0) double(xvrdd2LL(firstR  & FSssame)==1)])*100);
-    
-    fprintf('LookL on choice %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdchLL(Fisbest & firstL)==1)  double(xvrdchLL(Fisbest & firstR)==0)])*100);
-    fprintf('LookL on choice %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdchLL(Sisbest & firstL)==1)  double(xvrdchLL(Sisbest & firstR)==0)])*100);
-    fprintf('LookL on choice %2.2f%% of the trials where first, left offer is same.\n',  mean([double(xvrdchLL(firstL  & FSssame)==1) double(xvrdchLL(firstR  & FSssame)==0)])*100);
-    fprintf('LookR on choice %2.2f%% of the trials where first, left offer is best.\n',  mean([double(xvrdchLL(Fisbest & firstL)==0)  double(xvrdchLL(Fisbest & firstR)==1)])*100);
-    fprintf('LookR on choice %2.2f%% of the trials where first, left offer is worse.\n', mean([double(xvrdchLL(Sisbest & firstL)==0)  double(xvrdchLL(Sisbest & firstR)==1)])*100);
-    fprintf('LookR on choice %2.2f%% of the trials where first, left offer is same.\n\n',mean([double(xvrdchLL(firstL  & FSssame)==0) double(xvrdchLL(firstR  & FSssame)==1)])*100);
-    
-   
-    %%
-    
-    clc
-    fprintf('LookL on offer1 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdo1LL(firstL & chooseR==0))==1 double(xvrdo1LL(firstR & chooseR==1))==0])*100);
-    fprintf('LookR on offer1 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdo1LL(firstL & chooseR==0))==0 double(xvrdo1LL(firstR & chooseR==1))==1])*100);
-    fprintf('LookL on offer1 %2.2f%% of the trials where chosen offer is Right.\n',  mean([double(xvrdo1LL(firstL & chooseR==1))==1 double(xvrdo1LL(firstR & chooseR==0))==0])*100);
-    fprintf('LookR on offer1 %2.2f%% of the trials where chosen offer is Right.\n\n',mean([double(xvrdo1LL(firstL & chooseR==1))==0 double(xvrdo1LL(firstR & chooseR==0))==1])*100);
-    
-    fprintf('LookL on delay1 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdd1LR(firstL & chooseR==0))==0 double(xvrdd1LR(firstR & chooseR==1))==1])*100);
-    fprintf('LookR on delay1 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdd1LR(firstL & chooseR==0))==1 double(xvrdd1LR(firstR & chooseR==1))==0])*100);
-    fprintf('LookL on delay1 %2.2f%% of the trials where chosen offer is Right.\n',  mean([double(xvrdd1LR(firstL & chooseR==1))==0 double(xvrdd1LR(firstR & chooseR==0))==1])*100);
-    fprintf('LookR on delay1 %2.2f%% of the trials where chosen offer is Right.\n\n',mean([double(xvrdd1LR(firstL & chooseR==1))==1 double(xvrdd1LR(firstR & chooseR==0))==0])*100);
-    
-    fprintf('LookL on offer2 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdo2LR(firstL & chooseR==0))==0 double(xvrdo2LR(firstR & chooseR==1))==1])*100);
-    fprintf('LookR on offer2 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdo2LR(firstL & chooseR==0))==1 double(xvrdo2LR(firstR & chooseR==1))==0])*100);
-    fprintf('LookL on offer2 %2.2f%% of the trials where chosen offer is Right.\n',  mean([double(xvrdo2LR(firstL & chooseR==1))==0 double(xvrdo2LR(firstR & chooseR==0))==1])*100);
-    fprintf('LookR on offer2 %2.2f%% of the trials where chosen offer is Right.\n\n',mean([double(xvrdo2LR(firstL & chooseR==1))==1 double(xvrdo2LR(firstR & chooseR==0))==0])*100);
-
-    fprintf('LookL on delay2 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdd2LL(firstL & chooseR==0))==1 double(xvrdd2LL(firstR & chooseR==1))==0])*100);
-    fprintf('LookR on delay2 %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdd2LL(firstL & chooseR==0))==0 double(xvrdd2LL(firstR & chooseR==1))==1])*100);
-    fprintf('LookL on delay2 %2.2f%% of the trials where chosen offer is Right.\n',  mean([double(xvrdd2LL(firstL & chooseR==1))==1 double(xvrdd2LL(firstR & chooseR==0))==0])*100);
-    fprintf('LookR on delay2 %2.2f%% of the trials where chosen offer is Right.\n\n',mean([double(xvrdd2LL(firstL & chooseR==1))==0 double(xvrdd2LL(firstR & chooseR==0))==1])*100);
-
-    fprintf('LookL on choice %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdchLL(firstL & chooseR==0))==1 double(xvrdchLL(firstR & chooseR==1))==0])*100);
-    fprintf('LookR on choice %2.2f%% of the trials where chosen offer is Left.\n',   mean([double(xvrdchLL(firstL & chooseR==0))==0 double(xvrdchLL(firstR & chooseR==1))==1])*100);
-    fprintf('LookL on choice %2.2f%% of the trials where chosen offer is Right.\n',  mean([double(xvrdchLL(firstL & chooseR==1))==1 double(xvrdchLL(firstR & chooseR==0))==0])*100);
-    fprintf('LookR on choice %2.2f%% of the trials where chosen offer is Right.\n\n',mean([double(xvrdchLL(firstL & chooseR==1))==0 double(xvrdchLL(firstR & chooseR==0))==1])*100);
-
-    
-    %%
-    fullfig();
-    subplot(3,1,1);
-    %SUBJECTS1&2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(:,tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-        
-    subplot(3,1,2);
-    %SUBJECT1
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vectorise(pooleposxmat_vds(:,1:sum(nccs(1:4)),tt)),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    subplot(3,1,3);
-    %SUBJECT2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vectorise(pooleposxmat_vds(:,sum(nccs(1:4))+1:end,tt)),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    
-        %%
-    fullfig();
-    subplot(3,1,1);
-    %SUBJECTS1&2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vectorise(pooleposxmat_vrdds(:,tt)),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-        
-    subplot(3,1,2);
-    %SUBJECT1
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vectorise(pooleposxmat_vrdds(1:sum(ntrs(1:4)),tt)),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    subplot(3,1,3);
-    %SUBJECT2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vectorise(pooleposxmat_vrdds(sum(ntrs(1:4))+1:end,tt)),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    
-    %%
-    fullfig();
-    subplot(2,1,1);
-    % LOOK LEFT DURING OFFER1
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(xvro1LL,tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        text(Offer1LLtime(1),-10000,sprintf('LookL:%2.2f%%',mean(xvro1LL)*100),'color','r');
-    plot([1 1].*Offer1LLtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    subplot(2,1,2);
-    %LOOK RIGHT DURING OFFER1
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(~xvro1LL,tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');         text(Offer1LLtime(1),+10000,sprintf('LookR:%2.2f%%',mean(~xvro1LL)*100),'color','r');
-    plot([1 1].*Offer1LLtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    supertitle('Compare offer1 side: LookL (top), LookR (bottom)');
-    %%
-    
-    fullfig();
-    subplot(2,1,1);
-    % LOOK RIGHT DURING DELAY1
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(xvrd1LR,tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        text(Delay1LRtime(1),+10000,sprintf('LookR:%2.2f%%',mean(xvrd1LR)*100),'color','r');
-    plot([1 1].*Delay1LRtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    subplot(2,1,2);
-    %LOOK LEFT DURING DELAY1
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(~xvrd1LR,tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');         text(Delay1LRtime(1),-10000,sprintf('LookL:%2.2f%%',mean(~xvrd1LR)*100),'color','r');
-    plot([1 1].*Delay1LRtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    supertitle('Compare delay1 side: LookR (top), LookL (bottom)');
-    
-    %%
-    fullfig();
-    subplot(2,1,1);
-    % LOOK LEFT DURING OFFER1 AND LEFT DURING DELAY2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(xvro1LL&(~xvrd1LR)&xvrd2LL,tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        text(Delay2LLtime(1),-10000,sprintf('LookL:%2.2f%%',mean(xvro1LL&(~xvrd1LR)&xvrd2LL)*100),'color','r');
-    plot([1 1].*Offer1LLtime(1),get(gca,'YLim'),'r:');
-    plot([1 1].*Delay1LRtime(1),get(gca,'YLim'),'r:');
-    plot([1 1].*Delay2LLtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    subplot(2,1,2);
-    %LOOK LEFT DURING OFFER1 AND RIGHT DURING DELAY2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvss(xvro1LL&(~xvrd1LR)&(~xvrd2LL),tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for jj=1:8; plot([1 1].*sum(rtmes_ds(1:jj)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:jj-1)),max(get(gca,'YLim')),twLabels{jj}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');         text(Delay2LLtime(1),+10000,sprintf('LookR:%2.2f%%',mean(xvro1LL&(~xvrd1LR)&(~xvrd2LL))*100),'color','r');
-    plot([1 1].*Offer1LLtime(1),get(gca,'YLim'),'r:');
-    plot([1 1].*Delay1LRtime(1),get(gca,'YLim'),'r:');
-    plot([1 1].*Delay2LLtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    supertitle('offer1 LookL, delay1 LookL, compare delay2 side: LookL (top), LookR (bottom)');
-    
-    %%
-    Vpl(1,:)=( xvro1LL)&(~xvrd1LR);% offer1=L  delay1=L
-    Vpl(2,:)=( xvro1LL)&( xvrd1LR);% offer1=L  delay1=R
-    Vpl(3,:)=(~xvro1LL)&(~xvrd1LR);% offer1=R  delay1=L
-    Vpl(4,:)=(~xvro1LL)&( xvrd1LR);% offer1=R  delay1=R
-    Vpl(5,:)=(~xvro2LR)&( xvrd2LL);% offer2=L  delay1=L
-    Vpl(6,:)=(~xvro2LR)&(~xvrd2LL);% offer2=L  delay1=R
-    Vpl(7,:)=( xvro2LR)&( xvrd2LL);% offer2=R  delay1=L
-    Vpl(8,:)=( xvro2LR)&(~xvrd2LL);% offer2=R  delay1=R
-    
-    Spl={'Off1L,Del1L=','Off1L,Del1R=','Off1R,Del1L=','Off1R,Del1R=',...
-         'Off2L,Del2L=','off2L,Del2R=','Off2R,Del2L=','Off2R,Del2R='};
-    Ppl=[0 0; 0 1; 1 0; 1 1];
-     
-    for jj=[1 3 5 7]
-    fullfig([Ppl((jj+1)/2,:)*.5 .5 .5]);
-    subplot(2,1,1);
-    % LOOK RIGHT DURING OFFER2 AND LEFT DURING DELAY2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(Vpl(jj,:),tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for tt=1:8; plot([1 1].*sum(rtmes_ds(1:tt)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:tt-1)),max(get(gca,'YLim')),twLabels{tt}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');        text(Delay2LLtime(1),-10000,sprintf('%s:%2.2f%%',Spl{jj},mean(Vpl(jj,:))*100),'color','r');
-    plot([1 1].*Offer2LRtime(1),get(gca,'YLim'),'r:');
-    plot([1 1].*Delay2LLtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-    
-    subplot(2,1,2);
-    %LOOK RIGHT DURING OFFER2 AND RIGHT DURING DELAY2
-    for tt=1:Nvtps_ds; [hc(:,tt),he]=histcounts(vvrss(Vpl(jj+1,:),tt),xebins,'Normalization', 'probability'); end
-    imagesc(rtmax_ds,he,hc); colormap(getdivergentcolmap(repmat(1:-.25:0,3,1)',[8 16 32 128])); hold on; view(2)
-    for tt=1:8; plot([1 1].*sum(rtmes_ds(1:tt)),get(gca,'YLim'),'k:'); text(sum(rtmes_ds(1:tt-1)),max(get(gca,'YLim')),twLabels{tt}); end
-    plot([0 sum(rtmes_ds)],[0 0],'k:');         text(Delay2LLtime(1),+10000,sprintf('%s:%2.2f%%',Spl{jj+1},mean(Vpl(jj+1,:))*100),'color','r');
-    plot([1 1].*Offer2LRtime(1),get(gca,'YLim'),'r:');
-    plot([1 1].*Delay2LLtime(1),get(gca,'YLim'),'r:');
-    xlabel('time bins (10 ms)'); ylabel('eye pos. (<0 is L; >0 is R)');
-
-    end
-    
-end
 
 %% Regress EV vs Spiking
 if recomputelm