|
1 | | -function [ExpParameters, Cfg] = setParameters |
| 1 | +function [expParameters, cfg] = setParameters |
2 | 2 |
|
3 | | -ExpParameters = struct; % Initialize the parameters variables |
4 | | -Cfg = struct; % Initialize the general configuration variables |
| 3 | +% Initialize the parameters and general configuration variables |
| 4 | +expParameters = struct; |
| 5 | +cfg = struct; |
5 | 6 |
|
6 | | -ExpParameters.task = 'VisualLoc'; |
| 7 | +expParameters.task = 'VisualLoc'; |
7 | 8 |
|
| 9 | +% by default the data will be stored in an output folder created where the |
| 10 | +% setParamters.m file is |
| 11 | +% change that if you want the data to be saved somewhere else |
| 12 | +expParameters.outputDir = fullfile(... |
| 13 | + fileparts(mfilename('fullpath')), '..', ... |
| 14 | + 'output'); |
8 | 15 |
|
9 | 16 | %% Debug mode settings |
10 | | -Cfg.debug = true; % To test the script out of the scanner, skip PTB sync |
11 | | -Cfg.testingSmallScreen = false; % To test on a part of the screen, change to 1 |
12 | | -Cfg.testingTranspScreen = true; % To test with trasparent full size screen |
13 | | -Cfg.stimPosition = 'PC'; % 'Scanner': means that it removes the lower 1/3 of the screen (the coil hides the lower part of the screen) |
| 17 | +cfg.debug = true; % To test the script out of the scanner, skip PTB sync |
| 18 | +cfg.testingSmallScreen = false; % To test on a part of the screen, change to 1 |
| 19 | +cfg.testingTranspScreen = true; % To test with trasparent full size screen |
| 20 | +cfg.stimPosition = 'pc'; % 'Scanner': means that it removes the lower 1/3 of the screen (the coil hides the lower part of the screen) |
14 | 21 |
|
15 | 22 |
|
16 | 23 | %% MRI settings |
17 | | -Cfg.device = 'PC'; % 'PC': does not care about trigger - otherwise use 'Scanner' |
18 | | -Cfg.triggerKey = 't'; % Set the letter sent by the trigger to sync stimulation and volume acquisition |
19 | | -Cfg.numTriggers = 4; |
20 | | -Cfg.eyeTracker = false; % Set to 'true' if you are testing in MRI and want to record ET data |
| 24 | +cfg.device = 'scanner'; % 'PC': does not care about trigger - otherwise use 'Scanner' |
| 25 | +cfg.triggerKey = 't'; % Set the letter sent by the trigger to sync stimulation and volume acquisition |
| 26 | +cfg.numTriggers = 4; |
| 27 | +cfg.eyeTracker = false; % Set to 'true' if you are testing in MRI and want to record ET data |
21 | 28 |
|
22 | 29 |
|
23 | 30 | %% Keyboards |
24 | 31 |
|
25 | | -% cfg.responseBox would be the device used by the participant to give his/her response: |
| 32 | +% cfg.responseBox would be the device used by the participant to give his/her response: |
26 | 33 | % like the button box in the scanner or a separate keyboard for a behavioral experiment |
27 | 34 | % |
28 | | -% cfg.keyboard is the keyboard on which the experimenter will type or press the keys necessary |
| 35 | +% cfg.keyboard is the keyboard on which the experimenter will type or press the keys necessary |
29 | 36 | % to start or abort the experiment. |
30 | 37 | % The two can be different or the same. |
31 | 38 |
|
32 | | -% Using empty vectors should work for linux when to select the "main" |
33 | | -% keyboard. You might have to try some other values for MacOS or Windows |
34 | | -Cfg.keyboard = []; |
35 | | -Cfg.responseBox = []; |
| 39 | +% Using empty vectors should work for linux and MacOS when to select the |
| 40 | +% "main" keyboard. You might have to try some other values for Windows |
| 41 | +cfg.keyboard = []; |
| 42 | +cfg.responseBox = []; |
36 | 43 |
|
37 | 44 |
|
38 | 45 | %% Engine parameters |
39 | 46 |
|
40 | 47 | % Monitor parameters |
41 | | -Cfg.monitorWidth = 42; % Monitor Width in cm |
42 | | -Cfg.screenDistance = 134; % Distance from the screen in cm |
43 | | -Cfg.diameterAperture = 8; % Diameter/length of side of aperture in Visual angles |
| 48 | +cfg.monitorWidth = 42; % Monitor Width in cm |
| 49 | +cfg.screenDistance = 134; % Distance from the screen in cm |
| 50 | +cfg.diameterAperture = 8; % Diameter/length of side of aperture in Visual angles |
44 | 51 |
|
45 | 52 | % Monitor parameters for PTB |
46 | | -Cfg.screen = max(Screen('Screens')); % Main screen |
47 | | -Cfg.white = [255 255 255]; |
48 | | -Cfg.black = [ 0 0 0 ]; |
49 | | -Cfg.red = [255 0 0 ]; |
50 | | -Cfg.grey = mean([Cfg.black; Cfg.white]); |
51 | | -Cfg.backgroundColor = Cfg.black; |
52 | | -Cfg.textColor = Cfg.white; |
53 | | -Cfg.textFont = 'Courier New'; |
54 | | -Cfg.textSize = 18; |
55 | | -Cfg.textStyle = 1; |
| 53 | +cfg.white = [255 255 255]; |
| 54 | +cfg.black = [ 0 0 0 ]; |
| 55 | +cfg.red = [255 0 0 ]; |
| 56 | +cfg.grey = mean([cfg.black; cfg.white]); |
| 57 | +cfg.backgroundColor = cfg.black; |
| 58 | +cfg.textColor = cfg.white; |
| 59 | +cfg.textFont = 'Courier New'; |
| 60 | +cfg.textSize = 18; |
| 61 | +cfg.textStyle = 1; |
56 | 62 |
|
57 | 63 | % Keyboard |
58 | | -Cfg.escapeKey = 'Escape'; |
| 64 | +cfg.escapeKey = 'Escape'; |
59 | 65 |
|
60 | 66 |
|
61 | 67 |
|
62 | | -% The code below will help you decide which keyboard device to use for the partipant and the experimenter |
| 68 | +% The code below will help you decide which keyboard device to use for the partipant and the experimenter |
63 | 69 |
|
64 | 70 | % Computer keyboard to quit if it is necessary |
65 | 71 | % Cfg.keyboard |
66 | | -% |
| 72 | +% |
67 | 73 | % For key presses for the subject |
68 | 74 | % Cfg.responseBox |
69 | 75 |
|
70 | | -[Cfg.keyboardNumbers, Cfg.keyboardNames] = GetKeyboardIndices; |
71 | | -Cfg.keyboardNumbers |
72 | | -Cfg.keyboardNames |
| 76 | +[cfg.keyboardNumbers, cfg.keyboardNames] = GetKeyboardIndices; |
| 77 | +cfg.keyboardNumbers |
| 78 | +cfg.keyboardNames |
73 | 79 |
|
74 | 80 |
|
75 | | -switch Cfg.device |
| 81 | +switch lower(cfg.device) |
76 | 82 |
|
77 | 83 |
|
78 | 84 | % this part might need to be adapted because the "default" device |
79 | 85 | % number might be different for different OS or set up |
80 | | - |
81 | | - case 'PC' |
| 86 | + |
| 87 | + case 'pc' |
82 | 88 |
|
83 | | - Cfg.keyboard = []; |
84 | | - Cfg.responseBox = []; |
| 89 | + cfg.keyboard = []; |
| 90 | + cfg.responseBox = []; |
85 | 91 |
|
86 | 92 | if ismac |
87 | | - Cfg.keyboard = []; |
88 | | - Cfg.responseBox = []; |
| 93 | + cfg.keyboard = []; |
| 94 | + cfg.responseBox = []; |
89 | 95 | end |
90 | | - |
| 96 | + |
91 | 97 | case 'scanner' |
92 | 98 |
|
93 | 99 | otherwise |
94 | 100 |
|
95 | 101 | % Cfg.keyboard = max(Cfg.keyboardNumbers); |
96 | 102 | % Cfg.responseBox = min(Cfg.keyboardNumbers); |
97 | 103 |
|
98 | | - Cfg.keyboard = []; |
99 | | - Cfg.responseBox = []; |
| 104 | + cfg.keyboard = []; |
| 105 | + cfg.responseBox = []; |
100 | 106 |
|
101 | 107 | end |
102 | 108 |
|
103 | 109 | %% Experiment Design |
104 | | -ExpParameters.names = {'static','motion'}; |
105 | | -ExpParameters.possibleDirections = [-1 1]; % 1 motion , -1 static |
106 | | -ExpParameters.numBlocks = size(ExpParameters.possibleDirections,2); |
107 | | -ExpParameters.numRepetitions = 1; %AT THE MOMENT IT IS NOT SET IN THE MAIN SCRIPT |
108 | | -ExpParameters.IBI = 0; %8; |
109 | | -ExpParameters.ISI = 0.1; % Time between events in secs |
110 | | -ExpParameters.onsetDelay = 5; % Number of seconds before the motion stimuli are presented |
111 | | -ExpParameters.endDelay = 1; % Number of seconds after the end all the stimuli before ending the run |
| 110 | +expParameters.names = {'static','motion'}; |
| 111 | +expParameters.possibleDirections = [-1 1]; % 1 motion , -1 static |
| 112 | +expParameters.numBlocks = size(expParameters.possibleDirections,2); |
| 113 | +expParameters.numRepetitions = 1; %AT THE MOMENT IT IS NOT SET IN THE MAIN SCRIPT |
| 114 | +expParameters.IBI = 0; %8; |
| 115 | +expParameters.ISI = 0.1; % Time between events in secs |
| 116 | +expParameters.onsetDelay = 5; % Number of seconds before the motion stimuli are presented |
| 117 | +expParameters.endDelay = 1; % Number of seconds after the end all the stimuli before ending the run |
112 | 118 |
|
113 | 119 |
|
114 | 120 | %% Visual Stimulation |
115 | | -ExpParameters.experimentType = 'Dots'; % Visual modality is in RDKs %NOT USED IN THE MAIN SCIPT |
116 | | -ExpParameters.speedEvent = 8; % speed in visual angles |
117 | | -ExpParameters.numEventsPerBlock = 12; % Number of events per block (should not be changed) |
118 | | -ExpParameters.eventDuration = .9; |
119 | | -ExpParameters.coh = 1; % Coherence Level (0-1) |
120 | | -ExpParameters.maxDotsPerFrame = 300; % Maximum number dots per frame (Number must be divisible by 3) |
121 | | -ExpParameters.dotLifeTime = 0.2; % Dot life time in seconds |
122 | | -ExpParameters.dontClear = 0; |
123 | | -ExpParameters.dotSize = 0.1; % Dot Size (dot width) in visual angles. |
124 | | -ExpParameters.dotColor = Cfg.white; |
| 121 | +expParameters.experimentType = 'Dots'; % Visual modality is in RDKs %NOT USED IN THE MAIN SCIPT |
| 122 | +expParameters.speedEvent = 8; % speed in visual angles |
| 123 | +expParameters.numEventsPerBlock = 12; % Number of events per block (should not be changed) |
| 124 | +expParameters.eventDuration = 1; |
| 125 | +expParameters.coh = 1; % Coherence Level (0-1) |
| 126 | +expParameters.maxDotsPerFrame = 300; % Maximum number dots per frame (Number must be divisible by 3) |
| 127 | +expParameters.dotLifeTime = 1; % Dot life time in seconds |
| 128 | +expParameters.dontClear = 0; |
| 129 | +expParameters.dotSize = 0.1; % Dot Size (dot width) in visual angles. |
| 130 | +expParameters.dotColor = cfg.white; |
125 | 131 |
|
126 | 132 |
|
127 | 133 | %% Task(s) |
128 | 134 |
|
129 | 135 | % Instruction |
130 | | -ExpParameters.TaskInstruction = '1-Detect the RED fixation cross\n \n\n'; |
| 136 | +expParameters.TaskInstruction = '1-Detect the RED fixation cross\n \n\n'; |
131 | 137 |
|
132 | | -ExpParameters.responseKey = {'space'}; |
| 138 | +expParameters.responseKey = {'space'}; |
133 | 139 |
|
134 | 140 |
|
135 | 141 | %% Task 1 - Fixation cross |
136 | | -ExpParameters.Task1 = true; % true / false |
| 142 | +expParameters.Task1 = true; % true / false |
137 | 143 |
|
138 | | -if ExpParameters.Task1 |
| 144 | +if expParameters.Task1 |
139 | 145 | % Used Pixels here since it really small and can be adjusted during the experiment |
140 | | - ExpParameters.fixCrossDimPix = 10; % Set the length of the lines (in Pixels) of the fixation cross |
141 | | - ExpParameters.lineWidthPix = 4; % Set the line width (in Pixels) for our fixation cross |
142 | | - ExpParameters.maxNumFixationTargetPerBlock = 2; |
143 | | - ExpParameters.fixationChangeDuration = 0.15; % In secs |
144 | | - ExpParameters.xDisplacementFixCross = 0; % Manual displacement of the fixation cross |
145 | | - ExpParameters.yDisplacementFixCross = 0; % Manual displacement of the fixation cross |
146 | | - ExpParameters.fixationCrossColor = Cfg.white; |
147 | | - ExpParameters.fixationCrossColorTarget = Cfg.red; |
| 146 | + expParameters.fixCrossDimPix = 10; % Set the length of the lines (in Pixels) of the fixation cross |
| 147 | + expParameters.lineWidthPix = 4; % Set the line width (in Pixels) for our fixation cross |
| 148 | + expParameters.maxNumFixationTargetPerBlock = 2; |
| 149 | + expParameters.targetDuration = 0.15; % In secs |
| 150 | + expParameters.xDisplacementFixCross = 0; % Manual displacement of the fixation cross |
| 151 | + expParameters.yDisplacementFixCross = 0; % Manual displacement of the fixation cross |
| 152 | + expParameters.fixationCrossColor = cfg.white; |
| 153 | + expParameters.fixationCrossColorTarget = cfg.red; |
148 | 154 | end |
149 | 155 |
|
150 | 156 |
|
151 | | -%% Setting some defaults: no need to change things here |
152 | | -if mod(ExpParameters.maxDotsPerFrame,3) ~= 0 |
153 | | - error('Number of dots should be divisible by 3.') |
154 | | -end |
| 157 | +% Setting some defaults: no need to change things here |
| 158 | +expParameters = checkCFG(expParameters); |
| 159 | + |
155 | 160 |
|
156 | | -if Cfg.debug |
| 161 | +if cfg.debug |
157 | 162 | fprintf('\n\n\n\n') |
158 | 163 | fprintf('######################################## \n') |
159 | 164 | fprintf('## DEBUG MODE, NOT THE SCANNER CODE ## \n') |
|
0 commit comments