Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"projectOwner": "cpp-lln-lab",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": false,
"skipCi": true,
"contributorsSortAlphabetically": true
}
17 changes: 11 additions & 6 deletions audioLocTranslational.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

% Prepare for the output logfiles with all
logFile.extraColumns = cfg.extraColumns;
logFile = saveEventsFile('init', cfg, logFile);
logFile = saveEventsFile('open', cfg, logFile);

% disp(cfg);
Expand Down Expand Up @@ -85,13 +86,15 @@
thisEvent.fixationTarget = cfg.design.fixationTargets(iBlock, iEvent);
thisEvent.soundTarget = cfg.design.soundTargets(iBlock, iEvent);

thisEvent.isStim = logFile.isStim;

% we wait for a trigger every 2 events
if cfg.pacedByTriggers.do && mod(iEvent, 2) == 1
waitForTrigger( ...
cfg, ...
cfg.keyboard.responseBox, ...
cfg.pacedByTriggers.quietMode, ...
cfg.pacedByTriggers.nbTriggers);
cfg, ...
cfg.keyboard.responseBox, ...
cfg.pacedByTriggers.quietMode, ...
cfg.pacedByTriggers.nbTriggers);
end

% % % REFACTOR THIS FUNCTION % % %
Expand All @@ -116,7 +119,7 @@
% collect the responses and appends to the event structure for
% saving in the tsv file
responseEvents = getResponse('check', cfg.keyboard.responseBox, cfg, ...
getOnlyPress);
getOnlyPress);

triggerString = ['trigger_' cfg.design.blockNames{iBlock}];
saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString);
Expand All @@ -132,7 +135,7 @@

% trigger monitoring
triggerEvents = getResponse('check', cfg.keyboard.responseBox, cfg, ...
getOnlyPress);
getOnlyPress);

triggerString = 'trigger_baseline';
saveResponsesAndTriggers(triggerEvents, cfg, logFile, triggerString);
Expand All @@ -152,6 +155,8 @@

eyeTracker('Shutdown', cfg);

% remove the sound data from the cfg before saving it.
cfg = rmfield(cfg, 'soundData');
createJson(cfg, cfg);

farewellScreen(cfg);
Expand Down
4 changes: 2 additions & 2 deletions initEnv.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@

if numel(dir(libDirectory)) <= 2 % Means that the external is empty
error(['Git submodules are not cloned!', ...
'Try this in your terminal:', ...
' git submodule update --recursive ']);
'Try this in your terminal:', ...
' git submodule update --recursive ']);
else
addDependencies();
end
Expand Down
Binary file removed input/Motion/sub-pilot001/sub-pilot001_LRL.wav
Binary file not shown.
Binary file removed input/Motion/sub-pilot001/sub-pilot001_LRL_T.wav
Binary file not shown.
Binary file modified input/Motion/sub-pilot001/sub-pilot001_LRL_T_rms.wav
Binary file not shown.
Binary file modified input/Motion/sub-pilot001/sub-pilot001_LRL_rms.wav
Binary file not shown.
Binary file removed input/Motion/sub-pilot001/sub-pilot001_RLR.wav
Binary file not shown.
Binary file removed input/Motion/sub-pilot001/sub-pilot001_RLR_T.wav
Binary file not shown.
Binary file modified input/Motion/sub-pilot001/sub-pilot001_RLR_T_rms.wav
Binary file not shown.
Binary file modified input/Motion/sub-pilot001/sub-pilot001_RLR_rms.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion input/equateRmsWav.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function runFunction (referenceWavFn, targetWavFn)

% correct for the rms differences in each channel
finalWav = [targetWav(:, 1) * (referenceRMS(1) / targetRms(1)) ...
targetWav(:, 2) * (referenceRMS(2) / targetRms(2))];
targetWav(:, 2) * (referenceRMS(2) / targetRms(2))];

% check that the rms of the final is similar to the original
finalRms = rms(finalWav);
Expand Down
2 changes: 1 addition & 1 deletion lib/CPP_BIDS
Submodule CPP_BIDS updated 131 files
2 changes: 1 addition & 1 deletion lib/CPP_PTB
Submodule CPP_PTB updated 112 files
35 changes: 20 additions & 15 deletions setParameters.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
% setParamters.m file is
% change that if you want the data to be saved somewhere else
cfg.dir.output = fullfile( ...
fileparts(mfilename('fullpath')), '..', ...
'output');
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 = false; % To test with trasparent full size screen

cfg.verbose = false;
cfg.verbose = 1;
cfg.skipSyncTests = 0;

cfg.audio.devIdx = 3; % 5 %11

%% Engine parameters

Expand All @@ -32,9 +34,11 @@
cfg = setKeyboards(cfg);

% MRI settings

cfg = setMRI(cfg);
cfg.suffix.acquisition = '0p75mmEv';

cfg.pacedByTriggers.do = true;
cfg.pacedByTriggers.do = false;

%% Experiment Design

Expand All @@ -43,19 +47,20 @@
cfg.design.motionType = 'translation';
cfg.design.names = {'static'; 'motion'};
% 0: L--R--L; 180: R--L--R;
cfg.design.motionDirections = [0 0 180 180];
cfg.design.nbRepetitions = 14;
cfg.design.nbEventsPerBlock = 12;
cfg.design.motionDirections = [0 180];
cfg.design.nbRepetitions = 21;
cfg.design.nbEventsPerBlock = 6;

