Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marc Posthuma
Bachelor Stage
Commits
f0434ab2
Commit
f0434ab2
authored
May 11, 2021
by
mposthuma
Browse files
made target response plot working (home version)
parent
7f6dba88
Changes
2
Hide whitespace changes
Inline
Side-by-side
target_response_plot.m
0 → 100644
View file @
f0434ab2
%% Initialize
%Clean everything
cfn
=
pb_clean
(
'cd'
,
'C:\Users\marc_\OneDrive\Documents\Studie\STAGE\MATLAB Code\Data\Recordings\test experiment'
);
%load epoched data
l
=
dir
(
'epoched_data*.mat'
);
for
iL
=
1
:
length
(
l
)
load
(
l
(
iL
)
.
name
);
end
%pa_sac2mat; in command window
%load saccades
l
=
dir
([
'sacdet'
filesep
'sacdet*.mat'
]);
load
([
'sacdet'
filesep
l
(
1
)
.
name
]);
%% Extract data
%pb_vExtractPar.m
%get epoched gaze data traces
azimuth
=
Data
.
epoch
.
AzGazeEpoched
;
elevation
=
Data
.
epoch
.
ElGazeEpoched
;
% Run over saccades
for
iS
=
1
:
length
(
Sac
)
trial_idx
=
Sac
(
iS
,
1
);
%Get timings
start_trial_idx
=
(
trial_idx
-
1
)
*
360
+
1
;
stimOn_idx
=
start_trial_idx
;
sacOn_idx
=
Sac
(
iS
,
3
)
+
start_trial_idx
-
1
;
sacOff_idx
=
Sac
(
iS
,
4
)
+
start_trial_idx
-
1
;
%Super sac
SS
(
iS
,
1
:
4
)
=
Sac
(
iS
,
1
:
4
);
%trial/saccade nr/sacc on sample/sac off sample
SS
(
iS
,
5
)
=
1
/
120
*
1000
*
Sac
(
iS
,
3
);
%saccade of reaction time RT
SS
(
iS
,
6
)
=
1
/
120
*
1000
*
(
Sac
(
iS
,
4
)
-
Sac
(
iS
,
3
));
%duration
SS
(
iS
,
7
)
=
azimuth
(
sacOn_idx
);
%Azimuth onset
SS
(
iS
,
8
)
=
elevation
(
sacOn_idx
);
%Elevation onset
SS
(
iS
,
9
)
=
azimuth
(
sacOff_idx
);
%Azimuth offset
SS
(
iS
,
10
)
=
elevation
(
sacOff_idx
);
%Elevation offset
SS
(
iS
,
11
)
=
SS
(
iS
,
9
)
-
SS
(
iS
,
7
);
%Azimuth Saccade amplitude
SS
(
iS
,
12
)
=
SS
(
iS
,
10
)
-
SS
(
iS
,
8
);
%Elevation Saccade amplitude
SS
(
iS
,
13
)
=
Data
.
stimuli
.
azimuth
(
SS
(
iS
,
1
));
%Target azimuth
SS
(
iS
,
14
)
=
Data
.
stimuli
.
elevation
(
SS
(
iS
,
1
));
%Target elevation
SS
(
iS
,
15
)
=
max
(
abs
(
diff
(
sqrt
(
azimuth
(
sacOn_idx
:
sacOff_idx
)
.^
2
+
elevation
(
sacOn_idx
:
sacOff_idx
)
.^
2
))
*
120
));
%max velocity
SS
(
iS
,
16
)
=
sqrt
(
SS
(
iS
,
11
)
^
2
+
SS
(
iS
,
12
)
^
2
);
%R
end
%%
%criteria
sel_first
=
SS
(:,
2
)
==
1
;
%only first saccade
sel_timing
=
SS
(:,
5
)
>
80
&
SS
(:,
5
)
<
400
;
%between 80-400 ms
sel_SS
=
sel_first
&
sel_timing
;
%combine all
nSS
=
SS
(
sel_SS
,:);
n_sacc
=
sum
(
sel_SS
);
c_title
=
{
'Azimuth'
,
'Elevation'
};
col
=
pb_selectcolor
(
2
,
2
);
cfn
=
pb_newfig
(
cfn
);
for
iS
=
1
:
2
%get data
target
=
nSS
(:,
12
+
iS
);
response
=
nSS
(:,
10
+
iS
);
%graph
subplot
(
1
,
2
,
iS
);
hold
on
;
axis
square
;
title
(
c_title
{
iS
});
h
(
iS
)
=
plot
(
target
,
response
,
'o'
);
hr
(
iS
)
=
pb_regplot
(
target
,
response
,
'data'
,
false
);
xlabel
(
'Target ($^{\circ}$)'
);
ylabel
(
'Response ($^{\circ}$)'
);
xlim
([
-
50
50
]);
ylim
([
-
50
50
]);
pb_dline
;
end
pb_nicegraph
;
%color
for
iH
=
length
(
h
)
h
(
iH
)
.
Color
=
col
(
iH
,:);
hr
(
iH
)
.
Color
=
col
(
iH
,:);
end
%% Main Sequence vs amplitude
cfn
=
pb_newfig
(
cfn
);
sgtitle
(
'Main Sequence'
)
%Peak velocity
velocity
=
SS
(:,
15
);
amplitude
=
abs
(
SS
(:,
16
));
subplot
(
1
,
2
,
1
);
hold
on
;
axis
square
h
(
iS
)
=
plot
(
amplitude
,
velocity
,
'o'
);
xlabel
(
'Amplitude'
);
ylabel
(
'Peak Velocity'
);
xlim
([
0
50
])
ylim
([
0
800
])
%Duration
duration
=
SS
(:,
6
);
amplitude
=
abs
(
SS
(:,
16
));
subplot
(
1
,
2
,
2
);
hold
on
;
axis
square
h
(
iS
)
=
plot
(
amplitude
,
duration
,
'o'
);
xlabel
(
'Amplitude'
);
ylabel
(
'Duration'
);
xlim
([
0
50
])
ylim
([
0
300
])
pb_nicegraph
;
pb_selectcolor
%criteria
%neem tweede saccade mee als 0.5 zo groot van eerste
%binnen 100 ms vallen van de eerste
%gaze shift- van begin naar eindpunt
test_experiment.m
View file @
f0434ab2
...
...
@@ -67,6 +67,11 @@ for iP = 1:2
for
iS
=
1
:
length
(
stim
)
target
=
stim
(
iS
,
iP
)
plot
(
ts_stim
,
stim
(:,
iP
),
'x'
)
legend
(
'gaze'
,
'target'
)
sgtitle
(
'Gaze accuracy to target'
)
xlabel
(
'Time'
);
ylabel
(
'Azimuth/Elevation'
);
end
end
pb_nicegraph
...
...
@@ -121,8 +126,8 @@ for iB = 1:length(Data.timestamps)
% Select stimuli indices
nstim
=
length
(
Data
.
stimuli
(
iB
)
.
azimuth
);
ntriggers
=
length
(
Data
.
timestamps
(
iB
)
.
stimuli
);
ind
=
1
;
ext
=
2
;
ind
=
3
;
ext
=
4
;
for
iS
=
1
:
nstim
% epoch for stimuli
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment