Skip to content

Commit c854e6f

Browse files
authored
Merge pull request #47 from Remi-Gau/remi_dev
add a post-initialization function
2 parents f9f886f + 87c3c04 commit c854e6f

File tree

5 files changed

+55
-16
lines changed

5 files changed

+55
-16
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,31 @@ Any details of the experiment can be changed in `setParameters.m` (e.g., experim
8080
- Instructions
8181
- Task #1 parameters
8282

83+
#### Let the scanner pace the experiment
84+
85+
Set `cfg.pacedByTriggers.do` to `true` and you can then set all the details in this `if` block
86+
87+
```matlab
88+
% Time is here in in terms of number repetition time (i.e MRI volumes)
89+
if cfg.pacedByTriggers.do
90+
91+
cfg.pacedByTriggers.quietMode = true;
92+
cfg.pacedByTriggers.nbTriggers = 1;
93+
94+
cfg.timing.eventDuration = cfg.mri.repetitionTime / 2 - 0.04; % second
95+
96+
% Time between blocs in secs
97+
cfg.timing.IBI = 0;
98+
% Time between events in secs
99+
cfg.timing.ISI = 0;
100+
% Number of seconds before the motion stimuli are presented
101+
cfg.timing.onsetDelay = 0;
102+
% Number of seconds after the end all the stimuli before ending the run
103+
cfg.timing.endDelay = 2;
104+
105+
end
106+
```
107+
83108
### 3.3. <a name='subfundoDotMo'></a>subfun/doDotMo
84109

85110
#### 3.3.1. <a name='Input:'></a>Input:

subfun/postInitializationSetup.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
function varargout = postInitializationSetup(varargin)
2+
% varargout = postInitializatinSetup(varargin)
3+
4+
% generic function to finalize some set up after psychtoolbox has been
5+
% initialized
6+
7+
cfg = deal(varargin{:});
8+
9+
cfg.dot.matrixWidth = cfg.screen.winWidth;
10+
11+
% Convert some values from degrees to pixels
12+
cfg.dot = degToPix('size', cfg.dot, cfg);
13+
cfg.dot = degToPix('speed', cfg.dot, cfg);
14+
15+
% Get dot speeds in pixels per frame
16+
cfg.dot.speedPixPerFrame = cfg.dot.speedPix / cfg.screen.monitorRefresh;
17+
18+
cfg.aperture = degToPix('xPos', cfg.aperture, cfg);
19+
20+
% dots are displayed on a square with a length in visual angle equal to the
21+
% field of view
22+
cfg.dot.number = round(cfg.dot.density * ...
23+
(cfg.dot.matrixWidth / cfg.screen.ppd)^2);
24+
25+
varargout = cfg;
26+
27+
end

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.0.1

visualLocTranslational.m

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,7 @@
3333
%% Init the experiment
3434
[cfg] = initPTB(cfg);
3535

36-
cfg.dot.matrixWidth = cfg.screen.winWidth;
37-
38-
% Convert some values from degrees to pixels
39-
cfg.dot = degToPix('size', cfg.dot, cfg);
40-
cfg.dot = degToPix('speed', cfg.dot, cfg);
41-
42-
% Get dot speeds in pixels per frame
43-
cfg.dot.speedPixPerFrame = cfg.dot.speedPix / cfg.screen.monitorRefresh;
44-
45-
cfg.aperture = degToPix('xPos', cfg.aperture, cfg);
46-
47-
% dots are displayed on a square with a length in visual angle equal to the
48-
% field of view
49-
cfg.dot.number = round(cfg.dot.density * ...
50-
(cfg.dot.matrixWidth / cfg.screen.ppd)^2);
36+
cfg = postInitializationSetup(cfg);
5137

5238
[el] = eyeTracker('Calibration', cfg);
5339

0 commit comments

Comments
 (0)