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.

98 lines
2.7 KiB
Matlab

function [y,s,r]=test_attn_spatial_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
%=ORIENTATION TUNING===============================================================
grating_wavel=4;
grating_angles=[-90:15:90];
patch_diam=2;
phase=180;
nodePref=1;
i=0;
for ga=grating_angles
i=i+1;
%DEFINE STIMULI AND ATTENTIONAL STATES
I=gabor2D(patch_diam,ga,grating_wavel,phase,1,35);
%I=image_circular_grating(patch_diam,20,grating_wavel,ga,phase,0.5);
[a,b]=size(I);
coordsPref=[ceil(a/2),ceil(b/2)];
nTrials=2;
%attend away
Amasks{1}=[]; Acoords{1}=[];
%attend to
Amasks{2}=1; Acoords{2}=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(2,nTrials,trial), plot_cropped_image(X{trial}{1}(:,:,1)-X{trial}{2}(:,:,1),0,[-0.7,0.7]);
maxsubplot(2,nTrials,trial+nTrials), rp(1,:)=cat(2,ytrace{nodePref}(coordsPref(1),coordsPref(2),:)); plot(rp); %plot_cropped_image(y{nodePref},0,[0,0.25]);
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(:,1),'b-s','LineWidth',6,'MarkerFaceColor','w','MarkerSize',16); hold on
plot(resp(:,2),'r-o','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(['unattended';'attended '])
else
print -depsc2 attn_spatial_tuning_dim.eps
end