-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadSettings.m
133 lines (77 loc) · 2.97 KB
/
loadSettings.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
function Settings = loadSettings(Settings)
%function to set all the settings which are univeral to all trials including training
%some settings depend on whether we are on the experimental machine or not, and whether we want to
%skip the training
Settings.ExperimentalMachine = 1;
Settings.RunTraining = true;
%% Timing settings
% Set the number of trials in the block, and number of blocks
% Note: noTrials must be a multiple of the number of conditions (2)
Settings.NumBlocks = 16;
Settings.BlockTrials = 40;
%set the number of frames per second
Settings.Timing.Fps = 20;
%set the number of frames of the fixation cross
Settings.Timing.FramesISI = 10;
% Number of frames for the deadline condition.
Settings.Timing.FramesMin = 4;
Settings.Timing.FramesMax = 80;
% Set the about of time participants have to respond in the deadline condition
Settings.ForcedResposeWindow = 1; % measured in seconds
%% Psychtoolbox settings
if Settings.ExperimentalMachine == 1
windowPtr = 0;
else
windowPtr = 2;
end
[Settings.Win, Settings.WinArea] = Screen('OpenWindow', windowPtr);
%test that the refresh rate is as expected
Settings.RefreshRate = Screen('NominalFrameRate', Settings.Win);
if Settings.ExperimentalMachine == 1
if Settings.RefreshRate ~= 60 || ~isequal(Settings.WinArea, [0 0 1600 1200])
disp('Error: Unexpected refresh rate or screen size.')
sca
return
end
else
if Settings.RefreshRate ~=60
disp('Error: Unexpected refresh rate.')
sca
return
end
end
% Set the colours to use
Settings.Colour.Background = [80 80 80];
Settings.Colour.Dots = [200 200 200];
Settings.Colour.Arc = [100 100 100];
%fill screen with background colour
Screen('FillRect', Settings.Win, Settings.Colour.Background);
%Set standard text sizes
Settings.Text.Size1 = 20;
Settings.Text.Size2 = 30;
Screen('TextSize', Settings.Win, Settings.Text.Size1);
%set text font
Screen('TextFont', Settings.Win, 'Helvetica');
%% Dot settings
% Set the reference number of dots (half way between the high and low mean)
% and the SD of this value accross trials
Settings.Dots.RefMean = 1000;
Settings.Dots.RefSd = 100;
Settings.Dots.RefMax = 1500;
Settings.Dots.RefMin = 500;
Settings.Dots.Diff = 90;
%set the standard deviation of fluctuations around the mean number of dots displayed
Settings.Dots.SdDots = 220;
% Find the location of dots that form two circular dot clouds
[Settings.Dots.Locations1, dotSize1] = dotCenterLocations(...
[Settings.WinArea(3)*(5/12), Settings.WinArea(4)/2], 0.2, 32, 1, Settings.WinArea);
[Settings.Dots.Locations2, dotSize2] = dotCenterLocations(...
[Settings.WinArea(3)*(7/12), Settings.WinArea(4)/2], 0.2, 32, 1, Settings.WinArea);
% Defensive programming
if (dotSize1 ~= dotSize2) || ...
(length(Settings.Dots.Locations1) ~= length(Settings.Dots.Locations2))
error('Bug')
else
Settings.Dots.Size = dotSize1;
Settings.Dots.Max = length(Settings.Dots.Locations1);
end