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.

103 lines
2.9 KiB
Matlab

function [y,s,r]=test_attn_featural_tuning(figoffset)
if nargin<1 || isempty(figoffset), figoffset=0; end
iterations=10;
offTime=20;
plotIntermediate=1;
%DEFINE V1 PREDICTION NEURON RECEPTIVE FIELDS
wScaleLat=0.5;
wScaleV2=0.35;
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=8;
for i=1:fbMasks
for j=1:v1Masks
mask=gauss2D(25,0,1,0);
dist=min([rem(abs(j-i),8),rem(abs(j-(i-8)),8),rem(abs(j-(i+8)),8),rem(abs(j-(i+16)),8)]);
scale=exp(-(dist^2)./(2*0.5^2));
%top-down, attentional, weights to V1
w{j,lgnMasks+i}=scale.*mask;
v{j,lgnMasks+i}=scale.*mask;
end
end
if lateral
[w,v]=filter_definitions_V1_recurrent(w,v,0.5, [0,lgnMasks+fbMasks],phases);
end
%=TUNING CURVE: ONE STIMULUS IN RF======================================================
grating_wavel=4;
grating_angles=[0:22.5:180];
patch_diam=2;
phase=180;
nodePref=5;
attnCoords=[18,18]
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 stimulus features
Amasks{2}=rem(i-1,8)+1; Acoords{2}=attnCoords;
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), 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,9,0,ax(4)])
set(gca,'XTick',[1:2:9],'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_featural_tuning_dim.eps
end