generated from cpp-lln-lab/template_PTB_experiment
-
Notifications
You must be signed in to change notification settings - Fork 4
/
setParameters.m
161 lines (117 loc) · 4.42 KB
/
setParameters.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
% (C) Copyright 2020 CPP visual motion localizer developpers
function [cfg] = setParameters()
% Template PTB experiment
% Initialize the parameters and general configuration variables
cfg = struct();
% by default the data will be stored in an output folder created where the
% setParamters.m file is
% change that if you want the data to be saved somewhere else
cfg.dir.output = fullfile( ...
fileparts(mfilename('fullpath')), '..', ...
'output');
%% Debug mode settings
cfg.debug.do = false; % To test the script out of the scanner, skip PTB sync
cfg.debug.smallWin = false; % To test on a part of the screen, change to 1
cfg.debug.transpWin = true; % To test with trasparent full size screen
cfg.verbose = 0;
cfg.skipSyncTests = 0;
%% Engine parameters
cfg.testingDevice = 'pc';
cfg.eyeTracker.do = false;
cfg.audio.do = false;
cfg = setMonitor(cfg);
% Keyboards
cfg = setKeyboards(cfg);
% MRI settings
cfg = setMRI(cfg);
cfg.pacedByTriggers.do = false;
%% Experiment Design
cfg.design.blockNames = {'condition_1', 'condition_2'};
cfg.design.nbBlocks = 2;
cfg.design.nbTrials = 4;
%% Timing
% FOR 7T: if you want to create localizers on the fly, the following must be
% multiples of the scanneryour sequence TR
%
% IBI
% block length = (cfg.eventDuration + cfg.ISI) * cfg.design.nbEventsPerBlock
cfg.timing.eventDuration = 2; % second
% Time between blocs in secs
cfg.timing.IBI = 2;
% Time between events in secs
cfg.timing.ISI = 1;
% Number of seconds before the motion stimuli are presented
cfg.timing.onsetDelay = 2;
% Number of seconds after the end all the stimuli before ending the run
cfg.timing.endDelay = 2;
% reexpress those in terms of repetition time
if cfg.pacedByTriggers.do
cfg.pacedByTriggers.quietMode = true;
cfg.pacedByTriggers.nbTriggers = 1;
cfg.timing.eventDuration = cfg.mri.repetitionTime / 2 - 0.04; % second
% Time between blocs in secs
cfg.timing.IBI = 0;
% Time between events in secs
cfg.timing.ISI = 0;
% Number of seconds before the motion stimuli are presented
cfg.timing.onsetDelay = 0;
% Number of seconds after the end all the stimuli before ending the run
cfg.timing.endDelay = 2;
end
%% Task(s)
cfg.task.name = 'template PTB experiment';
% Instruction
cfg.task.instruction = '1-Detect the RED fixation cross\n \n\n';
% Fixation cross (in pixels)
cfg.fixation.type = 'cross';
cfg.fixation.colorTarget = cfg.color.red;
cfg.fixation.color = cfg.color.white;
cfg.fixation.width = 2;
cfg.fixation.lineWidthPix = 4;
cfg.fixation.xDisplacement = 0;
cfg.fixation.yDisplacement = 0;
cfg.target.maxNbPerBlock = 1;
cfg.target.duration = 0.1; % In secs
cfg.extraColumns = { ...
'target', ...
'event', ...
'block', ...
'keyName'};
end
function cfg = setKeyboards(cfg)
cfg.keyboard.escapeKey = 'ESCAPE';
cfg.keyboard.responseKey = { ...
'r', 'g', 'y', 'b', ...
'd', 'n', 'z', 'e', ...
't'};
cfg.keyboard.keyboard = [];
cfg.keyboard.responseBox = [];
if strcmpi(cfg.testingDevice, 'mri')
cfg.keyboard.keyboard = [];
cfg.keyboard.responseBox = [];
end
end
function cfg = setMRI(cfg)
% letter sent by the trigger to sync stimulation and volume acquisition
cfg.mri.triggerKey = 't';
cfg.mri.triggerNb = 1;
cfg.mri.repetitionTime = 1.8;
cfg.bids.MRI.Instructions = 'Detect the RED fixation cross';
cfg.bids.MRI.TaskDescription = [];
end
function cfg = setMonitor(cfg)
% Monitor parameters for PTB
cfg.color.white = [255 255 255];
cfg.color.black = [0 0 0];
cfg.color.red = [255 0 0];
cfg.color.grey = mean([cfg.color.black; cfg.color.white]);
cfg.color.background = cfg.color.black;
cfg.text.color = cfg.color.white;
% Monitor parameters
cfg.screen.monitorWidth = 50; % in cm
cfg.screen.monitorDistance = 40; % distance from the screen in cm
if strcmpi(cfg.testingDevice, 'mri')
cfg.screen.monitorWidth = 25;
cfg.screen.monitorDistance = 95;
end
end