-
Notifications
You must be signed in to change notification settings - Fork 1
/
estimated_obsacc.asv
60 lines (47 loc) · 1.83 KB
/
estimated_obsacc.asv
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
function trials = estimated_obsacc(Sc, trials,cfg)
% This function asks the subejct to rate the estimated accuracy of
% different advisors by inputing through keyboard
Screen('TextSize', Sc.window, 13);
help_string = '';
resp=[];
for o = 1:cfg.nobs
valid = false;
% load observer picture
obs_data = imread([stims_path '/observer' num2str(cfg.observer.pic(o)) '.jpg']);
% make texture image out of image matrix 'observer data'
obs_tex = Screen('MakeTexture', Sc.window, obs_data);
% draw observer picture
Screen('DrawTexture', Sc.window, obs_tex, [], CenterRectOnPoint([0 0 258 325],Sc.center(1),Sc.center(2)));
% Draw instructions
DrawFormattedText(Sc.window,cfg.instr.estimated_obsacc{1},'center', 50)
DrawFormattedText(Sc.window,cfg.instr.estimated_obsacc{2},'center', 75)
DrawFormattedText(Sc.window,cfg.instr.estimated_obsacc{3},'center', 100)
DrawFormattedText(Sc.window,cfg.instr.estimated_obsacc{4},'center', 125)
% flip screen
ft = Screen('Flip',Sc.window);
% avoid button press overlaps
WaitSecs(2);
% wait for button press
collect_response(cfg,inf);
while ~valid % continue prompting until valid value has entered
% ask for estimated accuracy
reply=Ask(Sc.window,[help_string cfg.instr.estimated_obsacc{5}],[],[.5 .5 .5],'GetChar','center','center',13);
try
resp(o) = str2num(reply);
valid = true;
help_string = '';
catch
valid = false;
help_string = 'Invalid character! ';
end
% check value is within range
if resp(o)>0 & resp(o)<100,
valid = true;
help_string = '';
else
valid = false;
help_string = 'Value out of range! ';
end
end
end
return