-
Notifications
You must be signed in to change notification settings - Fork 2
/
tde_writeStimInfo.m
108 lines (95 loc) · 2.79 KB
/
tde_writeStimInfo.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
function tde_writeStimInfo(addComputedContrast)
% Writes out a tsv file with stimulus properties per experimental condition
% 2020 Iris Groen
if ~exist('addComputedContrast', 'var') || isempty(addComputedContrast)
addComputedContrast = 0;
end
stimInfo_fname = fullfile(tdeRootPath, 'stiminfo.tsv');
name = {'CRF-1', ...
'CRF-2', ...
'CRF-3', ...
'CRF-4', ...
'CRF-5', ...
'ONEPULSE-1', ...
'ONEPULSE-2', ...
'ONEPULSE-3', ...
'ONEPULSE-4', ...
'ONEPULSE-5', ...
'ONEPULSE-6', ...
'TWOPULSE-1', ...
'TWOPULSE-2', ...
'TWOPULSE-3', ...
'TWOPULSE-4', ...
'TWOPULSE-5', ...
'TWOPULSE-6'}';
condition = [1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3]';
duration = [0.5, ...
0.5, ...
0.5, ...
0.5, ...
0.5, ...
0.017, ...
0.033, ...
0.067, ...
0.133, ...
0.267, ...
0.533, ...
0.133, ...
0.133, ...
0.133, ...
0.133, ...
0.133, ...
0.133]';
ISI = [0, ...
0, ...
0, ...
0, ...
0, ...
0, ...
0, ...
0, ...
0, ...
0, ...
0, ...
0.017, ...
0.033, ...
0.067, ...
0.133, ...
0.267, ...
0.533]';
contrast = [0.0625, ...
0.125, ...
0.25, ...
0.5, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1, ...
1]';
T = table(name, condition, duration, ISI, contrast);
if addComputedContrast
stimData1 = fullfile(bidsRootPath, 'stimuli', 'sub-p10_ses-nyuecog01_task-spatialpattern_run-01.mat');
stimData2 = fullfile(bidsRootPath, 'stimuli', 'sub-p10_ses-nyuecog01_task-temporalpattern_run-01.mat');
ims = [stimData1.stimulus.im_cell stimData2.stimulus.im_cell];
imNames = [stimData1.stimulus.categories stimData2.stimulus.categories];
contrast_rms = contrast;
contrast_peak2peak = contrast;
for ii = 1:length(name)
im_inx = contains(imNames, name{ii});
contrast_rms(ii) = rms(double(ims{im_inx}(:))/255-0.5);
contrast_peak2peak(ii) = peak2peak(double(ims{im_inx}(:))/255-0.5);
end
contrast_rms = round(contrast_rms,3);
contrast_peak2peak = round(contrast_peak2peak,3);
T = addvars(T, contrast_rms, contrast_peak2peak);
end
writetable(T, stimInfo_fname, 'Delimiter','\t', 'FileType', 'text');
end