-
Notifications
You must be signed in to change notification settings - Fork 4
/
runComplexity.m
215 lines (207 loc) · 6.44 KB
/
runComplexity.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
% runComplexity.m
% MATLAB script to run CriticalSpacing.m
% Copyright 2018 Denis G. Pelli, [email protected]
%
% I estimate that runComplexity will take ?? minutes to complete. It
% measures ?? thresholds. It tests two locations: (-5,0) deg and (+5,0)
% deg. At each location it measure acuity for many alphabets.
%
% The script specifies "Darshan" as experimenter. You can change that in
% the script below if necessary. On the first block the program will ask
% the observer's name. On subsequent blocks it will remember the observer's
% name.
%
% PLEASE USE BINOCULAR VIEWING, USING BOTH EYES ALL THE TIMES.
%
% The script specifies a viewing distance of 40 cm. PLEASE USE A METER
% STICK OR TAPE MEASURE TO MEASURE THE VIEWING DISTANCE AND ENSURE THAT THE
% OBSERVER'S EYE IS ACTUALLY AT THE DISTANCE THAT THE PROGRAM THINKS IT IS.
% PLEASE ENCOURAGE THE OBSERVER TO MAINTAIN THE SAME VIEWING DISTANCE FOR
% THE WHOLE EXPERIMENT.
%
% [email protected] November 20, 2018
% 646-258-7524
% Crowding distance at ±10 deg ecc x 2 orientation.
% Acuity at ±10 deg ecc.
clear o oo ooo
ooo={};
o.experiment='Complexity';
o.showCounter=false;
% o.useFractionOfScreenToDebug=0.3;%% USE ONLY FOR DEBUGGING
% o.skipScreenCalibration=true; %% USE ONLY FOR DEBUGGING
% acuity
o.conditionName='acuity';
o.thresholdParameter='size';
o.flankingDirection='radial'; % Ignored
o.minimumTargetPix=8;
o.recordGaze=false;
o.useSpeech=false;
o.speakViewingDistance=true;
if 1
if 1
% Sloan
o.targetFont='Sloan';
o.minimumTargetPix=8;
o.alphabet='DHKNORSVZ'; % Sloan alphabet, excluding C
o.borderLetter='X';
o.labelAnswers=false;
o.getAlphabetFromDisk=true;
ooo{end+1}=o;
end
if 1
% Checkers alphabet
o.targetFont='Checkers';
o.minimumTargetPix=16;
o.alphabet='abcdefghijklmnopqrstuvwxyz';
o.borderLetter='';
o.labelAnswers=true;
o.getAlphabetFromDisk=true;
ooo{end+1}=o;
end
if 1
% Sans Forgetica
o.targetFont='Sans Forgetica';
o.minimumTargetPix=8;
o.alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
o.borderLetter='$';
o.labelAnswers=false;
o.getAlphabetFromDisk=true;
ooo{end+1}=o;
end
if 1
% Kuenstler
o.targetFont='Kuenstler Script LT Medium';
o.minimumTargetPix=12;
o.alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
o.borderLetter='$';
o.labelAnswers=true;
o.getAlphabetFromDisk=true;
ooo{end+1}=o;
end
if 1
% Black Sabbath
o.targetFont='SabbathBlackRegular';
o.minimumTargetPix=10;
o.alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
o.borderLetter='$';
o.labelAnswers=true;
o.getAlphabetFromDisk=true;
ooo{end+1}=o;
end
if 1
% Chinese from Qihan
o.targetFont='Songti TC Regular';
o.minimumTargetPix=16;
o.alphabet=[20687 30524 38590 33310 28982 23627 29245 27169 32032 21338 26222 ...
31661 28246 36891 24808 38065 22251 23500 39119 40517];
o.alphabet=char(o.alphabet);
o.borderLetter='';
o.labelAnswers=true;
o.getAlphabetFromDisk=true;
ooo{end+1}=o;
end
if 1
% Japanese: Katakan, Hiragani, and Kanji
% from Ayaka
o.targetFont='Hiragino Mincho ProN W3';
japaneseScript='Kanji';
switch japaneseScript
case 'Katakana'
o.alphabet=[12450 12452 12454 12456 12458 12459 12461 12463 12465 12467 12469 ... % Katakana from Ayaka
12471 12473 12475 12477 12479 12481 12484 12486 12488 12490 12491 ... % Katakana from Ayaka
12492 12493 12494 12495 12498 12501 12408 12507 12510 12511 12512 ... % Katakana from Ayaka
12513 12514 12516 12518 12520 12521 12522 12523 12524 12525 12527 ... % Katakana from Ayaka
12530 12531]; % Katakana from Ayaka
o.minimumTargetPix=16;
case 'Hiragana'
o.alphabet=[12354 12362 12363 12365 12379 12383 12394 12395 12396 12397 12399 ... % Hiragana from Ayako
12405 12411 12414 12415 12416 12417 12420 12422 12434]; % Hiragana from Ayako
o.minimumTargetPix=16;
case 'Kanji'
o.alphabet=[25010 35009 33016 23041 22654 24149 36605 32302 21213 21127 35069 ... % Kanji from Ayaka
37806 32190 26286 37707 38525 34276 38360 38627 28187]; % Kanji from Ayaka
o.minimumTargetPix=16;
end
o.alphabet=char(o.alphabet);
o.borderLetter='';
o.labelAnswers=true;
o.getAlphabetFromDisk=true;
ooo{end+1}=o;
end
end
if 1
% crowding
o.conditionName='crowdingDistance';
o.thresholdParameter='spacing';
o.targetFont='Sloan';
o.minimumTargetPix=8;
o.alphabet='DHKNORSVZ'; % Sloan alphabet, excluding C
o.borderLetter='X';
o.labelAnswers=false;
o.getAlphabetFromDisk=true;
for radial=0:1
if radial
o.flankingDirection='radial';
else
o.flankingDirection='tangential';
end
ooo{end+1}=o;
end
end
% Randomly interleave testing left and right.
for block=1:length(ooo)
o=ooo{block};
o.block=block;
o.setNearPointEccentricityTo='fixation';
% o.nearPointXYInUnitSquare=[0.5 0.5];
o.viewingDistanceCm=40;
o.eccentricityXYDeg=[-10 0];
oo=o;
o.eccentricityXYDeg=[10 0];
oo(2)=o;
ooo{block}=oo;
end
% Print as a table. One row per threshold.
oo=[];
for block=1:length(ooo)
if isempty(oo)
oo=ooo{block};
else
oo(end+1:end+2)=ooo{block};
end
end
t=struct2table(oo);
disp(t); % Print the conditions in the Command Window.
% return
for block=1:length(ooo)
oo=ooo{block};
for oi=1:length(oo)
oo(oi).isFirstBlock= block==1;
oo(oi).isLastBlock= block==length(ooo);
oo(oi).block=block;
oo(oi).blocksDesired=length(ooo);
if block==1
oo(oi).observer='';
else
oo(oi).experimenter=old.experimenter;
oo(oi).observer=old.observer;
oo(oi).viewingDistanceCm=old.viewingDistanceCm;
end
oo(oi).isFixationBlankedNearTarget=false;
oo(oi).fixationThicknessDeg=0.1;
oo(oi).fixationMarkDeg=1; % 0, 3, and inf are typical values.
oo(oi).trialsDesired=50;
oo(oi).practicePresentations=0;
oo(oi).durationSec=0.2; % duration of display of target and flankers
oo(oi).repeatedTargets=0;
end
oo=CriticalSpacing(oo);
ooo{block}=oo;
if ~any([oo.quitBlock])
fprintf('Finished block %d.\n',block);
end
if any([oo.quitExperiment])
break
end
old=oo(1); % Allow reuse of settings.
end