Skip to content

Commit

Permalink
reduce amount of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Mar 24, 2024
1 parent af7d437 commit a18c50e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion +bids/+internal/return_subject_index.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@

sub_idx = strcmp(['sub-' sub], {BIDS.subjects.name}');

ses_idx = true(size(sub_idx));
if isfield(parsed_file.entities, 'ses')
ses = parsed_file.entities.ses;
ses_idx = strcmp(['ses-' ses], {BIDS.subjects.session}');
else
% in case we have modality on same level as sessions
ses_idx = cellfun('isempty', {BIDS.subjects.session})';
end

sub_idx = find(all([sub_idx, ses_idx], 2));
Expand Down
3 changes: 3 additions & 0 deletions tests/tests_layout/test_layout_derivatives.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ function test_layout_modality_same_level_sessions()
'use_schema', false, ...
'filter', struct('sub', {{'01', '02', '03'}}), ...
'index_dependencies', true);

% the name won't be accurate
% because the filenames will still contain the ses entity
for i = 1:3
copyfile(fullfile(pth_bids_example, sprintf('sub-%02.0f', i), 'ses-01', 'func'), ...
fullfile(pth_bids_example, sprintf('sub-%02.0f', i), 'func'));
Expand Down

0 comments on commit a18c50e

Please sign in to comment.