forked from racheldenison/temporal-attention
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rd_runAnalyzeTemporalAttention.m
59 lines (50 loc) · 1.66 KB
/
rd_runAnalyzeTemporalAttention.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
51
52
53
54
55
56
57
58
59
function rd_runAnalyzeTemporalAttention(subject)
if nargin==0
subject = 'rd_cbD10_tilt2_tc16-64_soa1000-1250';
end
run = 8;
subjectID = sprintf('%s_run%02d', subject, run);
saveData = 1;
saveFigs = 1;
plotTimingFigs = 0;
saveTimingFigs = 0;
cleanRT = 1;
expName = 'pilot'; % 'E0_cb', 'E4_contrast_cbD10'
% dataDir = 'data';
% figDir = 'figures';
dataDir = pathToExpt('data');
figDir = pathToExpt('figures');
dataDir = sprintf('%s/%s/%s', dataDir, expName, subject(1:2));
figDir = sprintf('%s/%s/%s', figDir, expName, subject(1:2));
% load data file
dataFile = dir(sprintf('%s/%s_T*.mat', dataDir, subjectID));
if numel(dataFile)~=1
fprintf('\n%s/%s*', dataDir, subjectID)
error('more or fewer than 1 matching data file')
else
load(sprintf('%s/%s', dataDir, dataFile.name))
end
for t1t2 = {'all'} %{'same','diff'} %
[expt results] = rd_analyzeTemporalAttention(expt, 0, 0, 0, 0, t1t2{1}, cleanRT);
% change subjectID for saving if cleaning RT
if cleanRT
subjectID = [subjectID '_RTx'];
end
% save data
% saving data and figs separately in order to save them into the mcq
% directory, and not locally
if saveData
fileName = sprintf('%s/%s_TemporalAttention_T1T2%s_%s.mat', dataDir, subjectID, t1t2{1}, datestr(now, 'yyyymmdd'));
save(fileName, 'expt', 'results')
end
% save figs
if saveFigs
if cleanRT
figNames = {'cleanRTHist','acc','rt'};
else
figNames = {'acc','rt'};
end
rd_saveAllFigs([], figNames, [subjectID '_TemporalAttention_T1T2' t1t2{1}], figDir)
close all % close so as not to interfere with next set of figures
end
end