'To plot some example disparity tuning surfaces for encoding neurons' clear all close all load Tmplates % Convert mean complex-cell correlation into mean spike count, assuming 1=mean spike count to uncorrelated stimuli: mnC = (1 + mnC); jHDprefs = [1 1 1]*17; joris = [3 4 6]; nSF = length(Neurons.SF); nphd = length(Neurons.PhaseDisp); figure('pos',[ 9 103 1276 564]) % Choose colorscale caxmn = 0; caxmx = 2; for jth=1:length(jHDprefs) jori = joris(jth);%unidrnd(length(Neurons.Ori)); jHDpref = jHDprefs(jth); for jphd=1:nphd; jSF = 2; ax(jphd,jth)=subplot(length(jHDprefs),nphd,jphd + (jth-1)*nphd); tmp = squeeze(mnC(jori,jHDpref,jSF,jphd,:,:))'; hold off imagesc(Stim.HDisps,Stim.VDisps,tmp) [mx,jH,jV] = max2d(tmp); hold on % MArk axes: plot(xlim,[0 0],'k') plot([0 0],ylim,'k') % Mark empirical maximum of actual 2D disparity tuning surface: plot(Stim.HDisps(jH),Stim.VDisps(jV),'wx','linew',2,'markersize',10) % If required, compare this to what we hoped to obtain when we specified the neuron: % plot(Neurons.PrefHDisp(jHDpref),Neurons.PrefVDisp,'go') set(gca,'ydir','norm','fonts',12) % Calculate position disparity this neuron must have been given: VD = -Neurons.PhaseDisp(jphd)/360/Neurons.SF(jSF)*sind(Neurons.Ori(jori)); HD = Neurons.PrefHDisp(jHDpref) - Neurons.PhaseDisp(jphd)/360/Neurons.SF(jSF)*cosd(Neurons.Ori(jori)); if jth==1 sgn = ''; if Neurons.PhaseDisp(jphd)< 0 sgn = '-'; end phasestr = [ sgn '\pi/' num2str(abs(180/Neurons.PhaseDisp(jphd)),'%3.0g') ]; if Neurons.PhaseDisp(jphd)==0 phasestr = '0'; end text(0.5,1.42,['\Delta\phi = ' phasestr ],'fonts',16,'units','norm','horizontalal','cent','verti','middle') end title(['\Deltax_{pos} = ' num2str(HD,'%3.2g') ' pix, \Deltay_{pos} = ' num2str(VD,'%3.2g') ' pix'],'fonts',10) caxis([caxmn caxmx]) end axes(ax(1,jth)) text(-0.58,0.5,['\theta = ' num2str(Neurons.Ori(jori)) '^o'],'fonts',16,'rot',90,'units','norm','horizontalal','cent','verti','middle') end subplot(length(jHDprefs),nSF,13) xlabel('s t i m u l u s h o r i z o n t a l d i s p a r i t y \Deltax_{stim}','fonts',16) subplot(length(jHDprefs),nSF,6) ylabel('s t i m u l u s v e r t i c a l d i s p a r i t y \Deltay_{stim}','fonts',16) % Shift axes to the left: for jth=1:length(jHDprefs) for jphd=1:nphd axes(ax(jphd,jth)) ps=get(gca,'pos'); set(gca,'pos',[ps(1)-0.05+0.011*(jphd-1) ps(2:end)]) end end % Check they are all tuned to the correct disparities: for jori=1:length(Neurons.Ori) for jphd=1:nphd for jHD=1:length(Neurons.PrefHDisp) for jSF=1:length(Neurons.SF) tmp = squeeze(mnC(jori,jHD,jSF,jphd,:,:))'; [mx,jH,jV] = max2d(tmp); HDpref(jori,jHD,jSF,jphd) = Stim.HDisps(jH); VDpref(jori,jHD,jSF,jphd) = Stim.VDisps(jV); HDprefspecified(jori,jHD,jSF,jphd) = Neurons.PrefHDisp(jHD); end end end end unique(VDpref(:)) unique(HDprefspecified(:)-HDpref(:)) h=colorbar; set(h,'pos',[0.91 0.1 0.025 0.85],'fonts',12) text(1.76,1.8,'average number of spikes fired by encoding neuron','fonts',14,'rotation',-90,'vert','mid','horiz','cen','units','norm') text(1.63,1.8,'in response to stimuli with the specified disparity','fonts',14,'rotation',-90,'vert','mid','horiz','cen','units','norm') set(gcf,'paperpositionmode','auto') print -dtiff -r500 09-PLCB-RA-1052_Fig5.tif