Skip to content

Commit

Permalink
Merge branch 'bids-standard:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau authored Oct 3, 2024
2 parents d07d898 + 2a7c686 commit 2e7800e
Show file tree
Hide file tree
Showing 30 changed files with 436 additions and 446 deletions.
6 changes: 6 additions & 0 deletions +bids/+internal/list_all_trial_types.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,10 @@
trial_type_list{idx} = [];
end

% n/a not included as trial type
idx = ismember(trial_type_list, 'n/a');
if any(idx)
trial_type_list(idx) = [];
end

end
72 changes: 39 additions & 33 deletions +bids/Model.m
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,45 @@ function write(obj, filename)

end

function validate_constrasts(obj, node)

if ~isfield(node, 'Contrasts')
return
end

for iCon = 1:numel(node.Contrasts)

if ~isfield(node.Contrasts{iCon}, 'Weights')
msg = sprintf('No weights specified for Contrast %s of Node %s', ...
node.Contrasts{iCon}.Name, node.Name);
bids.internal.error_handling(mfilename(), ...
'weightsRequired', ...
msg, ...
obj.tolerant, ...
obj.verbose);
end

switch node.Contrasts{iCon}.Test
case 't'
nb_weights = numel(node.Contrasts{iCon}.Weights);
case 'F'
nb_weights = size(node.Contrasts{iCon}.Weights, 2);
end

if nb_weights ~= numel(node.Contrasts{iCon}.ConditionList)
msg = sprintf('Number of Weights and Conditions unequal for Contrast %s of Node %s', ...
node.Contrasts{iCon}.Name, node.Name);
bids.internal.error_handling(mfilename(), ...
'numelWeightsConditionMismatch', ...
msg, ...
obj.tolerant, ...
obj.verbose);
end

end

end

end

methods (Static)
Expand Down Expand Up @@ -996,39 +1035,6 @@ function write(obj, filename)
end
end

% could be made static
function validate_constrasts(node)

if ~isfield(node, 'Contrasts')
return
end

for iCon = 1:numel(node.Contrasts)

if ~isfield(node.Contrasts{iCon}, 'Weights')
msg = sprintf('No weights specified for Contrast %s of Node %s', ...
node.Contrasts{iCon}.Name, node.Name);
bids.internal.error_handling(mfilename(), ...
'weightsRequired', ...
msg, ...
obj.tolerant, ...
obj.verbose);
end

if numel(node.Contrasts{iCon}.Weights) ~= numel(node.Contrasts{iCon}.ConditionList)
msg = sprintf('Number of Weights and Conditions unequal for Contrast %s of Node %s', ...
node.Contrasts{iCon}.Name, node.Name);
bids.internal.error_handling(mfilename(), ...
'numelWeightsConditionMismatch', ...
msg, ...
obj.tolerant, ...
obj.verbose);
end

end

end

end

methods (Access = protected)
Expand Down
11 changes: 10 additions & 1 deletion +bids/layout.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function handle_invalid_input(ME, root)
bids.internal.is_octave
if ischar(root)
msg = sprintf(['First input argument must be an existing directory.'...
'\nGot: ''%s.'''], root);
'\nGot: "%s".'], root);
bids.internal.error_handling(mfilename(), 'InvalidInput', ...
msg, false);
end
Expand Down Expand Up @@ -395,6 +395,12 @@ function handle_invalid_input(ME, root)
% so the parsing is unconstrained
for iModality = 1:numel(modalities)

% when we go schemaless session level folder
% may get indexed as modality
if bids.internal.starts_with(modalities{iModality}, 'ses-')
continue
end

if isfield(filter, 'modality') && ...
~ismember(modalities{iModality}, filter.modality)
continue
Expand Down Expand Up @@ -836,6 +842,9 @@ function handle_invalid_input(ME, root)
% other is present to help with analysis.
intended = {};
if isfield(metadata, 'IntendedFor')
if isempty(metadata.IntendedFor)
continue
end
intended = cellstr(metadata.IntendedFor);
end

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/run_tests_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ jobs:
sudo apt-get -y -qq update
sudo apt-get -y install unzip wget
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install bids validator
run: npm install -g bids-validator

run: deno install -Agf -n bids-validator jsr:@bids/validator

- name: Install bids example
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/run_tests_octave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ jobs:
sudo apt-get -y -qq update
sudo apt-get -y install unzip wget
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install bids validator
run: npm install -g bids-validator
run: deno install -Agf -n bids-validator jsr:@bids/validator

- name: Install bids-example
run: |
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ jobs:
with:
args: --validate

codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@master

markdown_link_check:
runs-on: ubuntu-latest
steps:
Expand All @@ -37,26 +31,3 @@ jobs:
use-quiet-mode: yes
use-verbose-mode: yes
config-file: .github/workflows/mlc_config.json

miss_hit:
runs-on: ubuntu-latest
strategy:
matrix:
command: [mh_style, mh_metric --ci, mh_lint]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip3 install -r requirements.txt
- name: ${{ matrix.command }}
run: |
${{ matrix.command }}
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: [--config=setup.cfg]
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cff-version: 1.2.0

title: bids-matlab

version: 0.2.0
version: 0.3.0

license: MIT

Expand Down
Loading

0 comments on commit 2e7800e

Please sign in to comment.