forked from racheldenison/temporal-attention
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rd_plotTemporalAttentionMultiSOARTs.m
50 lines (43 loc) · 1.24 KB
/
rd_plotTemporalAttentionMultiSOARTs.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% rd_plotTemporalAttentionMultiSOARTs.m
%% setup
% dataDir = '/Users/rachel/Documents/NYU/Projects/Temporal_Attention/Code/Expt_Scripts/Behav/data';
dataDir = '/Local/Users/denison/Google Drive/NYU/Projects/Temporal_Attention/Code/Expt_Scripts/Behav/data';
subjects = {'rd','hl','ho','vp','jp'};
nSubjects = numel(subjects);
nSOA = 10;
%% take a bootstrap from trial data aggregated across subjects
allRT = [];
for iS = 1:nSubjects
rt = [];
for iSOA = 1:nSOA
fileName = sprintf('%s/E2_SOA_cbD6_%s_run98_alldata', dataDir, subjects{iS});
load(fileName)
expt = E{iSOA};
rt(:,iSOA) = expt.trials(:,strcmp(expt.trials_headers,'rt'));
end
allRT{iS} = rt(:);
end
%% how many trials longer than a certain threshold?
threshs = [1 2];
for iS = 1:nSubjects
for iTh = 1:numel(threshs)
pLong(iTh,iS) = nnz(allRT{iS}>threshs(iTh))/numel(allRT{iS});
end
end
%% plot
% RT histograms
figure
hold on
for iS = 1:nSubjects
histogram(allRT{iS},'Normalization','pdf','DisplayStyle','stairs')
end
xlabel('RT (s)')
ylabel('pdf')
legend(subjects)
% percent RT above a certain thresh
figure
bar(pLong*100)
set(gca,'XTickLabel',threshs)
xlabel('RT threshold (s)')
ylabel('% > threshold')
legend(subjects)