From b204b101ea612391c148eab80c7060fadb9d08b5 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Sun, 19 Jul 2020 23:39:32 +0200 Subject: [PATCH 1/3] apply mh_linter autofix --- checkCFG.m | 91 +++++----- createFilename.m | 280 +++++++++++++++---------------- miss_hit.cfg | 3 + saveEventsFile.m | 323 ++++++++++++++++++------------------ tests/runtests.m | 92 +++++----- tests/test_createFilename.m | 122 +++++++------- tests/test_saveEventsFile.m | 113 +++++++------ userInputs.m | 111 ++++++------- 8 files changed, 565 insertions(+), 570 deletions(-) create mode 100644 miss_hit.cfg diff --git a/checkCFG.m b/checkCFG.m index c97834ce..59ea4d15 100644 --- a/checkCFG.m +++ b/checkCFG.m @@ -1,57 +1,56 @@ function [expParameters, cfg] = checkCFG(cfg, expParameters) -% check that we have all the fields that we need in the experiment -% parameters + % check that we have all the fields that we need in the experiment + % parameters -if ~isfield(expParameters, 'verbose') || isempty(expParameters.verbose) - expParameters.verbose = 0; -end + if ~isfield(expParameters, 'verbose') || isempty(expParameters.verbose) + expParameters.verbose = 0; + end -if ~isfield(expParameters, 'outputDir') - expParameters.outputDir = fullfile(... - fileparts(mfilename('fullpath')), ... - '..', ... - 'output'); -end + if ~isfield(expParameters, 'outputDir') + expParameters.outputDir = fullfile( ... + fileparts(mfilename('fullpath')), ... + '..', ... + 'output'); + end -% set empty values for a series of field if they have not been specified -% 'ce' -% 'dir' For BIDS file naming: phase encoding direction of acquisition for fMRI -% 'rec' For BIDS file naming: reconstruction of fMRI images -% 'echo' For BIDS file naming: echo fMRI images -% 'acq' For BIDS file naming: acquisition of fMRI images -% 'subjectGrp' in case no group was provided -% 'sessionNb' in case no session was provided - -fields2Check = { ... - 'ce', ... - 'dir', ... - 'rec', ... - 'echo', ... - 'acq', ... - 'subjectGrp', ... - 'sessionNb'}; - -for iField = 1:numel(fields2Check) - if ~isfield(expParameters, fields2Check{iField}) - expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok + % set empty values for a series of field if they have not been specified + % 'ce' + % 'dir' For BIDS file naming: phase encoding direction of acquisition for fMRI + % 'rec' For BIDS file naming: reconstruction of fMRI images + % 'echo' For BIDS file naming: echo fMRI images + % 'acq' For BIDS file naming: acquisition of fMRI images + % 'subjectGrp' in case no group was provided + % 'sessionNb' in case no session was provided + + fields2Check = { ... + 'ce', ... + 'dir', ... + 'rec', ... + 'echo', ... + 'acq', ... + 'subjectGrp', ... + 'sessionNb'}; + + for iField = 1:numel(fields2Check) + if ~isfield(expParameters, fields2Check{iField}) + expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok + end end -end -% set false value for a series of field if they have not been specified -fields2CheckFalse = { ... - 'eyeTracker' - }; + % set false value for a series of field if they have not been specified + fields2CheckFalse = { ... + 'eyeTracker' + }; -for iField = 1:numel(fields2CheckFalse) - if ~isfield(cfg, fields2CheckFalse{iField}) - cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok + for iField = 1:numel(fields2CheckFalse) + if ~isfield(cfg, fields2CheckFalse{iField}) + cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok + end end -end - -% other defaults -if ~isfield(expParameters, 'askGrpSess') - expParameters.askGrpSess = [true true]; -end + % other defaults + if ~isfield(expParameters, 'askGrpSess') + expParameters.askGrpSess = [true true]; + end end diff --git a/createFilename.m b/createFilename.m index 0ef65a67..ab9f4eda 100644 --- a/createFilename.m +++ b/createFilename.m @@ -1,159 +1,153 @@ function expParameters = createFilename(cfg, expParameters) -% create the BIDS compliant directories and filenames for the behavioral output for this subject / -% session / run using the information from cfg and expParameters. -% Will also create the right filename for the eyetracking data file. -% -% For the moment the date of acquisition is appended to the filename -% -% can work for behavioral experiment if cfg.device is set to 'PC' -% can work for fMRI experiment if cfg.device is set to 'scanner' -% can work for simple eyetracking data if cfg.eyeTracker is set to 1 -% -% BOLD -% sub-