From f2d564da6adb3686101a1a6b5743ad46e7e69b22 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 9 Aug 2023 20:45:25 -0400 Subject: [PATCH 1/3] move space to each action cli --- bidspm.m | 9 +- demos/MoAE/test_moae.m | 5 + src/cli/baseInputParser.m | 1 - src/cli/inputParserForCopy.m | 2 + src/cli/inputParserForCreateModel.m | 1 + src/cli/inputParserForCreateRoi.m | 1 + src/cli/inputParserForPreprocess.m | 2 + src/cli/inputParserForSmooth.m | 2 + src/cli/inputParserForStats.m | 1 + src/messages/bidspmHelp.m | 215 ++++++++++++++++------------ tests/utils/defaultOptions.m | 2 +- 11 files changed, 145 insertions(+), 96 deletions(-) diff --git a/bidspm.m b/bidspm.m index 68d4979fc..4646c639e 100644 --- a/bidspm.m +++ b/bidspm.m @@ -10,13 +10,12 @@ parse(args, varargin{:}); catch ME disp('arguments passed were :'); - varargin{i} for i = 1:numel(varargin) - fprintf(1, '- ') - fprintf(varargin{i}) - fprintf(1, '\n') + fprintf(1, '- '); + fprintf(varargin{i}); + fprintf(1, '\n'); end - fprintf(1, '\n') + fprintf(1, '\n'); rethrow(ME); end diff --git a/demos/MoAE/test_moae.m b/demos/MoAE/test_moae.m index 28d5520f7..bc8c014c8 100644 --- a/demos/MoAE/test_moae.m +++ b/demos/MoAE/test_moae.m @@ -54,6 +54,11 @@ output_dir = fullfile(tempname, 'outputs', 'derivatives'); spm_mkdir(output_dir); + disp(bids_dir); + disp(output_dir); + disp(ignore{iOption}); + disp(space(iOption)); + disp(optionsFile); bidspm(bids_dir, output_dir, 'subject', ... 'participant_label', {'01'}, ... 'action', 'preprocess', ... diff --git a/src/cli/baseInputParser.m b/src/cli/baseInputParser.m index 677b75be5..cace91f09 100644 --- a/src/cli/baseInputParser.m +++ b/src/cli/baseInputParser.m @@ -23,7 +23,6 @@ addParameter(args, 'action', defaultAction, isChar); addParameter(args, 'participant_label', {}, isCellStr); - addParameter(args, 'space', {}, isCellStr); addParameter(args, 'bids_filter_file', struct([]), isFileOrStruct); addParameter(args, 'verbosity', 2, isPositiveScalar); diff --git a/src/cli/inputParserForCopy.m b/src/cli/inputParserForCopy.m index 413f36a9b..13c2daf95 100644 --- a/src/cli/inputParserForCopy.m +++ b/src/cli/inputParserForCopy.m @@ -7,12 +7,14 @@ % (C) Copyright 2023 bidspm developers isLogical = @(x) islogical(x) && numel(x) == 1; isCharOrCellstr = @(x) ischar(x) || iscellstr(x); %#ok<*ISCLSTR> + isCellStr = @(x) iscellstr(x); args = baseInputParser(); % allow unmatched in case this is called from cliSmooth args.KeepUnmatched = true; + addParameter(args, 'space', {}, isCellStr); addParameter(args, 'task', {}, isCharOrCellstr); addParameter(args, 'force', false, isLogical); addParameter(args, 'anat_only', false, isLogical); diff --git a/src/cli/inputParserForCreateModel.m b/src/cli/inputParserForCreateModel.m index 9721ba181..80499b35a 100644 --- a/src/cli/inputParserForCreateModel.m +++ b/src/cli/inputParserForCreateModel.m @@ -9,6 +9,7 @@ isEmptyOrCellstr = @(x) isempty(x) || iscellstr(x); %#ok<*ISCLSTR> + addParameter(args, 'space', {}, isCellStr); addParameter(args, 'task', {}, isEmptyOrCellstr); % :param ignore: Optional. Cell string that can contain: diff --git a/src/cli/inputParserForCreateRoi.m b/src/cli/inputParserForCreateRoi.m index 289f28c31..597a75697 100644 --- a/src/cli/inputParserForCreateRoi.m +++ b/src/cli/inputParserForCreateRoi.m @@ -16,6 +16,7 @@ isCellStr = @(x) iscellstr(x); isLogical = @(x) islogical(x) && numel(x) == 1; + addParameter(args, 'space', {}, isCellStr); addParameter(args, 'roi_dir', '', isDir); addParameter(args, 'preproc_dir', '', isDir); addParameter(args, 'hemisphere', {'L', 'R'}, isCellStr); diff --git a/src/cli/inputParserForPreprocess.m b/src/cli/inputParserForPreprocess.m index cc303f864..2901fcdc2 100644 --- a/src/cli/inputParserForPreprocess.m +++ b/src/cli/inputParserForPreprocess.m @@ -11,7 +11,9 @@ isLogical = @(x) islogical(x) && numel(x) == 1; isEmptyOrCellstr = @(x) isempty(x) || iscellstr(x); %#ok<*ISCLSTR> isEmptyOrisChar = @(x) isempty(x) || ischar(x); %#ok<*ISCLSTR> + isCellStr = @(x) iscellstr(x); + addParameter(args, 'space', {}, isCellStr); addParameter(args, 'task', '', isEmptyOrisChar); addParameter(args, 'fwhm', 6, isPositiveScalar); addParameter(args, 'dry_run', false, isLogical); diff --git a/src/cli/inputParserForSmooth.m b/src/cli/inputParserForSmooth.m index facb1d371..c7e9f2ab4 100644 --- a/src/cli/inputParserForSmooth.m +++ b/src/cli/inputParserForSmooth.m @@ -9,7 +9,9 @@ isPositiveScalar = @(x) isnumeric(x) && numel(x) == 1 && x >= 0; isLogical = @(x) islogical(x) && numel(x) == 1; + isCellStr = @(x) iscellstr(x); + addParameter(args, 'space', {}, isCellStr); addParameter(args, 'fwhm', 6, isPositiveScalar); addParameter(args, 'dry_run', false, isLogical); end diff --git a/src/cli/inputParserForStats.m b/src/cli/inputParserForStats.m index 343a3ffeb..6848e9527 100644 --- a/src/cli/inputParserForStats.m +++ b/src/cli/inputParserForStats.m @@ -16,6 +16,7 @@ isCellStr = @(x) iscellstr(x); isEmptyOrCellstr = @(x) isempty(x) || iscellstr(x); %#ok<*ISCLSTR> + addParameter(args, 'space', {}, isCellStr); addParameter(args, 'task', {}, isCellStr); addParameter(args, 'preproc_dir', pwd, isFolder); addParameter(args, 'model_file', struct([]), isFileOrStructOrIsDir); diff --git a/src/messages/bidspmHelp.m b/src/messages/bidspmHelp.m index 9e99cbc99..59fbe4519 100644 --- a/src/messages/bidspmHelp.m +++ b/src/messages/bidspmHelp.m @@ -17,12 +17,12 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, analysis_level, ... - % 'action', 'some_action', ... - % 'participant_label', {}, ... - % 'space', {'individual', 'IXI549Space'}, ... - % 'bids_filter_file', struct([]), ... - % 'verbosity', 2, ... - % 'options', struct([])) + % 'action', 'some_action', ... + % 'participant_label', {}, ... + % 'space', {'individual', 'IXI549Space'}, ... + % 'bids_filter_file', struct([]), ... + % 'verbosity', 2, ... + % 'options', struct([])) % % % *Obligatory parameters* @@ -50,7 +50,7 @@ function bidspmHelp() % - ``'contrasts'``: runs contrast computation, display results % - ``'results'``: displays results % - ``'bms'``: performs bayesian model selection - % - ``'specify_only'`` only specifies the models + % - ``'specify_only'`` only specifies the models % % % :param participant_label: cell of participants labels. @@ -65,7 +65,8 @@ function bidspmHelp() % :param bids_filter_file: path to JSON file or structure % :type bids_filter_file: path % - % :param verbosity: can be any value between ``0`` and ``3``. Defaults to ``2`` + % :param verbosity: can be any value between ``0`` and ``3``. + % Defaults to ``2`` % :type verbosity: positive integer % % :param options: See the ``checkOptions`` help to see the available options. @@ -84,26 +85,29 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, 'subject', ... - % 'action', 'preprocess', ... - % 'participant_label', {}, ... - % 'task', '', ... - % 'space', {'individual', 'IXI549Space'}, ... - % 'bids_filter_file', struct([]), ... - % 'verbosity', 2, ... - % 'options', struct([]), ... - % 'boilerplate_only', false, ... - % 'dry_run', false, ... - % 'dummy_scans', 0, ... - % 'anat_only', false, ... - % 'ignore', {}, ... - % 'fwhm', 6, ... - % 'skip_validation', false) + % 'action', 'preprocess', ... + % 'participant_label', {}, ... + % 'task', '', ... + % 'space', {'individual', 'IXI549Space'}, ... + % 'bids_filter_file', struct([]), ... + % 'verbosity', 2, ... + % 'options', struct([]), ... + % 'boilerplate_only', false, ... + % 'dry_run', false, ... + % 'dummy_scans', 0, ... + % 'anat_only', false, ... + % 'ignore', {}, ... + % 'fwhm', 6, ... + % 'skip_validation', false) % % % :param boilerplate_only: Only creates dataset description reports. % and methods description. Defaults to ``false``. % :type boilerplate_only: logical % + % :param space: Defaults to ``{}`` + % :type space: cell string + % % :param task: Only a single task can be processed at once. % Defaults to ``''``. % :type task: char @@ -118,7 +122,7 @@ function bidspmHelp() % :type anat_only: logical % % :param ignore: can be any of ``{'fieldmaps', 'slicetiming', 'unwarp', 'qa'}`` - % :type ignore: cell string + % :type ignore: cellstr % % :param fwhm: Smoothing to apply to the preprocessed data. Defaults to ``6``. % :type fwhm: positive scalar @@ -137,17 +141,20 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, 'subject', ... - % 'action', 'copy', ... - % 'participant_label', {}, ... - % 'task', {}, ... - % 'space', {'individual', 'IXI549Space'}, ... - % 'bids_filter_file', struct([]), ... - % 'verbosity', 2, ... - % 'options', struct([]), ... - % 'anat_only', false, ... - % 'force', false) + % 'action', 'copy', ... + % 'participant_label', {}, ... + % 'task', {}, ... + % 'space', {'individual', 'IXI549Space'}, ... + % 'bids_filter_file', struct([]), ... + % 'verbosity', 2, ... + % 'options', struct([]), ... + % 'anat_only', false, ... + % 'force', false) % % + % :param space: Defaults to ``{}`` + % :type space: cell string + % % :param task: Defaults to ``{}`` % :type task: char or cell string % @@ -166,16 +173,19 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, 'subject', ... - % 'action', 'create_roi', ... - % 'participant_label', {}, ... - % 'space', {'MNI'}, ... - % 'bids_filter_file', struct([]), ... - % 'preproc_dir', preproc_dir, ... - % 'verbosity', 2, ... - % 'options', struct([]), ... - % 'roi_atlas', 'wang', ... - % 'roi_name', {'V1v', 'V1d'}, ... - % 'hemisphere', {'L', 'R'}) + % 'action', 'create_roi', ... + % 'participant_label', {}, ... + % 'space', {'MNI'}, ... + % 'bids_filter_file', struct([]), ... + % 'preproc_dir', preproc_dir, ... + % 'verbosity', 2, ... + % 'options', struct([]), ... + % 'roi_atlas', 'wang', ... + % 'roi_name', {'V1v', 'V1d'}, ... + % 'hemisphere', {'L', 'R'}) + % + % :param space: Defaults to ``{}`` + % :type space: cell string % % :param roi_atlas: Can be any of: % - ``'visfatlas'`` @@ -209,15 +219,18 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, 'subject', ... - % 'action', 'smooth', ... - % 'participant_label', {}, ... - % 'task', {}, ... - % 'space', {'individual', 'IXI549Space'}, ... - % 'bids_filter_file', struct([]), ... - % 'options', struct([]), ... - % 'verbosity', 2, ... - % 'fwhm', 6, ... - % 'dry_run', false) + % 'action', 'smooth', ... + % 'participant_label', {}, ... + % 'task', {}, ... + % 'space', {'individual', 'IXI549Space'}, ... + % 'bids_filter_file', struct([]), ... + % 'options', struct([]), ... + % 'verbosity', 2, ... + % 'fwhm', 6, ... + % 'dry_run', false) + % + % :param space: Defaults to ``{}`` + % :type space: cell string % % :param task: Defaults to ``{}`` % :type task: char or cell string @@ -240,16 +253,19 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, 'dataset', ... - % 'action', 'default_model', ... - % 'participant_label', {}, ... - % 'task', {}, ... - % 'space', {'individual', 'IXI549Space'}, ... - % 'bids_filter_file', struct([]), ... - % 'verbosity', 2, ... - % 'options', struct([]), ... - % 'ignore', {}) + % 'action', 'default_model', ... + % 'participant_label', {}, ... + % 'task', {}, ... + % 'space', {'individual', 'IXI549Space'}, ... + % 'bids_filter_file', struct([]), ... + % 'verbosity', 2, ... + % 'options', struct([]), ... + % 'ignore', {}) % % + % :param space: Defaults to ``{}`` + % :type space: cell string + % % :param task: Defaults to ``{}`` % :type task: char or cell string % @@ -271,26 +287,26 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, 'subject', ... - % 'action', 'stats', ... - % 'participant_label', {}, ... - % 'task', {}, ... - % 'space', {'individual', 'IXI549Space'}, ... - % 'bids_filter_file', struct([]), ... - % 'options', struct([]), ..., - % 'verbosity', 2, ... - % 'preproc_dir', preproc_dir, ... - % 'model_file', model_file, ... % specific to stats - % 'fwhm', 6, ... - % 'dry_run', false, ... - % 'boilerplate_only', false, ... - % 'roi_atlas', 'neuromorphometrics', ... - % 'roi_based', false, ... - % 'roi_dir', '', ... - % 'roi_name', {''}, ... - % 'design_only', false, ... - % 'ignore', {}, ... - % 'concatenate', false, ... - % 'skip_validation', false) + % 'action', 'stats', ... + % 'participant_label', {}, ... + % 'task', {}, ... + % 'space', {'individual', 'IXI549Space'}, ... + % 'bids_filter_file', struct([]), ... + % 'options', struct([]), ..., + % 'verbosity', 2, ... + % 'preproc_dir', preproc_dir, ... + % 'model_file', model_file, ... % specific to stats + % 'fwhm', 6, ... + % 'dry_run', false, ... + % 'boilerplate_only', false, ... + % 'roi_atlas', 'neuromorphometrics', ... + % 'roi_based', false, ... + % 'roi_dir', '', ... + % 'roi_name', {''}, ... + % 'design_only', false, ... + % 'ignore', {}, ... + % 'concatenate', false, ... + % 'skip_validation', false) % % % *Obligatory parameters* @@ -307,18 +323,20 @@ function bidspmHelp() % Before running Bayesion model selection on them. % :type model_file: path to JSON file or dir or structure % + % :param space: Defaults to ``{}`` + % :type space: cell string + % % % *Optional parameters* % - % :param fwhm: smoothing lelvel of the preprocessed data + % :param fwhm: smoothing level of the preprocessed data % :type fwhm: positive scalar % % :param design_only: to only run the model specification % :type design_only: logical % % :param ignore: can be any of ``{'qa'}``, to skip - % quality controls or contanetation of beta images - % into a single 4D image. + % quality controls into a single 4D image. % :type ignore: cell string % % :param concatenate: will contatenate the beta images of the @@ -331,13 +349,14 @@ function bidspmHelp() % :param roi_atlas: Name of the atlas to use to label activations in MNI space. % :type roi_atlas: char % - % :param roi_based: + % :param roi_based: Set to ``true`` to run a ROI-based analysis. + % Defaults to ``false``. % :type roi_based: logical % - % :param roi_dir: + % :param roi_dir: Path to the directory containing the ROIs. % :type roi_dir: path % - % :param roi_name: + % :param roi_name: Names or regex expression of the ROI to use. % :type roi_name: cell string % % :param boilerplate_only: Only creates dataset description reports. @@ -351,9 +370,8 @@ function bidspmHelp() % .. code-block:: matlab % % bidspm(bids_dir, output_dir, 'subject', ... - % 'action', 'stats', ... + % 'action', 'bms', ... % 'participant_label', {}, ... - % 'space', {'individual', 'IXI549Space'}, ... % 'options', struct([]), ..., % 'verbosity', 2, ... % 'models_dir', models_dir, ... @@ -362,13 +380,32 @@ function bidspmHelp() % 'skip_validation', false) % % :param models_dir: A path to a dir can be passed as well. - % In this case all *_smdl.json files will be used + % In this case all ``*_smdl.json`` files will be used % and looped over. % + % :param dry_run: Defaults to ``false``. + % :type dry_run: logical + % + % :param fwhm: smoothing level of the preprocessed data + % :type fwhm: positive scalar + % % .. note:: % % For the bayesian model selection to function - % you must first specify all your models using the ``'specify_only'`` action. + % you must first specify all your models using the ``'specify_only'`` action + % with the options ``useDummyRegressor = true``. + % + % .. code-block:: matlab + % + % opt.glm.useDummyRegressor = true; + % + % bidspm(bids_dir, output_dir, 'subject', ... + % 'participant_label', participant_label, ... + % 'action', 'specify_only', ... + % 'preproc_dir', preproc_dir, ... + % 'model_file', models_dir, ... + % 'fwhm', FWHM, ... + % 'options', opt); % % % **low level calls** diff --git a/tests/utils/defaultOptions.m b/tests/utils/defaultOptions.m index 87ea4dde0..c73849dc5 100644 --- a/tests/utils/defaultOptions.m +++ b/tests/utils/defaultOptions.m @@ -29,7 +29,7 @@ expectedOptions.anatOnly = false; - expectedOptions.space = {'individual' 'IXI549Space'}; + expectedOptions.space = {'individual', 'IXI549Space'}; expectedOptions.useBidsSchema = false; From 3792d2866bd283254d5bbccae8b965d700905c64 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 9 Aug 2023 21:34:50 -0400 Subject: [PATCH 2/3] add use_dummy_regressor arg --- demos/bayes/ds000114_run.m | 2 +- src/cli/cliCreateRoi.m | 2 +- src/cli/cliPreprocess.m | 2 +- src/cli/cliStats.m | 2 +- src/cli/getOptionsFromCliArgument.m | 5 ++++- src/cli/inputParserForCreateModel.m | 1 + src/cli/inputParserForSmooth.m | 2 -- src/cli/inputParserForStats.m | 1 + src/defaults/checkOptions.m | 4 ++-- src/messages/bidspmHelp.m | 18 +++++++++++------- src/workflows/bidsReport.m | 2 +- 11 files changed, 24 insertions(+), 17 deletions(-) diff --git a/demos/bayes/ds000114_run.m b/demos/bayes/ds000114_run.m index 7bae78da0..6a53031de 100644 --- a/demos/bayes/ds000114_run.m +++ b/demos/bayes/ds000114_run.m @@ -17,7 +17,7 @@ FWHM = 8; % to run on fewer subjects -TESTING = false; +TESTING = true; % The directory where the data are located root_dir = fileparts(mfilename('fullpath')); diff --git a/src/cli/cliCreateRoi.m b/src/cli/cliCreateRoi.m index f3f1a60f7..ddf16c02d 100644 --- a/src/cli/cliCreateRoi.m +++ b/src/cli/cliCreateRoi.m @@ -18,7 +18,7 @@ function cliCreateRoi(varargin) 'pipelineType', 'create_roi', ... 'verbosity', 0); - if opt.boilerplate_only + if opt.boilerplateOnly return end diff --git a/src/cli/cliPreprocess.m b/src/cli/cliPreprocess.m index ef2590384..ae6301983 100644 --- a/src/cli/cliPreprocess.m +++ b/src/cli/cliPreprocess.m @@ -37,7 +37,7 @@ function cliPreprocess(varargin) 'outputPath', fullfile(opt.dir.output, 'reports'), ... 'pipelineType', 'preprocess', ... 'verbosity', 0); - if opt.boilerplate_only + if opt.boilerplateOnly return end diff --git a/src/cli/cliStats.m b/src/cli/cliStats.m index c179678fa..fd987943a 100644 --- a/src/cli/cliStats.m +++ b/src/cli/cliStats.m @@ -58,7 +58,7 @@ function cliStats(varargin) 'outputPath', fullfile(opt.dir.output, 'reports'), ... 'pipelineType', 'stats', ... 'verbosity', 0); - if opt.boilerplate_only + if opt.boilerplateOnly continue end diff --git a/src/cli/getOptionsFromCliArgument.m b/src/cli/getOptionsFromCliArgument.m index 541bd05f9..6b6a76275 100644 --- a/src/cli/getOptionsFromCliArgument.m +++ b/src/cli/getOptionsFromCliArgument.m @@ -40,7 +40,7 @@ end if isfield(args.Results, 'boilerplate_only') - opt.boilerplate_only = args.Results.boilerplate_only; + opt.boilerplateOnly = args.Results.boilerplate_only; end if isfield(args.Results, 'dry_run') @@ -198,6 +198,9 @@ end function opt = overrideSpace(opt, args) + if ~isfield(args.Results, 'space') + return + end if ~isempty(args.Results.space) if isfield(opt, 'space') && ~all(ismember(args.Results.space, opt.space)) overrideMsg('space', convertToString(args.Results.space), ... diff --git a/src/cli/inputParserForCreateModel.m b/src/cli/inputParserForCreateModel.m index 80499b35a..c3a8b64b2 100644 --- a/src/cli/inputParserForCreateModel.m +++ b/src/cli/inputParserForCreateModel.m @@ -8,6 +8,7 @@ args = baseInputParser(); isEmptyOrCellstr = @(x) isempty(x) || iscellstr(x); %#ok<*ISCLSTR> + isCellStr = @(x) iscellstr(x); addParameter(args, 'space', {}, isCellStr); addParameter(args, 'task', {}, isEmptyOrCellstr); diff --git a/src/cli/inputParserForSmooth.m b/src/cli/inputParserForSmooth.m index c7e9f2ab4..facb1d371 100644 --- a/src/cli/inputParserForSmooth.m +++ b/src/cli/inputParserForSmooth.m @@ -9,9 +9,7 @@ isPositiveScalar = @(x) isnumeric(x) && numel(x) == 1 && x >= 0; isLogical = @(x) islogical(x) && numel(x) == 1; - isCellStr = @(x) iscellstr(x); - addParameter(args, 'space', {}, isCellStr); addParameter(args, 'fwhm', 6, isPositiveScalar); addParameter(args, 'dry_run', false, isLogical); end diff --git a/src/cli/inputParserForStats.m b/src/cli/inputParserForStats.m index 6848e9527..252341399 100644 --- a/src/cli/inputParserForStats.m +++ b/src/cli/inputParserForStats.m @@ -29,6 +29,7 @@ addParameter(args, 'design_only', false, isLogical); addParameter(args, 'concatenate', false, isLogical); addParameter(args, 'keep_residuals', false, isLogical); + addParameter(args, 'use_dummy_regressor', false, isLogical); addParameter(args, 'roi_atlas', 'neuromorphometrics', isInAvailableAtlas); diff --git a/src/defaults/checkOptions.m b/src/defaults/checkOptions.m index 5c8ea1881..a46797d23 100644 --- a/src/defaults/checkOptions.m +++ b/src/defaults/checkOptions.m @@ -65,7 +65,7 @@ % - ``opt.pipeline.isBms`` whether this is a bayesion model selection % pipeline % - % - ``opt.boilerplate_only = false`` - + % - ``opt.boilerplateOnly = false`` - % If set to ``true`` only creates dataset description reports and methods description. % Overwrites previous versions. % @@ -267,7 +267,7 @@ fieldsToSet.pipeline.name = 'bidspm'; fieldsToSet.pipeline.isBms = false; - fieldsToSet.boilerplate_only = false; + fieldsToSet.boilerplateOnly = false; fieldsToSet.useBidsSchema = false; diff --git a/src/messages/bidspmHelp.m b/src/messages/bidspmHelp.m index 59fbe4519..e0b491eda 100644 --- a/src/messages/bidspmHelp.m +++ b/src/messages/bidspmHelp.m @@ -306,6 +306,7 @@ function bidspmHelp() % 'design_only', false, ... % 'ignore', {}, ... % 'concatenate', false, ... + % 'use_dummy_regressor', false) % 'skip_validation', false) % % @@ -359,9 +360,12 @@ function bidspmHelp() % :param roi_name: Names or regex expression of the ROI to use. % :type roi_name: cell string % - % :param boilerplate_only: Only creates dataset description reports. - % and methods description. Defaults to ``false``. - % :type boilerplate_only: logical + % :param boilerplate_only: Only creates dataset description reports. + % and methods description. Defaults to ``false``. + % :type boilerplate_only: ogical + % + % :param use_dummy_regressor: Defaults to ``false``. + % :type use_dummy_regressor: logical % % % @@ -393,7 +397,7 @@ function bidspmHelp() % % For the bayesian model selection to function % you must first specify all your models using the ``'specify_only'`` action - % with the options ``useDummyRegressor = true``. + % with the options ``'use_dummy_regressor', true``. % % .. code-block:: matlab % @@ -401,11 +405,11 @@ function bidspmHelp() % % bidspm(bids_dir, output_dir, 'subject', ... % 'participant_label', participant_label, ... - % 'action', 'specify_only', ... % 'preproc_dir', preproc_dir, ... + % 'action', 'specify_only', ... % 'model_file', models_dir, ... - % 'fwhm', FWHM, ... - % 'options', opt); + % 'use_dummy_regressor', true + % 'fwhm', FWHM); % % % **low level calls** diff --git a/src/workflows/bidsReport.m b/src/workflows/bidsReport.m index 818c0e4ba..143df54b5 100644 --- a/src/workflows/bidsReport.m +++ b/src/workflows/bidsReport.m @@ -22,7 +22,7 @@ function bidsReport(opt) opt.pipeline.type = 'preproc'; - if ~opt.boilerplate_only && ... + if ~opt.boilerplateOnly && ... isdir(fullfile(opt.dir.output, 'reports')) logger('INFO', 'Dataset reports already exist.', ... 'options', opt, ... From 71a93392a6d6e24c20b8600081db57ce09dd97b2 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 9 Aug 2023 22:01:26 -0400 Subject: [PATCH 3/3] [DATALAD] Recorded changes --- .github/workflows/system_tests_bms.m | 12 ++++ .github/workflows/tests_bayes.yml | 87 ++++++++++++++++++++++++++++ src/messages/bidspmHelp.m | 4 +- 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/system_tests_bms.m create mode 100644 .github/workflows/tests_bayes.yml diff --git a/.github/workflows/system_tests_bms.m b/.github/workflows/system_tests_bms.m new file mode 100644 index 000000000..6093cb191 --- /dev/null +++ b/.github/workflows/system_tests_bms.m @@ -0,0 +1,12 @@ +% +% (C) Copyright 2023 bidspm developers + +root_dir = getenv('GITHUB_WORKSPACE'); + +fprintf('\nroot dir is %s\n', root_dir); + +addpath(fullfile(root_dir, 'spm12')); + +cd(fullfile(root_dir, 'demos', 'bayes')); + +run ds000114_run; diff --git a/.github/workflows/tests_bayes.yml b/.github/workflows/tests_bayes.yml new file mode 100644 index 000000000..d28f736f8 --- /dev/null +++ b/.github/workflows/tests_bayes.yml @@ -0,0 +1,87 @@ +--- +name: tests bayesian model selection + +# Uses the cron schedule for github actions +# +# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events +# +# ┌───────────── minute (0 - 59) +# │ ┌───────────── hour (0 - 23) +# │ │ ┌───────────── day of the month (1 - 31) +# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) +# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) +# │ │ │ │ │ +# │ │ │ │ │ +# │ │ │ │ │ +# * * * * * + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: 0 0 1,15 * * + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + + tests: + + if: github.repository_owner == 'cpp-lln-lab' + + runs-on: ubuntu-latest + + steps: + + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + sudo apt-get -y -qq update + sudo apt-get install -y git-annex + python -m pip install --upgrade pip setuptools + pip install datalad + + - name: Get data + run: make -C demos/bayes data_ds000114 + + - name: Clone bidspm + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + + - name: Install validators + run: make install + + - name: Install SPM + run: | + git clone https://github.com/spm/spm12.git --depth 1 + + - name: Copy Macs toolbox to SPM inputs_folder + run: cp -rv lib/MACS spm12/toolbox/MACS + + - name: Install MATLAB + uses: matlab-actions/setup-matlab@v1.2.4 + with: + release: R2022b + + - name: Run system tests MATLAB BMS + uses: matlab-actions/run-command@v1.2.1 + with: + command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run system_tests_bms}; diff --git a/src/messages/bidspmHelp.m b/src/messages/bidspmHelp.m index e0b491eda..143be4009 100644 --- a/src/messages/bidspmHelp.m +++ b/src/messages/bidspmHelp.m @@ -364,7 +364,9 @@ function bidspmHelp() % and methods description. Defaults to ``false``. % :type boilerplate_only: ogical % - % :param use_dummy_regressor: Defaults to ``false``. + % :param use_dummy_regressor: If true any missing condition will be modelled + % by a dummy regressor of ``NaN``. + % Defaults to ``false``. % :type use_dummy_regressor: logical % %