You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DriversModulators/test_attn_spatial_pair_tuni...

113 lines
3.2 KiB
Matlab

function [y,s,r]=test_attn_spatial_pair_tuning(figoffset)
if nargin<1 || isempty(figoffset), figoffset=0; end
iterations=25;
offTime=25;
plotIntermediate=1;
%DEFINE V1 PREDICTION NEURON RECEPTIVE FIELDS
phases=[0,180]; %even only
%phases=[90,270]; %odd only
%phases=[0,180,90,270] %even and odd
texture=0;
lateral=0;
[w,v,v1Masks,lgnMasks]=filter_definitions_V1_simple_diffGauss([],[],1, [0,0],phases);
if texture
[w,v,v1Masks]=filter_definitions_V1_simple_diffGauss(w,v,1, [v1Masks,0],phases);
phases=[phases;phases];
end
fbMasks=1;
for i=1:fbMasks
for j=1:v1Masks
mask=gauss2D(3,0,1,0);
%top-down, attentional, weights to V1
w{j,lgnMasks+i}=mask;
v{j,lgnMasks+i}=mask;
end
end
if lateral
[w,v]=filter_definitions_V1_recurrent(w,v,0.5, [0,lgnMasks+fbMasks],phases);
end
%=TUNING CURVE: TWO STIMULI IN RF=====================================================
%coordsPref=[16,16];
%I=zeros(35,35); I(17:21,19)=1; Ipoor=I;coordsPoor=[19,19];
%nodePref=9;
%nodePoor=13;
%barlen=5;
%bar=define_bar(barlen,1);
%backgnd=0;contrast=1;
%orientations=[-90:15:90];
grating_wavel=4;
orientations=[-90:15:90];
patch_diam=2;
phase=180;
nodePref=1;
coordsPref=[16,16];
Ipoor=gabor2D(patch_diam,90,grating_wavel,phase,1,35,2,2);
nodePoor=5;
coordsPoor=[20,20];
i=0;
for orient=orientations
i=i+1;
%DEFINE STIMULI AND ATTENTIONAL STATES
%I=draw_bar(Ipoor,coordsPref(1),coordsPref(2),bar,orient,contrast,backgnd);
I=Ipoor+gabor2D(patch_diam,orient,grating_wavel,phase,1,35,-2,-2);
nTrials=3;
%attend away
Amasks{1}=[]; Acoords{1}=[];
%attend to poor stimulus
Amasks{2}=1; Acoords{2}=coordsPoor;
%attend to varying stimulus
Amasks{3}=1; Acoords{3}=coordsPref;
X=define_input_with_cutoff_and_attn(I,nTrials,fbMasks,Amasks,Acoords,offTime,iterations);
%SIMULATE MODEL
if plotIntermediate, figoffset=figoffset+1; figure(figoffset), clf, end
for trial=1:nTrials
%iterate model
[y,E,R,ytrace]=dim_activation_conv_recurrent(w,X{trial},[],iterations,v);
%plot and record results
if offTime<iterations,
for j=1:length(y),
y{j}=ytrace{j}(:,:,offTime);
end
end
if plotIntermediate
maxsubplot(3,nTrials,trial), plot_cropped_image(X{trial}{1}(:,:,1)-X{trial}{2}(:,:,1),0,[-0.7,0.7]);
maxsubplot(3,nTrials,trial+nTrials), plot_cropped_image(y{nodePref},0,[0,0.125]);
maxsubplot(3,nTrials,trial+2*nTrials), plot_cropped_image(y{nodePoor},0,[0,0.125]);
end
response=cat(2,ytrace{nodePref}(coordsPref(1),coordsPref(2),:));
resp(i,trial)=mean(response);
end
end
%PLOT RESULTS
figoffset=figoffset+1; figure(figoffset), clf
%plot(resp,'LineWidth',4);
plot(resp(:,3),'r-o','LineWidth',6,'MarkerFaceColor','w','MarkerSize',16);hold on
plot(resp(:,1),'b-s','LineWidth',6,'MarkerFaceColor','w','MarkerSize',16);
plot(resp(:,2),'-x','Color',[0,0.7,0],'LineWidth',6,'MarkerFaceColor','w','MarkerSize',16);
ax=axis;
axis([1,13,0,ax(4)])
set(gca,'XTick',[1:3:13],'XTickLabel',[-90:45:90],'FontSize',24);
ylabel('Response')
xlabel('Orientation (degrees)')
set(gca,'YTick',[]);
drawnow;
set(gcf,'PaperPosition',[0,0,15,12])
if plotIntermediate
legend(['attend varying';'attend away ';'attend poor ';])
else
print -depsc2 attn_spatial_pair_tuning_dim.eps
end