%% Timing

% FOR 7T: if you want to create localizers on the fly, the following must be
% multiples of the scanneryour sequence TR
% multiples of the scanner sequence TR
%
% IBI
% block length = (cfg.eventDuration + cfg.ISI) * cfg.design.nbEventsPerBlock

cfg.timing.eventDuration = 0.850; % second
% for info: not actually used since "defined" by the sound duration
% cfg.timing.eventDuration = 0.850; % second

% Time between blocs in secs
cfg.timing.IBI = 0;
Expand Down Expand Up @@ -94,7 +99,7 @@

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

% Fixation cross (in pixels)
cfg.fixation.type = 'cross';
Expand All @@ -105,7 +110,7 @@
cfg.fixation.xDisplacement = 0;
cfg.fixation.yDisplacement = 0;

cfg.target.maxNbPerBlock = 2;
cfg.target.maxNbPerBlock = 1;
cfg.target.duration = 0.5; % In secs

cfg.extraColumns = {'direction', 'soundTarget', 'fixationTarget', 'event', 'block', 'keyName'};
Expand Down Expand Up @@ -135,9 +140,9 @@
function cfg = setKeyboards(cfg)
cfg.keyboard.escapeKey = 'ESCAPE';
cfg.keyboard.responseKey = { ...
'r', 'g', 'y', 'b', ...
'd', 'n', 'z', 'e', ...
't'}; % dnze rgyb
'r', 'g', 'y', 'b', ...
'd', 'n', 'z', 'e', ...
't'}; % dnze rgyb
cfg.keyboard.keyboard = [];
cfg.keyboard.responseBox = [];

Expand All @@ -155,7 +160,7 @@
cfg.mri.repetitionTime = 1.8;

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

end
2 changes: 1 addition & 1 deletion subfun/doAuditoryMotion.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@
% Get the end time
waitForEndOfPlayback = 1; % hard coding that will need to be moved out
[onset, ~, ~, estStopTime] = PsychPortAudio('Stop', cfg.audio.pahandle, ...
waitForEndOfPlayback);
waitForEndOfPlayback);

duration = estStopTime - onset;
22 changes: 11 additions & 11 deletions subfun/expDesign.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,23 @@
% 2 events apart
% - targets cannot be on the first or last event of a block

% Fixation targets
nbTarget = numTargetsForEachBlock(iBlock);

% Fixation targets
forbiddenPositions = [];
chosenPosition = setTargetPositionInSequence( ...
NB_EVENTS_PER_BLOCK, ...
nbTarget, ...
[1 NB_EVENTS_PER_BLOCK]);
NB_EVENTS_PER_BLOCK, ...
nbTarget, ...
forbiddenPositions);

fixationTargets(iBlock, chosenPosition) = 1;

% Sound targets
nbTarget = numTargetsForEachBlock(iBlock);

forbiddenPositions = [chosenPosition];
chosenPosition = setTargetPositionInSequence( ...
NB_EVENTS_PER_BLOCK, ...
nbTarget, ...
[1 NB_EVENTS_PER_BLOCK]);
NB_EVENTS_PER_BLOCK, ...
nbTarget, ...
forbiddenPositions);

soundTargets(iBlock, chosenPosition) = 1;

Expand Down Expand Up @@ -150,8 +150,8 @@
NB_REPEATS_BASE_VECTOR = NB_EVENTS_PER_BLOCK / length(STATIC_DIRECTIONS);

static_directions = repmat( ...
STATIC_DIRECTIONS, ...
1, NB_REPEATS_BASE_VECTOR);
STATIC_DIRECTIONS, ...
1, NB_REPEATS_BASE_VECTOR);

for iMotionBlock = 1:NB_REPETITIONS

Expand Down
1 change: 1 addition & 0 deletions subfun/saveResponsesAndTriggers.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString)
end
end

responseEvents(1).isStim = logFile.isStim;
responseEvents(1).fileID = logFile.fileID;
responseEvents(1).extraColumns = logFile.extraColumns;
saveEventsFile('save', cfg, responseEvents);
Expand Down
10 changes: 6 additions & 4 deletions tests/test_expDesign.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ function test_exDesignBasic()

% make sure that we have the right number of blocks of the right length
assertTrue(all(size(cfg.design.directions) == [ ...
cfg.design.nbRepetitions * numel(cfg.design.names), ...
cfg.design.nbEventsPerBlock]));
cfg.design.nbRepetitions * ...
numel(cfg.design.names), ...
cfg.design.nbEventsPerBlock]));

% check that we do not have more than the required number of targets per
% block
Expand Down Expand Up @@ -62,8 +63,9 @@ function test_exDesignBasicOtherSetUp()

% make sure that we have the right number of blocks of the right length
assertTrue(all(size(cfg.design.directions) == [ ...
cfg.design.nbRepetitions * numel(cfg.design.names), ...
cfg.design.nbEventsPerBlock]));
cfg.design.nbRepetitions * ...
numel(cfg.design.names), ...
cfg.design.nbEventsPerBlock]));

% check that we do not have more than the required number of targets per
% block
Expand Down