-
Notifications
You must be signed in to change notification settings - Fork 4
/
runCrowdingPelliVsSloan.m
170 lines (165 loc) · 5.12 KB
/
runCrowdingPelliVsSloan.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
% MATLAB script to run CriticalSpacing.m
% Copyright 2019, Denis G. Pelli, [email protected]
%% DEFINE CONDITIONS
clear o
% o.printSizeAndSpacing=true;
% o.useFractionOfScreenToDebug=0.3;
% o.skipScreenCalibration=true; % Skip calibration to save time.
o.experiment='CrowdingPelliVsSloan';
o.experimenter='';
o.observer='';
o.viewingDistanceCm=100;
o.useSpeech=false;
o.setNearPointEccentricityTo='fixation';
o.nearPointXYInUnitSquare=[0.5 0.5]; % location on screen. [0 0] lower left, [1 1] upper right.
o.durationSec=0.2; % duration of display of target and flankers
o.getAlphabetFromDisk=true;
o.trialsDesired=40;
ooo={};
if 0
o.conditionName='reading';
o.task='read';
o.thresholdParameter='spacing';
o.targetFont='Monaco';
o.targetDeg=nan;
o.getAlphabetFromDisk=false;
o.trialsDesired=2;
o.minimumTargetPix=8;
o.eccentricityXYDeg=[0 0];
% The reading test fills a 15" MacBook Pro screen with 1 deg letters at
% 50 cm. Larger letters require proportionally smaller viewing
% distance.
o.viewingDistanceCm=25;
o.readSpacingDeg=2;
o.alphabet='abc';
o.borderLetter='x';
o.flankingDirection='horizontal';
o.experimenter='...';
o.observer='...';
o.useFixation=false;
% o.useFractionOfScreenToDebug=0.3;
ooo{end+1}=o;
end
if 1
for ecc=[ 2.5 5 10]
o.conditionName='crowding';
o.targetDeg=2;
o.spacingDeg=2;
o.thresholdParameter='spacing';
o.eccentricityXYDeg=[ecc 0]; % Distance of target from fixation. Positive up and to right.
o.targetFont='Sloan';
o.alphabet='DHKNORSVZ'; % Sloan alphabet, excluding C
o.borderLetter='X';
o.minimumTargetPix=8;
o.fixationThicknessDeg=0.03;
o.fixationMarkDeg=1; % 0, 3, and inf are typical values.
o.isFixationBlankedNearTarget=false;
o.flankingDirection='radial';
o.viewingDistanceCm=50;
o2=o; % Copy the condition
o2.eccentricityXYDeg=-o.eccentricityXYDeg;
ooo{end+1}=[o o2];
o.targetFont='Pelli';
o.alphabet='123456789';
o.borderLetter='$';
o.minimumTargetPix=4;
o2.targetFont='Pelli';
o2.alphabet='123456789';
o2.borderLetter='$';
o2.minimumTargetPix=4;
ooo{end+1}=[o o2];
end
end
if 0
for ecc=[0 5]
o.conditionName='acuity';
o.targetDeg=4;
o.thresholdParameter='size';
o.eccentricityXYDeg=[ecc 0]; % Distance of target from fixation. Positive up and to right.
o.targetFont='Sloan';
o.alphabet='DHKNORSVZ'; % Sloan alphabet, excluding C
o.borderLetter='X';
if ecc>0
o.fixationThicknessDeg=0.03;
o.fixationMarkDeg=1; % 0, 3, and inf are typical values.
o.isFixationBlankedNearTarget=false;
o.flankingDirection='radial';
o.viewingDistanceCm=100;
else
o.fixationThicknessDeg=0.02;
o.fixationMarkDeg=inf; % 0, 3, and inf are typical values.
o.isFixationBlankedNearTarget=true;
o.flankingDirection='horizontal';
o.viewingDistanceCm=100;
end
o2=o; % Copy the condition
o2.eccentricityXYDeg=-o.eccentricityXYDeg;
ooo{end+1}=[o o2];
end
end
if 1
for ecc=[0 ]
o.conditionName='crowding';
o.targetDeg=2;
o.spacingDeg=2;
o.thresholdParameter='spacing';
o.eccentricityXYDeg=[ecc 0]; % Distance of target from fixation. Positive up and to right.
o.targetFont='Pelli';
o.alphabet='123456789';
o.borderLetter='$';
o.minimumTargetPix=4;
o.fixationThicknessDeg=0.02;
o.fixationMarkDeg=40; % 0, 3, and inf are typical values.
o.isFixationBlankedNearTarget=true;
o.flankingDirection='horizontal';
o.viewingDistanceCm=250;
o2=o; % Copy the condition
o2.eccentricityXYDeg=-o.eccentricityXYDeg;
ooo{end+1}=[o o2];
end
end
if rand>0.5
% ooo=fliplr(ooo);
end
%% Number the blocks.
for i=1:length(ooo)
for oi=1:length(ooo{i})
ooo{i}(oi).block=i;
ooo{i}(oi).blocksDesired=length(ooo);
end
end
% ooo=Shuffle(ooo);
%% Print as a table. One row per threshold.
for i=1:length(ooo)
if i==1
oo=ooo{1};
else
try
oo=[oo ooo{i}];
catch e
fprintf('Success with %d conditions in %d blocks, but failed on next block.\n',...
length(oo),max([oo.block]));
throw(e)
end
end
end
t=struct2table(oo,'AsArray',true);
% Print the conditions in the Command Window.
disp(t(:,{'block' 'experiment' 'conditionName' 'targetFont' 'observer' ...
'targetDeg' 'eccentricityXYDeg' 'viewingDistanceCm'}));
% return
%% Run.
for i=1:length(ooo)
if isempty(ooo{i}(1).experimenter) && i>1
[ooo{i}.experimenter]=deal(ooo{i-1}(1).experimenter);
end
if isempty(ooo{i}(1).observer) && i>1
[ooo{i}.observer]=deal(ooo{i-1}(1).observer);
end
[ooo{i}.isFirstBlock]=deal(i==1);
[ooo{i}.isLastBlock]=deal(i==length(ooo));
ooo{i}=CriticalSpacing(ooo{i});
if any([ooo{i}.quitExperiment])
break
end
end