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.
GazeSimulation/expts_head_eye_coordination.m

105 lines
4.8 KiB
Matlab

function expts_head_eye_coordination
%Perform experiments on coordinated head and eye movements
%define network for performing head and eye movements
[W,V,interconnects]=define_network(3);
figoff=100;
fast=0; %fast does one experiment per condition using the average of the parameters used in the biological experiments, otherwise does multiple experiments with parameters varying over the possible range of values used in the biological experiments.
numTrials=100;
%Freedman and Sparks 1997 did many experiments with a vertical component to the gaze, these are not simulated. They generated eye movements by getting the subjects (Macaca mulatta monkeys) to fixate a target at a random position on the screen, and then placing a new target for a saccade at another random location on the screen. However, all targets were within +/-45 degrees of the world mid-line. Hence, to cause a gaze change with amplitude +60 degrees, the initial target would need to be at between -45 and +45-60(=-15) degrees.
%Simulate results shown in Fig 14 in Freedman and Sparks 1997
contraRange=[-5,5;%Fig 14A
-12,-8;%Fig 14B
-22,-15;%Fig 14C
-35,-25]%Fig 14D
gaze=[10:10:80];
for c=1:size(contraRange,1)
clear eyeamp headcontrib headamp
if fast
eyepaninit=mean(contraRange(c,:));
k=0;
for vistarget=gaze
k=k+1;
neckpaninit=mean([-45-eyepaninit,45-vistarget]); %min is about as large as neck movements get, max is restricted so that saccade target (in body-centred coordinates) is <=45 degrees.
[eyeamp(k),headcontrib(k),headamp(k)]=control_head_eye_fixed_body(vistarget,eyepaninit,neckpaninit,W,V,interconnects,[],0);
end
figured(figoff+c),clf,
subplot(3,1,1)
plot(gaze,headamp,'r','LineWidth',3,'Color',[0.9290 0.6940 0.1250]);
ylabel({'head','amplitude'}), axis([0,80,0,60]);
subplot(3,1,2)
plot(gaze,headcontrib,'g','LineWidth',3,'Color',[0.9290 0.6940 0.1250]);
ylabel({'head','contribution'}), axis([0,80,0,60]);
subplot(3,1,3)
plot(gaze,eyeamp,'b','LineWidth',3,'Color',[0.8500 0.3250 0.0980]),
ylabel({'eye','amplitude'}), axis([0,80,0,60])
else
for trial=1:numTrials
disp(['####### trial ',int2str(trial),' ######################################']);
k=0;
for vistarget=gaze
k=k+1;
eyepaninit=rand*abs(diff(contraRange(c,:)))+contraRange(c,1);
range(1)=-45-eyepaninit;
range(2)=45-vistarget;
neckpaninit=rand*(range(2)-range(1))+range(1);
[eyeamp(trial,k),headcontrib(trial,k),headamp(trial,k)]=control_head_eye_fixed_body(vistarget,eyepaninit,neckpaninit,W,V,interconnects,[],0);
end
end
figured(figoff+c),clf,
subplot(3,1,1)
plot_confidence(gaze,headamp,[0.9290 0.6940 0.1250]);
ylabel({'head','amplitude'}), axis([0,80,0,60]);
subplot(3,1,2)
plot_confidence(gaze,headcontrib,[0.9290 0.6940 0.1250],'--');
ylabel({'head','contribution'}), axis([0,80,0,60]);
subplot(3,1,3)
plot_confidence(gaze,eyeamp,[0.8500 0.3250 0.0980]);
ylabel({'eye','amplitude'}), axis([0,80,0,60])
end
xlabel('gaze amplitude'),
set(gcf,'PaperSize',[7 9],'PaperPosition',[0.5 0.5 6.5 8.5],'PaperOrientation','Portrait');
print('-dpdf',['head_eye',int2str(c),'.pdf'])
end
%Simulate results shown in Fig 15 in Freedman and Sparks 1997
clear eyeamp headcontrib headamp
gaze=[70,45,25];
eyeposninit=[-30:10:10];
k=0;
for vistarget=gaze
k=k+1;
j=0;
for eyepaninit=eyeposninit
j=j+1;
neckpaninit=mean([max(-40,-40-eyepaninit),45-vistarget-eyepaninit]); %min and max are calculated so that pre- and post-saccadic targets are <=45 degrees (in body-centred coordinates).
[eyeamp(k,j),headcontrib(k,j),headamp(k,j)]=control_head_eye_fixed_body(vistarget,eyepaninit,neckpaninit,W,V,interconnects,[],0);
end
end
figured(figoff+5),clf,
set(gcf,'DefaultAxesLineStyleOrder',{'-', '--', '-.', ':'},'DefaultAxesColorOrder',[0,0.447,0.741]);
subplot(3,1,1),
plot(eyeposninit,headamp,'LineWidth',3,'Color',[0.9290 0.6940 0.1250]);
ylabel({'head','amplitude'}); axis([-30,10,0,70]);
legend({int2str(gaze')},'Location','NorthEastOutside');legend('boxoff')
subplot(3,1,2)
plot(eyeposninit,headcontrib,'LineWidth',3,'Color',[0.9290 0.6940 0.1250]);
ylabel({'head','contribution'}); axis([-30,10,0,70]);
legend({int2str(gaze')},'Location','NorthEastOutside');legend('boxoff')
subplot(3,1,3)
plot(eyeposninit,eyeamp,'LineWidth',3,'Color',[0.8500 0.3250 0.0980]);
ylabel({'eye','amplitude'}); axis([-30,10,0,70]);
xlabel('initial eye position (degrees)'),
%legend({int2str(gaze')},'Location',[0.55,0.295,0.1,0.04],'Orientation','horizontal');
legend({int2str(gaze')},'Location','NorthEastOutside');legend('boxoff')
set(gcf,'PaperSize',[11 9],'PaperPosition',[0.5 0.5 10.5 8.5],'PaperOrientation','Portrait');
print -dpdf head_eye5.pdf