Skip to content

Commit b2f7d65

Browse files
committed
add static condition for mt/mst
1 parent 928663b commit b2f7d65

File tree

2 files changed

+88
-8
lines changed

2 files changed

+88
-8
lines changed

subfun/expDesignMtMst.m

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,85 @@
2727
targetPerCondition = repmat(RANGE_TARGETS, 1, NB_REPETITIONS / MAX_TARGET_PER_BLOCK);
2828

2929
numTargetsForEachBlock = zeros(1, NB_BLOCKS);
30-
numTargetsForEachBlock(CONDITON1_INDEX) = shuffle(targetPerCondition);
31-
numTargetsForEachBlock(CONDITON2_INDEX) = shuffle(targetPerCondition);
30+
31+
if strcmpi(cfg.design.localizer, 'MT_MST') && length(cfg.design.names) == 2
32+
numTargetsForEachBlock(CONDITON1_INDEX) = shuffle(targetPerCondition);
33+
end
34+
35+
numTargetsForEachBlock(CONDITON2_INDEX) = shuffle(targetPerCondition);
36+
37+
%% Give the blocks the names with condition and design the task in each event
38+
while 1
39+
40+
fixationTargets = zeros(NB_BLOCKS, NB_EVENTS_PER_BLOCK);
41+
42+
for iBlock = 1:NB_BLOCKS
43+
44+
% Set target
45+
% - if there are 2 targets per block we make sure that they are at least
46+
% 2 events apart
47+
% - targets cannot be on the first or last event of a block
48+
% - no more than 2 target in the same event order
49+
50+
nbTarget = numTargetsForEachBlock(iBlock);
51+
52+
chosenPosition = setTargetPositionInSequence( ...
53+
NB_EVENTS_PER_BLOCK, ...
54+
nbTarget, ...
55+
[1 NB_EVENTS_PER_BLOCK]);
56+
57+
fixationTargets(iBlock, chosenPosition) = 1;
58+
59+
end
60+
61+
% Check rule 3
62+
if max(sum(fixationTargets)) < NB_REPETITIONS - 1
63+
break
64+
end
65+
66+
end
67+
68+
%% Now we do the easy stuff
69+
cfg.design.blockNames = assignConditions(cfg);
70+
71+
if strcmpi(cfg.design.localizer, 'MT_MST')
72+
73+
if length(cfg.design.names) == 1
74+
75+
nbBlocksPerHemifield = (NB_REPETITIONS / 4) * ...
76+
length(cfg.design.fixationPosition);
77+
78+
else
79+
80+
nbBlocksPerHemifield = (NB_REPETITIONS / 2) * ...
81+
length(cfg.design.fixationPosition);
82+
83+
end
84+
85+
86+
87+
cfg.design.blockFixationPosition = repmat(cfg.design.fixationPosition(1), ...
88+
nbBlocksPerHemifield, ...
89+
1);
90+
91+
if length(cfg.design.fixationPosition) == 2
92+
93+
cfg.design.blockFixationPosition = [ cfg.design.blockFixationPosition ; ...
94+
repmat(cfg.design.fixationPosition(2), ...
95+
nbBlocksPerHemifield, ...
96+
1) ];
97+
98+
end
99+
100+
end
101+
102+
cfg.design.nbBlocks = NB_BLOCKS;
103+
104+
cfg = setDirections(cfg);
105+
106+
speeds = ones(NB_BLOCKS, NB_EVENTS_PER_BLOCK) * cfg.dot.speedPixPerFrame;
107+
cfg.design.speeds = speeds;
108+
109+
cfg.design.fixationTargets = fixationTargets;
110+
111+

visualMotionLocalizer.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434

3535
[el] = eyeTracker('Calibration', cfg);
3636

37-
% if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST')
38-
% [cfg] = expDesignMtMst(cfg);
39-
% else
40-
[cfg] = expDesign(cfg);
41-
% end
37+
if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST')
38+
[cfg] = expDesignMtMst(cfg);
39+
else
40+
[cfg] = expDesign(cfg);
41+
end
4242

4343
% Prepare for the output logfiles with all
4444
logFile.extraColumns = cfg.extraColumns;
@@ -99,7 +99,7 @@
9999
['start_trial-', num2str(iEvent), '_', thisEvent.trial_type]);
100100

101101
% play the dots and collect onset and duraton of the event
102-
[onset, duration] = doDotMo(cfg, thisEvent, thisFixation);
102+
[onset, duration] = doDotMo(cfg, thisEvent, thisFixation, iEvent);
103103

104104
thisEvent = preSaveSetup( ...
105105
thisEvent, ...

0 commit comments

Comments
 (0)