-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunCFSRecall.m
173 lines (146 loc) · 7.35 KB
/
runCFSRecall.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
function [data, tInfo, expParams, input, sa] =...
runCFSRecall( input, constants, window, responseHandler, mondrians, domEye, sa )
expt = 'CFSRecall';
expParams = setupExpParams(120, input.debugLevel, expt);
tInfo = setupTInfo(expParams, input.debugLevel, expt);
sa = setupSAParams(expParams, expt, sa);
data = setupDataTable(expParams, input, expt, domEye);
keys = setupKeys(expt);
% responseHandler = makeInputHandlerFcn(input.responder);
noiseRect = ScaleRect(window.imagePlace, 2, 2);
res = repelem(noiseRect(3) - noiseRect(1),2);
noisetex = CreateProceduralNoise(window.pointer, res(1), res(2), 'Perlin', [0.5 0.5 0.5 1]);
%% main experimental loop
for list = 1:expParams.nLists
if list == 1
giveInstruction(window, keys, responseHandler, constants, expt, expParams);
else
showPromptAndWaitForResp(window, ['You are beginning list ', num2str(list), ' out of ', num2str(expParams.nLists), ' lists'],...
keys, constants, responseHandler);
showPromptAndWaitForResp(window, 'Remember to keep your eyes focused on the center cross',...
keys, constants, responseHandler);
end
%% go through study phase of this list
for rep = 1:expParams.nStudyReps
for item = 1:expParams.nTrialsPerList
trial = item + (expParams.nTrialsPerList*(list-1));
[data.transparency{trial}(rep), sa] =...
wrapper_SA(data, trial, sa, expParams);
[data.RoboRT{trial}(rep), data.meanRoboRT{trial}(rep)] = ...
setupRobotResponses(data.transparency{trial}(rep),...
sa, data.tType{trial});
% make texture for this trial (function is setup to hopefully handle
% creation of many textures if graphics card could handle that
stims = makeTexs(data.item(trial), window, 'STUDY');
switch data.tType{trial}
case 'BINOCULAR'
showPromptAndWaitForResp(window, 'Please study the details of the following object',...
keys, constants, responseHandler);
keys_response = keys.escape;
nTicks = expParams.nTicks_bino;
case {'CFS', 'NOT STUDIED'}
showPromptAndWaitForResp(window, 'Press ''j'' if you see an object, or ''f'' if you think none will appear',...
keys, constants, responseHandler);
keys_response = keys.bCFS+keys.escape;
nTicks = expParams.nTicks;
end
% function that presents stim and collects response
[data.response(trial,rep), data.rt{trial}(rep),...
data.tStart{trial}(rep), data.tEnd{trial}(rep),...
~, ~,...
data.exitFlag(trial,rep)] = ...
elicitBCFS(window, responseHandler,...
stims.tex, data.eyes{trial},...
keys_response, mondrians, expParams,...
constants, data.RoboRT{trial}(rep),...
data.transparency{trial}(rep), data.jitter{trial}(rep), data.roboBCFS{trial,rep}, ...
expt, domEye, nTicks);
Screen('Close', stims.tex);
% handle exitFlag, based on responses given
[data.pas(trial,rep), sa, esc] = wrapper_bCFS_exitFlag(data.exitFlag{trial,rep}, data.tType{trial}, data.rt{trial}(rep),...
data.response{trial,rep}, sa, window, keys, constants, responseHandler);
if esc
return;
end
% inter-trial-interval
iti(window, expParams.iti);
end
end
%% Instruction for test
if list == 1
giveInstruction(window, keys, responseHandler, constants, 'TEST', expParams);
else
showPromptAndWaitForResp(window, ['This is the test phase for list ', num2str(list), ' out of ', num2str(expParams.nLists), ' lists'],...
keys, constants, responseHandler);
showPromptAndWaitForResp(window, 'Remember to keep your eyes focused on the center cross',...
keys, constants, responseHandler);
end
%% go through test phase of this list
for item = 1:expParams.nTrialsPerList
trial = item + (expParams.nTrialsPerList*(list-1));
stims = makeTexs(data.item_test(trial), window, 'NAME',data.pair_test(trial));
keys_response = keys.enter+keys.escape+keys.name+keys.bkspace+keys.space;
[data.response_cue(trial), data.rt_cue(trial),...
data.tStart_cue(trial), data.tEnd_cue(trial),...
data.exitFlag_cue(trial)] = elicitCueName(window, ...
responseHandler, stims.tex,...
keys_response, constants, '\ENTER');
Screen('Close', stims.tex);
showPromptAndWaitForResp(window, 'Press ''p'' for match, or ''q'' for mismatch',...
keys, constants, responseHandler);
if strcmp(data.swap_test(trial), 'match')
stims = makeTexs(data.item_test(trial), window, 'NOISE',data.pair_test(trial));
else
stims = makeTexs(data.pair_test(trial), window, 'NOISE',data.item_test(trial));
end
keys_response = keys.mmm+keys.escape;
iti(window, expParams.iti);
[data.response_noise(trial), data.rt_noise(trial),...
data.tStart_noise(trial), data.tEnd_noise(trial),...
~, ~,...
data.exitFlag_noise(trial)] = elicitNoise(window, ...
responseHandler, stims.tex, keys_response, expParams,...
constants, data.RoboRT_noise{trial}, 1, data.jitter_noise(trial), data.mm_answer{trial}, noisetex);
Screen('Close', stims.tex);
% handle exitFlag, based on responses given
switch data.exitFlag_noise{trial}
case 'ESCAPE'
return;
case 'CAUGHT'
showPromptAndWaitForResp(window, 'Please only respond when an image is present!',...
keys, constants, responseHandler);
case 'OK'
switch data.response_noise{trial}
case 'p'
switch data.swap_test{trial}
case 'match'
prompt = 'Correct! The objects matched';
otherwise
prompt = 'Incorrect! The objects were mismatched';
end
case 'q'
switch data.swap_test{trial}
case 'mismatch'
prompt = 'Correct! The objects were mismatched';
otherwise
prompt = 'Incorrect! The objects matched';
end
otherwise
prompt = '';
end
showPromptAndWaitForResp(window, prompt,...
keys, constants, responseHandler);
end
% inter-trial-interval
iti(window, expParams.iti);
end
end
for eye = 1:2
Screen('SelectStereoDrawBuffer',window.pointer,eye-1);
% prompt participant to respond
DrawFormattedText(window.pointer, ['That is the end of the experiment.\n',...
'Thanks for participating!'], 'ceter', 'center');
end
Screen('Flip', window.pointer);
WaitSecs(2);
end