Skip to content

Commit 028ee6d

Browse files
committed
add setParameters.m
1 parent 2d68d40 commit 028ee6d

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed

setParameters.m

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

0 commit comments

Comments
 (0)