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
3.0 KiB
Matlab
103 lines
3.0 KiB
Matlab
function [y,s,r]=test_attn_spatial_pair(figoffset)
|
|
if nargin<1 || isempty(figoffset), figoffset=0; end
|
|
|
|
iterations=25;
|
|
offTime=20;
|
|
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
|
|
if phases(1,1)==90
|
|
coordsPref(1)=coordsPref(1)-2;
|
|
end
|
|
|
|
%=PAIR OF STIMULI: SPATIAL ATTENTION TO PREFERRED==================================
|
|
|
|
%DEFINE STIMULI AND ATTENTIONAL STATES
|
|
I=zeros(35,35); I(16,14:18)=1; Ipref=I; coordsPref=[16,16];
|
|
I=zeros(35,35); I(17:21,19)=1; Ipoor=I; coordsPoor=[19,19];
|
|
Ipair=Ipref+Ipoor;
|
|
nodePref=9;
|
|
nodePoor=13;
|
|
clear I;
|
|
|
|
nTrials=4;
|
|
%pref attend away
|
|
Amasks{1}=[]; Acoords{1}=[]; I{1}=Ipref;
|
|
%poor attend away
|
|
Amasks{2}=[]; Acoords{2}=[]; I{2}=Ipoor;
|
|
%pair attend away
|
|
Amasks{3}=[]; Acoords{3}=[]; I{3}=Ipair;
|
|
%pair attend pref
|
|
Amasks{4}=1; Acoords{4}=coordsPref; I{4}=Ipair;
|
|
|
|
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
|
|
ymax=max(cat(3,y{1:v1Masks}),[],3);
|
|
maxsubplot(4,nTrials,trial), plot_cropped_image(X{trial}{1}(:,:,1)-X{trial}{2}(:,:,1));
|
|
maxsubplot(4,nTrials,trial+nTrials), plot_cropped_image(y{nodePref},0,[0,0.25]);
|
|
maxsubplot(4,nTrials,trial+2*nTrials), plot_cropped_image(y{nodePoor},0,[0,0.25]);
|
|
maxsubplot(4,nTrials,trial+3*nTrials), plot_cropped_image(ymax,0,[0,0.25]);
|
|
end
|
|
|
|
resp(trial,:)=cat(2,ytrace{nodePref}(coordsPref(1),coordsPref(2),:));
|
|
end
|
|
|
|
%PLOT RESULTS
|
|
resp=[zeros(nTrials,1),resp];
|
|
figoffset=figoffset+1; figure(figoffset), clf
|
|
%plot(resp','LineWidth',4);
|
|
plot([0:iterations],resp(1,:),'b--','LineWidth',2);hold on;
|
|
plot([0:iterations],resp(2,:),'b-.','LineWidth',2);hold on;
|
|
plot([0:iterations],resp(3,:),'b-','LineWidth',2);hold on;
|
|
plot([0:iterations],resp(4,:),'r-','LineWidth',6);hold on;
|
|
ax=axis;
|
|
axis([0,iterations,0,ax(4)]);
|
|
set(gca,'FontSize',18);
|
|
ylabel('Response')
|
|
xlabel('Time')
|
|
set(gca,'YTick',[],'XTick',[]);
|
|
drawnow;
|
|
set(gcf,'PaperPosition',[0,0,9,12])
|
|
if plotIntermediate
|
|
legend(['pref attend away';'poor attend away';'pair attend away';'pair attend pref'],'Location','NorthWest')
|
|
else
|
|
print -depsc2 attn_spatial_pair_dim.eps
|
|
end
|