From cc68512b9eabc815fa0a7ebc66c9df481b16a9da Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 10 Aug 2020 13:58:56 +0200 Subject: [PATCH 1/4] Create .travis.yml --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..736b2c2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +# Travis CI (https://travis-ci.org/) + +language: c +dist: bionic +cache: + apt: true # only works with Pro version + +before_install: + - cd .. && git clone https://github.com/florianschanda/miss_hit.git && export PATH=$PATH:`pwd`/miss_hit && cd CPP_localizer_auditory_motion + +jobs: + include: + - script: mh_style `pwd` + name: "miss_hit linter" # names the second job From 8854a3a05b41bf616302639d51bb4b878b5cf5cb Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Tue, 11 Aug 2020 13:23:27 +0200 Subject: [PATCH 2/4] update the main script to its elder brother visual localizer --- audioLocTranslational.m | 81 ++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/audioLocTranslational.m b/audioLocTranslational.m index 563d848..4283c00 100644 --- a/audioLocTranslational.m +++ b/audioLocTranslational.m @@ -1,9 +1,14 @@ %% Auditory hMT localizer using translational motion in four directions % (up- down- left and right-ward) -% Original Script Written by Sam Weiller to localize MT+/V5 -% adapted by M.Rezk to localize MT/MST (Huk,2002) -% re-adapted by MarcoB and RemiG 2020 +% by Mohamed Rezk 2018 +% adapted by MarcoB and RemiG 2020 + +%% + +getOnlyPress = 1; + +more off; % Clear all the previous stuff % clc; clear; @@ -12,13 +17,10 @@ clear Screen; end -getOnlyPress = 1; - -more off; - % make sure we got access to all the required functions and inputs initEnv(); +% set and load all the parameters to run the experiment cfg = setParameters; cfg = userInputs(cfg); cfg = createFilename(cfg); @@ -28,27 +30,30 @@ % Safety loop: close the screen if code crashes try - % % % REFACTOR THIS FUNCTION - [cfg] = loadAudioFiles(cfg); - %% Init the experiment [cfg] = initPTB(cfg); - % % Convert some values from degrees to pixels - % cfg = deg2Pix('diameterAperture', cfg, cfg); - % expParameters = deg2Pix('dotSize', expParameters, cfg); + % % % REFACTOR THIS FUNCTION % % % + + [cfg] = loadAudioFiles(cfg); + + % % % REFACTOR THIS FUNCTION % % % [el] = eyeTracker('Calibration', cfg); - % % % REFACTOR THIS FUNCTION + % % % REFACTOR THIS FUNCTION % % % + [cfg] = expDesign(cfg); + % % % REFACTOR THIS FUNCTION % % % + % Prepare for the output logfiles with all - logFile = saveEventsFile('open', cfg, [], ... - 'direction', 'speed', 'target', 'event', 'block'); + logFile.extraColumns = cfg.extraColumns; + logFile = saveEventsFile('open', cfg, logFile); - % disp(cfg); + disp(cfg); + % Show experiment instruction standByScreen(cfg); % prepare the KbQueue to collect responses @@ -79,25 +84,30 @@ checkAbort(cfg, cfg.keyboard.keyboard); % set direction, speed of that event and if it is a target - thisEvent.trial_type = 'dummy'; - thisEvent.direction = cfg.designDirections(iBlock, iEvent); - thisEvent.speed = cfg.designSpeeds(iBlock, iEvent); - thisEvent.target = cfg.designFixationTargets(iBlock, iEvent); + thisEvent.trial_type = cfg.design.blockNames{iBlock}; + thisEvent.direction = cfg.design.directions(iBlock, iEvent); + % thisEvent.speed = cfg.design.speeds(iBlock, iEvent); + thisEvent.target = cfg.design.fixationTargets(iBlock, iEvent); + + % % % REFACTOR THIS FUNCTION % % % % play the sounds and collect onset and duration of the event - [onset, duration] = doAudMot(cfg, thisEvent, cfg.audio.pahandle); + [onset, duration] = doAudMot(cfg, thisEvent); + + % % % REFACTOR THIS FUNCTION % % % thisEvent.event = iEvent; thisEvent.block = iBlock; + thisEvent.keyName = 'n/a'; thisEvent.duration = duration; thisEvent.onset = onset - cfg.experimentStart; % Save the events txt logfile % we save event by event so we clear this variable every loop thisEvent.fileID = logFile.fileID; + thisEvent.extraColumns = logFile.extraColumns; - saveEventsFile('save', cfg, thisEvent, ... - 'direction', 'speed', 'target', 'event', 'block'); + saveEventsFile('save', cfg, thisEvent); clear thisEvent; @@ -106,7 +116,7 @@ responseEvents = getResponse('check', cfg.keyboard.responseBox, cfg, ... getOnlyPress); - triggerString = ['trigger']; + triggerString = ['trigger_' cfg.design.blockNames{iBlock}]; saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString); % wait for the inter-stimulus interval @@ -118,28 +128,31 @@ WaitSecs(cfg.timing.IBI); + % trigger monitoring + triggerEvents = getResponse('check', cfg.keyboard.responseBox, cfg, ... + getOnlyPress); + + triggerString = 'trigger_baseline'; + saveResponsesAndTriggers(triggerEvents, cfg, logFile, triggerString); + end % End of the run for the BOLD to go down WaitSecs(cfg.timing.endDelay); + cfg = getExperimentEnd(cfg); + % Close the logfiles saveEventsFile('close', cfg, logFile); getResponse('stop', cfg.keyboard.responseBox); getResponse('release', cfg.keyboard.responseBox); - totalExperimentTime = GetSecs - cfg.experimentStart; - eyeTracker('Shutdown', cfg); - % save the whole workspace - matFile = fullfile(cfg.dir.output, strrep(cfg.fileName.events, 'tsv', 'mat')); - if IsOctave - save(matFile, '-mat7-binary'); - else - save(matFile, '-v7.3'); - end + createBoldJson(cfg, cfg); + + farewellScreen(cfg); cleanUp(); From 08e014d36630a865978add8cb350b5b663f10735 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Tue, 11 Aug 2020 13:23:58 +0200 Subject: [PATCH 3/4] update with new var names --- subfun/expDesign.m | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/subfun/expDesign.m b/subfun/expDesign.m index bdc0a98..4ef19ff 100644 --- a/subfun/expDesign.m +++ b/subfun/expDesign.m @@ -22,16 +22,16 @@ % matrix of the design % % Output: - % - ExpParameters.designBlockNames = cell array (nr_blocks, 1) with the + % - ExpParameters.design.blockNames = cell array (nr_blocks, 1) with the % name for each block % - % - ExpParameters.designDirections = array (nr_blocks, nbEventsPerBlock) + % - ExpParameters.design.directions = array (nr_blocks, nbEventsPerBlock) % with the direction to present in a given block % - 0 90 180 270 indicate the angle % - -1 indicates static % % - % - ExpParameters.designFixationTargets = array (nr_blocks, nbEventsPerBlock) + % - ExpParameters.design.fixationTargets = array (nr_blocks, nbEventsPerBlock) % showing for each event if it should be accompanied by a target % @@ -48,8 +48,8 @@ % Set variables here for a dummy test of this function if nargin < 1 || isempty(cfg) - cfg.design.names = {'static', 'motion'}; - cfg.design.nbRepetitions = 4; + cfg.design.names = {'static', 'motion'}; + cfg.design.nbRepetitions = 4; cfg.design.nbEventsPerBlock = 12; cfg.target.maxNbPerBlock = 2; end @@ -93,14 +93,14 @@ %% Give the blocks the names with condition - cfg.designBlockNames = cell(nrBlocks, 1); - cfg.designDirections = zeros(nrBlocks, nbEventsPerBlock); - cfg.designFixationTargets = zeros(nrBlocks, nbEventsPerBlock); + cfg.design.blockNames = cell(nrBlocks, 1); + cfg.design.directions = zeros(nrBlocks, nbEventsPerBlock); + cfg.design.fixationTargets = zeros(nrBlocks, nbEventsPerBlock); for iMotionBlock = 1:nbRepetitions - cfg.designDirections(motionIndex(iMotionBlock), :) = Shuffle(motionDirections); - cfg.designDirections(staticIndex(iMotionBlock), :) = Shuffle(staticDirections); + cfg.design.directions(motionIndex(iMotionBlock), :) = Shuffle(motionDirections); + cfg.design.directions(staticIndex(iMotionBlock), :) = Shuffle(staticDirections); end @@ -113,7 +113,7 @@ case 'motion' thisBlockName = {'motion'}; end - cfg.designBlockNames(iBlock) = thisBlockName; + cfg.design.blockNames(iBlock) = thisBlockName; % set target % if there are 2 targets per block we make sure that they are at least @@ -141,19 +141,19 @@ end - cfg.designFixationTargets(iBlock, chosenTarget) = 1; + cfg.design.fixationTargets(iBlock, chosenTarget) = 1; end %% Visualize the design matrix if displayFigs - uniqueNames = unique(cfg.designBlockNames) ; + uniqueNames = unique(cfg.design.blockNames) ; - Ind = zeros(length(cfg.designBlockNames), length(uniqueNames)) ; + Ind = zeros(length(cfg.design.blockNames), length(uniqueNames)) ; for i = 1:length(uniqueNames) - CondInd(:, i) = find(strcmp(cfg.designBlockNames, uniqueNames{i})) ; %#ok<*AGROW> + CondInd(:, i) = find(strcmp(cfg.design.blockNames, uniqueNames{i})) ; %#ok<*AGROW> Ind(CondInd(:, i), i) = 1 ; end From 91b77257a101832ed555d043aff7ad65b52c5b03 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Tue, 11 Aug 2020 17:07:10 +0200 Subject: [PATCH 4/4] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 736b2c2..39d73b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ cache: apt: true # only works with Pro version before_install: - - cd .. && git clone https://github.com/florianschanda/miss_hit.git && export PATH=$PATH:`pwd`/miss_hit && cd CPP_localizer_auditory_motion + - cd .. && git clone https://github.com/florianschanda/miss_hit.git && export PATH=$PATH:`pwd`/miss_hit && cd localizer_auditory_motion jobs: include: