From eb48b6841231b7dc3f35a985a32ccdc2f3816703 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Sun, 20 Nov 2022 11:53:02 +0100 Subject: [PATCH 1/6] add initialization of the log file and uncomment add message to eyetracker --- mainScript.m | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mainScript.m b/mainScript.m index 2f3fa11..e550d03 100644 --- a/mainScript.m +++ b/mainScript.m @@ -34,6 +34,7 @@ % Prepare for the output logfiles with all logFile.extraColumns = cfg.extraColumns; + logFile = saveEventsFile('init', cfg, logFile); logFile = saveEventsFile('open', cfg, logFile); disp(cfg); @@ -67,10 +68,8 @@ [thisEvent, thisFixation, cfg] = preTrialSetup(cfg, iBlock, iTrial); - % AVAILABLE IN A NEW RELEASE SOON - % - % eyeTracker('Message', cfg, ... - % ['start_trial-', num2str(iTrial), '_', thisEvent.trial_type]); + eyeTracker('Message', cfg, ... + ['start_trial-', num2str(iTrial), '_', thisEvent.trial_type]); % play the dots and collect onset and duraton of the event [onset, duration] = doTrial(cfg, thisEvent, thisFixation); @@ -93,10 +92,8 @@ responseEvents(1).extraColumns = logFile.extraColumns; saveEventsFile('save', cfg, responseEvents); - % AVAILABLE IN A NEW RELEASE SOON - % - % eyeTracker('Message', cfg, ... - % ['end_trial-', num2str(iTrial), '_', thisEvent.trial_type]); + eyeTracker('Message', cfg, ... + ['end_trial-', num2str(iTrial), '_', thisEvent.trial_type]); waitFor(cfg, cfg.timing.ISI); From 30dd67d8223a0a905f328b042c74cafbd684d1d6 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Fri, 16 Dec 2022 15:18:46 +0100 Subject: [PATCH 2/6] add waitForTrigger and IBI and eyetracker message at end of the block --- mainScript.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mainScript.m b/mainScript.m index e550d03..e2b5a3d 100644 --- a/mainScript.m +++ b/mainScript.m @@ -49,7 +49,8 @@ eyeTracker('StartRecording', cfg); - cfg = getExperimentStart(cfg); + % Wait for Trigger from Scanner and add timestamp of experiment onset + cfg.experimentStart = waitForTrigger(cfg); getResponse('start', cfg.keyboard.responseBox); @@ -78,7 +79,8 @@ thisEvent, ... iBlock, ... iTrial, ... - duration, onset, ... + duration, ... + onset, ... cfg, ... logFile); @@ -88,6 +90,7 @@ % saving in the tsv file responseEvents = getResponse('check', cfg.keyboard.responseBox, cfg); + responseEvents(1).isStim = logFile.isStim; responseEvents(1).fileID = logFile.fileID; responseEvents(1).extraColumns = logFile.extraColumns; saveEventsFile('save', cfg, responseEvents); @@ -99,6 +102,10 @@ end + eyeTracker('Message', cfg, ['end_block-', num2str(iBlock)]); + + waitFor(cfg, cfg.timing.IBI); + end % End of the run for the BOLD to go down From 14e8d9394a0e809e89a7e3f99bc8842a6aa45cd8 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Fri, 16 Dec 2022 15:19:14 +0100 Subject: [PATCH 3/6] fix bug --- src/preSaveSetup.m | 1 + 1 file changed, 1 insertion(+) diff --git a/src/preSaveSetup.m b/src/preSaveSetup.m index 59d2096..de5fa9a 100644 --- a/src/preSaveSetup.m +++ b/src/preSaveSetup.m @@ -16,6 +16,7 @@ % Save the events txt logfile % we save event by event so we clear this variable every loop + thisEvent.isStim = logFile.isStim; thisEvent.fileID = logFile.fileID; thisEvent.extraColumns = logFile.extraColumns; From 43b498e099d804b3c62a4fd4e7acbd41446ce76a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 16 Dec 2022 14:21:02 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mainScript.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mainScript.m b/mainScript.m index e2b5a3d..9c69cd4 100644 --- a/mainScript.m +++ b/mainScript.m @@ -70,7 +70,7 @@ [thisEvent, thisFixation, cfg] = preTrialSetup(cfg, iBlock, iTrial); eyeTracker('Message', cfg, ... - ['start_trial-', num2str(iTrial), '_', thisEvent.trial_type]); + ['start_trial-', num2str(iTrial), '_', thisEvent.trial_type]); % play the dots and collect onset and duraton of the event [onset, duration] = doTrial(cfg, thisEvent, thisFixation); @@ -96,7 +96,7 @@ saveEventsFile('save', cfg, responseEvents); eyeTracker('Message', cfg, ... - ['end_trial-', num2str(iTrial), '_', thisEvent.trial_type]); + ['end_trial-', num2str(iTrial), '_', thisEvent.trial_type]); waitFor(cfg, cfg.timing.ISI); From b857284ee2eeea08237e14fe8d9a9b7022f508a2 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Fri, 16 Dec 2022 18:16:36 +0100 Subject: [PATCH 5/6] Change output dir path to within the experiment folder --- setParameters.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/setParameters.m b/setParameters.m index 04dd784..736ce84 100644 --- a/setParameters.m +++ b/setParameters.m @@ -7,11 +7,12 @@ % Initialize the parameters and general configuration variables cfg = struct(); - % by default the data will be stored in an output folder created where the - % setParamters.m file is - % change that if you want the data to be saved somewhere else + % By default the data will be stored in an output folder created one folder up where the + % setParamters.m file is. with CPP_BIDS 2.3.0 this will change. + % Change that if you want the data to be saved somewhere else, + % below will set it to save the output within the sxperiment folder cfg.dir.output = fullfile( ... - fileparts(mfilename('fullpath')), '..', ... + fileparts(mfilename('fullpath')), ... 'output'); %% Debug mode settings From 4ee6438fafc16886d86fe945b87acada9fa060c2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 16 Dec 2022 17:18:20 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setParameters.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setParameters.m b/setParameters.m index 736ce84..24b0c79 100644 --- a/setParameters.m +++ b/setParameters.m @@ -9,7 +9,7 @@ % By default the data will be stored in an output folder created one folder up where the % setParamters.m file is. with CPP_BIDS 2.3.0 this will change. - % Change that if you want the data to be saved somewhere else, + % Change that if you want the data to be saved somewhere else, % below will set it to save the output within the sxperiment folder cfg.dir.output = fullfile( ... fileparts(mfilename('fullpath')), ...