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_body_head_eye_coordin...

196 lines
8.6 KiB
Matlab

function expts_body_head_eye_coordination
%Perform experiments on coordinated body, head and eye movements
%define network for performing body, head, and eye movements
[W,V,interconnects]=define_network(3);
figoff=100;
%McCluskey and Cullen 2007 generated eye movements in their subjects (Macaca mulatta monkeys) by presenting a sequence of visual targets. The target positions alternated between being to the left or to the right of the mid-line, but were otherwise are at unpredictable locations (we do not simulate the experiments reported at the end of the paper, where the target locations are predictable). All targets were at 20:10:80 degrees from the world mid-line. However, with this set up the minimum gaze shift is 40 degrees (from -20 to +20) but McCluskey and Cullen report results for gaze shifts of 20 and 30 degrees? We must, therefore, assume that they included initial saccades from the central fixation point in their results.
%It is unclear how the conditions for head contra 65 can be met. For head contra 65, it is necessary for torso and eye to be approx 0 and head to be 65 (so initial fixation is at approx +/-65), how then is it possible to measure gaze shifts of between 20 and 60 and still have the new target be on the opposite side of the mid-line?
%For and eye contra 30, it is necessary for torso to be approx 0 and eye to be 30. For a gaze shift of 20 this would have to occur when initial fixation is at zero, and the neck would therefore be at -30, which would be a very awkward position for looking straght ahead!
%Simulate experiment performed in McCluskey and Cullen 2007
gaze=[20:10:160];
measuresAll{length(gaze)}=[];
measuresEye10{length(gaze)}=[];
measuresEye30{length(gaze)}=[];
measuresHead30{length(gaze)}=[];
measuresHead65{length(gaze)}=[];
posnHead15{length(gaze)}=[];
posnHead40{length(gaze)}=[];
posnHead65{length(gaze)}=[];
y=[];
eyeposn=0;
neckposn=0;
torsoposn=0;
for trial=1:100
disp(['####### trial ',int2str(trial),' ######################################']);
%look at central fixation target to start a trial
targetposn=0;
retina=simulate_agent_world_to_retina(targetposn,eyeposn(end),neckposn(end),torsoposn(end));
[eyeamp,headcontrib,headamp,bodycontrib,bodyamp,eyeposn,neckposn,torsoposn,~,y]=...
control_body_head_eye(retina,eyeposn(end),neckposn(end),torsoposn(end),W,V,interconnects,y,0);
%perform sequence of looking at targets on alternating sides
for seq=1:11
for direction=[-1,1]
%disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
%record info about starting conditions
targetposnStart=targetposn;
eyeposnStart=eyeposn(end);
neckposnStart=neckposn(end);
torsoposnStart=torsoposn(end);
%select a new target
targetposn=direction*10.*(1+randi(7));
retina=simulate_agent_world_to_retina(targetposn,eyeposn(end),neckposn(end),torsoposn(end));
[eyeamp,headcontrib,headamp,bodycontrib,bodyamp,eyeposn,neckposn,torsoposn,~,y]=...
control_body_head_eye(retina,eyeposn(end),neckposn(end),torsoposn(end),W,V,interconnects,y,0);
%record info about movement that was made ...
gazeamp=abs(targetposn-targetposnStart);
gazeind=gazeamp/10-1;
% ... for all movements - for Fig 5.
measuresAll{gazeind}=[measuresAll{gazeind};
eyeamp,headcontrib,headamp,bodycontrib,bodyamp];
% ... for a sub-sets of movements - for Fig 8
if abs(torsoposnStart)<=5
if sign(eyeposnStart)~=direction && abs(eyeposnStart)<=12 && abs(eyeposnStart)>=8
measuresEye10{gazeind}=[measuresEye10{gazeind};
eyeamp,headcontrib,headamp,bodycontrib,bodyamp];
end
if sign(eyeposnStart)~=direction && abs(eyeposnStart)<=32 && abs(eyeposnStart)>=28
measuresEye30{gazeind}=[measuresEye30{gazeind};
eyeamp,headcontrib,headamp,bodycontrib,bodyamp];
end
if abs(eyeposnStart)<=10
if sign(neckposnStart)~=direction && abs(neckposnStart)<=35 && abs(neckposnStart)>=25
measuresHead30{gazeind}=[measuresHead30{gazeind};
eyeamp,headcontrib,headamp,bodycontrib,bodyamp];
end
if sign(neckposnStart)~=direction && abs(neckposnStart)<=70 && abs(neckposnStart)>=60
measuresHead65{gazeind}=[measuresHead65{gazeind};
eyeamp,headcontrib,headamp,bodycontrib,bodyamp];
end
end
end
% ... for a sub-sets of movements - for Fig 6A
if abs(eyeposnStart)<=10
if neckposnStart<=-10 && neckposnStart>=-20
posnHead15{gazeind}=[posnHead15{gazeind};neckposn(end)];
end
if neckposnStart<=-35 && neckposnStart>=-45
posnHead40{gazeind}=[posnHead40{gazeind};neckposn(end)];
end
if neckposnStart<=-60 && neckposnStart>=-70
posnHead65{gazeind}=[posnHead65{gazeind};neckposn(end)];
end
end
end
end
end
%Plot results shown in Fig 5 in McCluskey and Cullen 2007
for i=1:length(gaze)
if ~isempty(measuresAll{i})
eyeampAll{i}=measuresAll{i}(:,1);
headcontribAll{i}=measuresAll{i}(:,2);
headampAll{i}=measuresAll{i}(:,3);
bodycontribAll{i}=measuresAll{i}(:,4);
bodyampAll{i}=measuresAll{i}(:,5);
end
end
figured(figoff+3),clf,
subplot(3,1,1)
plot_confidence(gaze,eyeampAll,[0.8500 0.3250 0.0980],'-','mean');
ylabel({'eye','amplitude'}), axis([0,120,0,60])
subplot(3,1,2)
h(1)=plot_confidence(gaze,headampAll,[0.9290 0.6940 0.1250],'-','mean'); hold on;
h(2)=plot_confidence(gaze,headcontribAll,[0.9290 0.6940 0.1250],'--','mean');
ylabel('head'), axis([0,120,0,120]);
legend(h,{'amp.','contrib.'},'Location',[0.445,0.56,0.1,0.05],'Orientation','horizontal');legend('boxoff')
subplot(3,1,3)
h(1)=plot_confidence(gaze,bodyampAll,[0.4940 0.1840 0.5560],'-','mean'); hold on;
h(2)=plot_confidence(gaze,bodycontribAll,[0.4940 0.1840 0.5560],'--','mean');
ylabel('body'), axis([0,120,0,25]);
legend(h,{'amp.','contrib.'},'Location',[0.445,0.26,0.1,0.05],'Orientation','horizontal');legend('boxoff')
xlabel('gaze amplitude'),
set(gcf,'PaperSize',[9 9],'PaperPosition',[0.5 0.5 8.5 8.5],'PaperOrientation','Portrait');
print -dpdf body_head_eye3.pdf
%Plot results shown in Fig 8 in McCluskey and Cullen 2007
eyeampEye10{length(gaze)}=[];
eyeampEye30{length(gaze)}=[];
headampHead30{length(gaze)}=[];
headampHead65{length(gaze)}=[];
bodyampHead30{length(gaze)}=[];
bodyampHead65{length(gaze)}=[];
for i=1:length(gaze)
if ~isempty(measuresEye10{i})
eyeampEye10{i}=measuresEye10{i}(:,1);
end
if ~isempty(measuresEye30{i})
eyeampEye30{i}=measuresEye30{i}(:,1);
end
if ~isempty(measuresHead30{i})
headampHead30{i}=measuresHead30{i}(:,3);
bodyampHead30{i}=measuresHead30{i}(:,5);
end
if ~isempty(measuresHead65{i})
headampHead65{i}=measuresHead65{i}(:,3);
bodyampHead65{i}=measuresHead65{i}(:,5);
end
end
figured(figoff+4),clf,
subplot(3,1,1)
h(1)=plot_confidence(gaze,eyeampEye10,[0.8500 0.3250 0.0980]);
h(2)=plot_confidence(gaze,eyeampEye30,[0.8500 0.3250 0.0980],'--');
ylabel({'eye','amplitude'}), axis([0,120,0,60])
legend(h,{'10';'30'},'Location',[0.615,0.74,0.1,0.05],'Orientation','horizontal');legend('boxoff')
subplot(3,1,2)
h(1)=plot_confidence(gaze,headampHead30,[0.9290 0.6940 0.1250]); hold on;
h(2)=plot_confidence(gaze,headampHead65,[0.9290 0.6940 0.1250],'--');
ylabel({'head','amplitude'}), axis([0,120,0,120]);
legend(h,{'30','65'},'Location',[0.445,0.56,0.1,0.05],'Orientation','horizontal');legend('boxoff')
subplot(3,1,3)
h(1)=plot_confidence(gaze,bodyampHead30,[0.4940 0.1840 0.5560]); hold on;
h(2)=plot_confidence(gaze,bodyampHead65,[0.4940 0.1840 0.5560],'--');
ylabel({'body','amplitude'}), axis([0,120,0,16]);
legend(h,{'30','65'},'Location',[0.445,0.26,0.1,0.05],'Orientation','horizontal');legend('boxoff')
xlabel('gaze amplitude'),
set(gcf,'PaperSize',[9 9],'PaperPosition',[0.5 0.5 8.5 8.5],'PaperOrientation','Portrait');
print -dpdf body_head_eye4.pdf
%Plot results shown in Fig 6A in McCluskey and Cullen 2007
figured(figoff+5),clf,
initialHeadPosn=[-15,-40,-65];
gazeind=[3,7,11]
colours=flipud(get(gca,'ColorOrder'));
k=0;
for i=gazeind
k=k+1;
finalHeadPosn{i}{1}=posnHead15{i};
finalHeadPosn{i}{2}=posnHead40{i};
finalHeadPosn{i}{3}=posnHead65{i};
h(k)=plot_confidence(initialHeadPosn,finalHeadPosn{i},colours(k,:));
text(double(initialHeadPosn(1)),double(mean(finalHeadPosn{i}{1})),[' ',int2str(gaze(i))])
end
%legend(h,{int2str(gaze(gazeind)')});legend('boxoff')
xlabel('initial head position (degrees)'),
ylabel('final head position (degrees)'),
axis([-70,-7,-40,60])
print -dpdf body_head_eye5.pdf