Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ before_script:
- cd tests

script:
- octave $OCTFLAGS --eval "results = runtests; assert(all(~[results.Failed]))"
- octave $OCTFLAGS --eval "results = runTests; assert(all(~[results.Failed]))"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [Contributing](#contributing)
- [Guidestyle](#guidestyle)
- [BIDS naming convention](#bids-naming-convention)
- [Contributors ✨](#contributors-)

<!-- /TOC -->

Expand Down Expand Up @@ -184,7 +185,8 @@ Feel free to open issues to report a bug and ask for improvements.
### Guidestyle

- We use camelCase.
- We keep the McCabe complexity as reported by the [check_my_code function](https://github.com/Remi-Gau/matlab_checkcode) below 15.
- We keep the McCabe complexity as reported by the [check_my_code function](https://github.com/Remi-Gau/check_my_code) below 15.
- We use the [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) to automatically fix some linting issues.

### BIDS naming convention

Expand Down
91 changes: 45 additions & 46 deletions checkCFG.m
Original file line number Diff line number Diff line change
@@ -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<SFLD>
% 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<SFLD>
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<SFLD>
for iField = 1:numel(fields2CheckFalse)
if ~isfield(cfg, fields2CheckFalse{iField})
cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok<SFLD>
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
Loading