Skip to content

Commit 67ee48d

Browse files
committed
use preTrialSetup to prepare MT and MST trials
1 parent 3a85ab7 commit 67ee48d

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

subfun/preTrialSetup.m

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
11
function varargout = preTrialSetup(varargin)
22
% varargout = postInitializatinSetup(varargin)
33

4-
% generic function to finalize some set up after psychtoolbox has been
5-
% initialized
4+
% generic function to prepare some structure before each trial
65

76
[cfg, iBlock, iEvent] = deal(varargin{:});
87

98
% set direction, speed of that event and if it is a target
109
thisEvent.trial_type = cfg.design.blockNames{iBlock};
1110
thisEvent.direction = cfg.design.directions(iBlock, iEvent);
1211
thisEvent.speed = cfg.design.speeds(iBlock, iEvent);
13-
thisEvent.target = cfg.design.fixationTargets(iBlock, iEvent);
12+
thisEvent.target = cfg.design.fixationTargets(iBlock, iEvent);
1413

1514
% If this frame shows a target we change the color of the cross
1615
thisFixation.fixation = cfg.fixation;
1716
thisFixation.screen = cfg.screen;
17+
18+
switch thisEvent.trial_type
19+
case 'fixation_right'
20+
cfg.aperture.xPosPix = -abs(cfg.aperture.xPosPix);
21+
22+
thisFixation.fixation.xDisplacement = cfg.aperture.xPos;
23+
thisFixation = initFixation(thisFixation);
24+
25+
case 'fixation_left'
26+
cfg.aperture.xPosPix = +abs(cfg.aperture.xPosPix);
27+
28+
thisFixation.fixation.xDisplacement = -cfg.aperture.xPos;
29+
thisFixation = initFixation(thisFixation);
30+
31+
end
32+
33+
varargout = {thisEvent, thisFixation, cfg};
34+
1835

19-
varargout = {thisEvent, thisFixation};
2036

2137
end

visualLocTranslational.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
% Check for experiment abortion from operator
8080
checkAbort(cfg, cfg.keyboard.keyboard);
8181

82-
[thisEvent, thisFixation] = preTrialSetup(cfg, iBlock, iEvent);
82+
[thisEvent, thisFixation, cfg] = preTrialSetup(cfg, iBlock, iEvent);
8383

8484
% we wait for a trigger every 2 events
8585
if cfg.pacedByTriggers.do && mod(iEvent, 2) == 1

0 commit comments

Comments
 (0)