-
Notifications
You must be signed in to change notification settings - Fork 0
/
final_task_dispChosen.m
123 lines (112 loc) · 4.38 KB
/
final_task_dispChosen.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
function[onset_dispChoice] = final_task_dispChosen(scr, stim, choice,...
R_chosen, E_chosen, E_chosen_repeats, R_or_P, confidence)
% [onset_dispChoice] = choice_task_dispChosen(scr, stim, choice,...
% R_chosen, E_chosen, E_chosen_repeats, R_or_P, confidence)
% choice_task_dispChosen will display the chosen option
%
% INPUTS
% scr: structure with screen parameters
%
% stim: structure with stimuli parameters (reward and effort display
% informations are stored in here)
%
% choice:
% (0) no choice was made
% (-2/-1/1/2) choice left or right has been made
%
% R_chosen: reward amount of the chosen option
%
% E_chosen: effort level of the chosen option
%
% E_chosen_repeats: number of repetitions for the chosen option
%
% R_or_P: character indicating the nature of the current trial
% 'R': reward trial
% 'P': punishment trial
%
% confidence: structure with indication about confidence
% .display: true/false depending on if you want to have a confidence
% display
% .lowOrHigh: 0/1 depending on if low or high confidence for the current
% trial
%
% OUTPUTS
% onset_dispChoice: onset of the display of the chosen option on the screen
%
% See also choice_task_main.m
%% extract relevant parameters
window = scr.window;
white = scr.colours.white;
% remind the option they chose (or that they were too slow to select)
switch choice
case 0
DrawFormattedText(window, stim.noChoiceMadeMsg.text,...
stim.noChoiceMadeMsg.x, stim.noChoiceMadeMsg.y, white);
otherwise
DrawFormattedText(window, stim.chosenOptionMsg.text,...
stim.chosenOptionMsg.x, stim.chosenOptionMsg.y, white);
end
%% display reward and effort level
% switch R_chosen
% case 0 % no option was selected
% DrawFormattedText(window,...
% stim.feedback.error_tooSlow.text,...
% stim.feedback.error_tooSlow.x, stim.feedback.error_tooSlow.y, white);
% otherwise % one option was selected
% if punishment trial, add also indication to know that money is to be lost
switch R_or_P
case 'R'
DrawFormattedText(window,stim.choice.win.text,...
stim.winRewardText.top_center(1),...
stim.winRewardText.top_center(2),...
white);
case 'P'
DrawFormattedText(window,stim.choice.lose.text,...
stim.loseRewardText.top_center(1),...
stim.loseRewardText.top_center(2),...
white);
end
drawRewardAmount(scr, stim, R_chosen, R_or_P, 'top_center_start');
%% display difficulty level
chosenStartAngle = stim.difficulty.startAngle.(['level_',num2str(E_chosen)]);
maxCircleAngle = stim.difficulty.arcEndAngle;
Screen('FillArc', window,...
stim.difficulty.currLevelColor,...
stim.chosenOption.difficulty,...
chosenStartAngle,...
maxCircleAngle - chosenStartAngle);% chosen option difficulty
% display ring for difficulty
Screen('FrameOval', window, stim.difficulty.maxColor,...
stim.chosenOption.difficulty,...
stim.difficulty.ovalWidth);
% display effort text
DrawFormattedText(window, stim.choice.for.text,...
stim.effort_introText.bottom_center(1),...
stim.effort_introText.bottom_center(2),...
white);
% display number of repetitions for the chosen option
x_repeat = stim.chosenOption.difficulty(3);
y_repeat = mean([stim.chosenOption.difficulty(2),stim.chosenOption.difficulty(4)]);
Screen('TextSize', window, scr.textSize.middle);
DrawFormattedText(window,[' x',num2str(E_chosen_repeats)],...
x_repeat,y_repeat,white);
Screen('TextSize', window, scr.textSize.baseline);
% end
%% display a square on top of selected reward and effort
if confidence.display == false ||...
(confidence.display == true && confidence.lowOrHigh == 2)
% square frame around the selected option
Screen('FrameRect', window,...
stim.chosenOption.squareColour,...
stim.chosenOption.squareRect_bis,...
stim.chosenOption.squareWidth);
elseif confidence.display == true && confidence.lowOrHigh == 1
% dotted lines square around the selected option
Screen('DrawLines', window, stim.chosenOption.dottedSquare.xyLines_bis,...
stim.chosenOption.squareWidth,...
stim.chosenOption.squareColour);
end
% note: no square at all if no choice was made
%% display on screen and extract timing
[~,onset_dispChoice] = Screen('Flip',window);
end % function