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.2 KiB
Matlab
103 lines
3.2 KiB
Matlab
function [y,s,r]=test_attn_featural_pair(figoffset)
|
|
if nargin<1 || isempty(figoffset), figoffset=0; end
|
|
|
|
iterations=25;
|
|
offTime=20;
|
|
plotIntermediate=0;
|
|
|
|
%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=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));
|
|
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
|
|
if phases(1,1)==90
|
|
coordsPref(1)=coordsPref(1)-2;
|
|
end
|
|
|
|
%=PAIR OF STIMULI: FEATURAL 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;
|
|
attnCoords=[18,18];
|
|
clear I;
|
|
|
|
nTrials=4;
|
|
%pref attend pref
|
|
Amasks{1}=rem(nodePref-1,8)+1; Acoords{1}=attnCoords; I{1}=Ipref;
|
|
%poor attend poor
|
|
Amasks{2}=rem(nodePoor-1,8)+1; Acoords{2}=attnCoords;I{2}=Ipoor;
|
|
%pair attend pref
|
|
Amasks{3}=rem(nodePref-1,8)+1; Acoords{3}=attnCoords; I{3}=Ipair;
|
|
%pair attend poor
|
|
Amasks{4}=rem(nodePoor-1,8)+1; Acoords{4}=attnCoords; 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,:),'r--','LineWidth',5);hold on;
|
|
plot([0:iterations],resp(2,:),'--','Color',[0,0.7,0],'LineWidth',3);hold on;
|
|
plot([0:iterations],resp(3,:),'r-','LineWidth',5);hold on;
|
|
plot([0:iterations],resp(4,:),'-','Color',[0,0.7,0],'LineWidth',3);hold on;
|
|
ax=axis;
|
|
axis([0,iterations,0,0.9*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 pref';'poor attend poor';'pair attend pref';'pair attend poor'],'Location','NorthWest')
|
|
else
|
|
print -depsc2 attn_featural_pair_dim.eps
|
|
end |