Skip to content

Commit 30ec3b5

Browse files
Merge pull request #25 from marcobarilari/marco_task2-soundTarget
add Task #2 - shorter sound
2 parents 1b1a7ff + 8696d3a commit 30ec3b5

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

audioLocTranslational.m

+1-6
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,7 @@
8383
thisEvent.trial_type = cfg.design.blockNames{iBlock};
8484
thisEvent.direction = cfg.design.directions(iBlock, iEvent);
8585
thisEvent.fixationTarget = cfg.design.fixationTargets(iBlock, iEvent);
86-
87-
% % % WIP % % %
88-
89-
% thisEvent.soundTarget = cfg.design.soundTargets(iBlock, iEvent);
90-
91-
% % % WIP % % %
86+
thisEvent.soundTarget = cfg.design.soundTargets(iBlock, iEvent);
9287

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

setParameters.m

+5-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
cfg.task.name = 'auditory localizer';
9292

9393
% Instruction
94-
cfg.task.instruction = '1-Detect the RED fixation cross\n \n\n';
94+
cfg.task.instruction = ['1 - Detect the RED fixation cross\n' ...
95+
'2 - Detected the shorter repeated sounds'];
9596

9697
% Fixation cross (in pixels)
9798
cfg.fixation.type = 'cross';
@@ -105,7 +106,7 @@
105106
cfg.target.maxNbPerBlock = 2;
106107
cfg.target.duration = 0.5; % In secs
107108

108-
cfg.extraColumns = {'direction', 'speed', 'target', 'event', 'block', 'keyName'};
109+
cfg.extraColumns = {'direction', 'soundTarget', 'fixationTarget', 'event', 'block', 'keyName'};
109110

110111
end
111112

@@ -151,7 +152,8 @@
151152

152153
cfg.mri.repetitionTime = 1.8;
153154

154-
cfg.bids.MRI.Instructions = 'Detect the RED fixation cross';
155+
cfg.bids.MRI.Instructions = ['1 - Detect the RED fixation cross\n' ...
156+
'2 - Detected the shorter repeated sounds'];
155157
cfg.bids.MRI.TaskDescription = [];
156158

157159
end

subfun/doAuditoryMotion.m

+4-13
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
direction = thisEvent.direction(1);
2121
isFixationTarget = thisEvent.fixationTarget(1);
2222
targetDuration = cfg.target.duration;
23-
24-
% % % WIP % % %
25-
26-
% isSoundTarget = thisEvent.soundTarget(1);
27-
28-
% % % WIP % % %
23+
isSoundTarget = thisEvent.soundTarget(1);
2924

3025
soundData = cfg.soundData;
3126

@@ -38,13 +33,9 @@
3833
fieldName = 'RLR';
3934
end
4035

41-
% % % WIP % % %
42-
43-
% if isSoundTarget == 1
44-
% fieldName = [fieldName '_T'];
45-
% end
46-
47-
% % % WIP % % %
36+
if isSoundTarget == 1
37+
fieldName = [fieldName '_T'];
38+
end
4839

4940
sound = soundData.(fieldName);
5041

subfun/expDesign.m

+17-3
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@
7777

7878
fixationTargets = zeros(NB_BLOCKS, NB_EVENTS_PER_BLOCK);
7979

80+
soundTargets = zeros(NB_BLOCKS, NB_EVENTS_PER_BLOCK);
81+
8082
for iBlock = 1:NB_BLOCKS
8183

8284
% Set target
8385
% - if there are 2 targets per block we make sure that they are at least
8486
% 2 events apart
8587
% - targets cannot be on the first or last event of a block
86-
% - no more than 2 target in the same event order
8788

89+
% Fixation targets
8890
nbTarget = numTargetsForEachBlock(iBlock);
8991

9092
chosenPosition = setTargetPositionInSequence( ...
@@ -94,10 +96,20 @@
9496

9597
fixationTargets(iBlock, chosenPosition) = 1;
9698

99+
% Sound targets
100+
nbTarget = numTargetsForEachBlock(iBlock);
101+
102+
chosenPosition = setTargetPositionInSequence( ...
103+
NB_EVENTS_PER_BLOCK, ...
104+
nbTarget, ...
105+
[1 NB_EVENTS_PER_BLOCK]);
106+
107+
soundTargets(iBlock, chosenPosition) = 1;
108+
97109
end
98110

99-
% Check rule 3
100-
if max(sum(fixationTargets)) < NB_REPETITIONS - 1
111+
% Check that fixation and shorter sound are not presented in the same event
112+
if max(unique(fixationTargets + soundTargets)) < 2
101113
break
102114
end
103115

@@ -112,6 +124,8 @@
112124

113125
cfg.design.fixationTargets = fixationTargets;
114126

127+
cfg.design.soundTargets = soundTargets;
128+
115129
%% Plot
116130
diplayDesign(cfg, displayFigs);
117131

0 commit comments

Comments
 (0)