Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINT] pre-release 0.2.0 #647

Merged
merged 511 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
511 commits
Select commit Hold shift + click to select a range
8df1514
add transformers to label and merge identical rows
Remi-Gau Jul 9, 2022
f565169
update doc
Remi-Gau Jul 9, 2022
986ff44
refactor
Remi-Gau Jul 9, 2022
40ee8d5
add cumulative behavior to label indentical rows
Remi-Gau Jul 9, 2022
06c36d3
refactor
Remi-Gau Jul 9, 2022
915d96f
expand behavior of label rows to support cell type for columns
Remi-Gau Jul 9, 2022
05ae9db
add tests for merge rows
Remi-Gau Jul 9, 2022
d35add1
FCI
Remi-Gau Jul 9, 2022
09242b9
FCI
Remi-Gau Jul 9, 2022
c681278
add inequality to Filter transformer
Remi-Gau Jul 9, 2022
bae2dcf
support regex for Replace transformers
Remi-Gau Jul 10, 2022
b26cc6e
update docs
Remi-Gau Jul 10, 2022
9d6c44c
refactor
Remi-Gau Jul 10, 2022
be54d8e
add possibility to generate json version of transformers
Remi-Gau Jul 10, 2022
f31c37c
add demo transformers split by trials
Remi-Gau Jul 10, 2022
4ab0b05
update help sections
Remi-Gau Jul 10, 2022
1be0891
Merge branch 'master' of https://github.com/bids-standard/bids-matlab…
Remi-Gau Jul 11, 2022
f0f1151
update code to adapt to new schema
Remi-Gau Jul 11, 2022
76566e8
Merge pull request #405 from Remi-Gau/transformers
Remi-Gau Jul 20, 2022
0920ee7
Merge branch 'master' into dev
Remi-Gau Jul 29, 2022
43db3c9
Merge branch 'master' of https://github.com/bids-standard/bids-matlab…
Remi-Gau Jul 29, 2022
41e0369
fix entity order bug
Remi-Gau Jul 29, 2022
9ca332c
return only one datatypes when they are duplicates
Remi-Gau Jul 29, 2022
bee24df
set file modality in constructor
Remi-Gau Jul 30, 2022
f84af1a
Merge pull request #410 from Remi-Gau/dev
Remi-Gau Jul 30, 2022
1b64b9a
get definition will look into metadata if it returns empty in colums
Remi-Gau Jul 30, 2022
4d51f5f
Merge branch 'dev' of https://github.com/bids-standard/bids-matlab in…
Remi-Gau Jul 30, 2022
a9b90af
Merge branch 'master' into dev
Remi-Gau Aug 24, 2022
fb0b0fe
rm old CI
Remi-Gau Aug 24, 2022
bb054e9
remove labels from dependabot config
Remi-Gau Aug 24, 2022
c08206f
fix test that delete schema
Remi-Gau Aug 24, 2022
5d020cd
Merge branch 'master' into dev
Remi-Gau Aug 24, 2022
ac3fe46
Merge branch 'master' into dev
Remi-Gau Aug 29, 2022
876216a
make layout more verbose
Remi-Gau Sep 7, 2022
8aae022
make layout more versbose and make warning mosre useful
Remi-Gau Sep 7, 2022
4fe38b0
only display a . for actually indexed modality
Remi-Gau Sep 8, 2022
127f854
fix octave bug
Remi-Gau Sep 8, 2022
0b11d06
Merge pull request #422 from bids-standard/layout
Remi-Gau Sep 8, 2022
b2b3fd9
Merge branch 'master' into dev
Remi-Gau Sep 9, 2022
d6a31bd
add function to create basic participant.tsv
Remi-Gau Sep 9, 2022
cb102b0
silence warning test for octave
Remi-Gau Sep 9, 2022
5ee025c
Merge pull request #426 from Remi-Gau/participants
Remi-Gau Sep 9, 2022
21a9a9e
make query warning more explicit
Remi-Gau Sep 10, 2022
6fdd553
add extra model validation
Remi-Gau Sep 10, 2022
70c3d28
revert 21a9a9e
Remi-Gau Sep 10, 2022
c450a75
retry more informative error on metadata query
Remi-Gau Sep 10, 2022
bfb599a
remove some old copyrights
Remi-Gau Sep 11, 2022
87e12f3
fix conflicts
Remi-Gau Oct 6, 2022
8187921
lint
Remi-Gau Oct 6, 2022
7bf2f5b
Merge remote-tracking branch 'upstream/master' into dev
Remi-Gau Oct 12, 2022
fc490f5
use new copyright format
Remi-Gau Oct 12, 2022
66913ef
Merge pull request #439 from Remi-Gau/doc
Remi-Gau Oct 12, 2022
255ff04
Merge remote-tracking branch 'upstream/master' into dev
Remi-Gau Oct 17, 2022
53f17e3
update doc
Remi-Gau Oct 21, 2022
8104704
Merge pull request #444 from Remi-Gau/infra
Remi-Gau Oct 21, 2022
af46a92
Merge pull request #378 from bids-standard/demo_File
Remi-Gau Oct 21, 2022
9a97eed
Merge remote-tracking branch 'upstream/master' into dev
Remi-Gau Oct 21, 2022
42805c6
Merge branch 'master' into dev
Remi-Gau Oct 21, 2022
5f0030d
bring back images for contributing
Remi-Gau Oct 21, 2022
45aba5e
fix typo
Remi-Gau Oct 21, 2022
1e95e53
update demos
Remi-Gau Oct 22, 2022
2ef284e
update notebooks and convert to matlab scripts
Remi-Gau Oct 22, 2022
b0b1a83
update notebooks
Remi-Gau Oct 22, 2022
76ba0bd
add test workflow
Remi-Gau Oct 22, 2022
2ba64b4
FCI
Remi-Gau Oct 22, 2022
2d1f964
FCI
Remi-Gau Oct 22, 2022
87b5fdc
fix notebooks
Remi-Gau Oct 22, 2022
35e3f6f
Update demos/working_with_files.m
Remi-Gau Oct 22, 2022
1c6ccb9
update doc
Remi-Gau Oct 22, 2022
579fcec
FCI
Remi-Gau Oct 22, 2022
e584f45
switch back to isdir to see if older octave is happier with this
Remi-Gau Oct 22, 2022
a0f08fe
Merge pull request #447 from Remi-Gau/doc
Remi-Gau Oct 22, 2022
d06a8ad
Merge remote-tracking branch 'origin/master' into dev
Remi-Gau Oct 29, 2022
2235c70
Merge branch 'master' into dev
Remi-Gau Oct 29, 2022
80f3bb9
Merge branch 'master' into dev
Remi-Gau Oct 29, 2022
926f94f
update README
Remi-Gau Oct 29, 2022
622f70c
Merge branch 'master' into dev
Remi-Gau Oct 30, 2022
9347215
update create participants.tsv
Remi-Gau Oct 30, 2022
dba140b
update image path
Remi-Gau Oct 30, 2022
94df0a2
Merge branch 'master' into dev
Remi-Gau Nov 3, 2022
06f2b8e
fix copyright line skip
Remi-Gau Nov 3, 2022
3efc8a9
Merge remote-tracking branch 'upstream/master' into dev
Remi-Gau Nov 4, 2022
711f546
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 4, 2022
bbe75d5
fix spelling
Remi-Gau Nov 4, 2022
396a5bd
Merge remote-tracking branch 'origin/update' into update
Remi-Gau Nov 4, 2022
435e03f
fix report tests
Remi-Gau Nov 4, 2022
453230e
Merge pull request #459 from Remi-Gau/update
Remi-Gau Nov 4, 2022
f46e708
Merge branch 'master' into dev
Remi-Gau Nov 7, 2022
9c4452c
update create participants
Remi-Gau Nov 7, 2022
de43a2b
add create session tsv
Remi-Gau Nov 7, 2022
758cf57
fix test
Remi-Gau Nov 7, 2022
e9bcc02
update test
Remi-Gau Nov 7, 2022
630e3d0
update bids init
Remi-Gau Nov 7, 2022
46825c0
refactor create readme
Remi-Gau Nov 7, 2022
1723656
update create readme
Remi-Gau Nov 7, 2022
9230720
add extra columns sessions.tsv
Remi-Gau Nov 7, 2022
5fe0357
add doc arguments
Remi-Gau Nov 7, 2022
2395fd6
lint
Remi-Gau Nov 7, 2022
07f915d
improve test and messages
Remi-Gau Nov 7, 2022
b35592b
fix some test
Remi-Gau Nov 7, 2022
1907640
exclude some files from scans.tsv
Remi-Gau Nov 7, 2022
ed09c9b
refactor tests
Remi-Gau Nov 7, 2022
d2ad5e5
fix octave warning
Remi-Gau Nov 7, 2022
25b9b69
silence warning test on octave
Remi-Gau Nov 7, 2022
9631f4a
skip bids validation with octave for now
Remi-Gau Nov 8, 2022
c0c94a4
skip failing matlab test
Remi-Gau Nov 8, 2022
2b9c711
simplify test
Remi-Gau Nov 8, 2022
4cc8232
windows related fixes
Remi-Gau Nov 8, 2022
8a0071b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 8, 2022
2825fe1
Merge branch 'dev' into win_fix
Remi-Gau Nov 8, 2022
20a664a
Merge pull request #466 from Remi-Gau/win_fix
Remi-Gau Nov 8, 2022
66938e8
skip octave test
Remi-Gau Nov 8, 2022
d1615ae
Merge pull request #463 from Remi-Gau/update_dataset
Remi-Gau Nov 8, 2022
71f9212
Merge remote-tracking branch 'upstream/master' into dev
Remi-Gau Nov 8, 2022
f49f6e5
Merge remote-tracking branch 'upstream/master' into dev
Remi-Gau Nov 8, 2022
7bec8ca
improve error message
Remi-Gau Nov 8, 2022
1dc1874
fix octave test
Remi-Gau Nov 8, 2022
e9c47a4
Merge pull request #472 from bids-standard/error_msg
Remi-Gau Nov 9, 2022
de0db63
Merge branch 'master' into dev
Remi-Gau Nov 11, 2022
dd57984
fix listing of trial types
Remi-Gau Nov 13, 2022
bb5bd3a
improve default stats model when no task present
Remi-Gau Nov 13, 2022
4de02a1
silence test for warning under octave
Remi-Gau Nov 13, 2022
03b4077
Merge pull request #481 from bids-standard/list_trial_types
Remi-Gau Nov 13, 2022
74a7441
fix creation of json for derivatives when entity labels are numbers
Remi-Gau Nov 13, 2022
e9b108b
make download more robust
Remi-Gau Nov 13, 2022
257cafc
Merge pull request #484 from bids-standard/download
Remi-Gau Nov 13, 2022
e308d98
skip warning test for octave
Remi-Gau Nov 13, 2022
34d788e
Merge pull request #483 from bids-standard/derivatives
Remi-Gau Nov 13, 2022
72482a5
reformat windows path when printing to avoiding escaped characters wa…
Remi-Gau Nov 14, 2022
61f93e8
improve error message on query
Remi-Gau Nov 14, 2022
74bfd79
Merge remote-tracking branch 'origin/master' into win_path
Remi-Gau Nov 14, 2022
0f63858
Merge pull request #486 from bids-standard/win_path
Remi-Gau Nov 14, 2022
9b2db3f
fix create sessions and participants tsv
Remi-Gau Nov 16, 2022
9e0bd90
Merge pull request #487 from bids-standard/init_ses
Remi-Gau Nov 16, 2022
1876925
add potential datalad related hints when file writing fails
Remi-Gau Nov 17, 2022
157b2f7
Merge branch 'dev' into dev
Remi-Gau Nov 18, 2022
16c3c98
Merge pull request #488 from Remi-Gau/dev
Remi-Gau Nov 19, 2022
accfcc2
fix typo
Remi-Gau Nov 24, 2022
048c319
Merge remote-tracking branch 'origin/master' into typo
Remi-Gau Nov 24, 2022
6336a63
Merge pull request #491 from bids-standard/typo
Remi-Gau Nov 25, 2022
532a414
improve error message
Remi-Gau Nov 27, 2022
7fbd803
silence codespell
Remi-Gau Nov 27, 2022
ff52332
silence octave warning
Remi-Gau Dec 9, 2022
842673a
Merge branch 'new' into dev
Remi-Gau Dec 9, 2022
fd74a5b
Merge pull request #497 from bids-standard/master
Remi-Gau Dec 10, 2022
e8e006d
improve transformers
Remi-Gau Dec 13, 2022
83df308
Merge pull request #498 from bids-standard/trans
Remi-Gau Dec 13, 2022
857d13d
Merge remote-tracking branch 'origin/master' into dev
Remi-Gau Dec 26, 2022
0c27e2b
add response time histogram
Remi-Gau Dec 26, 2022
0f3491d
add get root node method
Remi-Gau Dec 26, 2022
bf34c36
refactor
Remi-Gau Dec 26, 2022
a0ac85c
use bids stats model to plot events
Remi-Gau Dec 26, 2022
e9f440f
fix code spell and octave bug
Remi-Gau Dec 26, 2022
f3689ec
fix miss hit config
Remi-Gau Dec 26, 2022
87f6c1d
remove comment
Remi-Gau Dec 27, 2022
f7bb51d
fix download face rep dataset
Remi-Gau Dec 12, 2022
d4fc82b
better handle datalad datasets
Remi-Gau Dec 27, 2022
15f174b
validate folder name in bids.init
Remi-Gau Dec 27, 2022
59bfe8e
fix cell indexing
Remi-Gau Dec 27, 2022
db65388
Merge pull request #503 from Remi-Gau/init
Remi-Gau Dec 27, 2022
21dbca5
Merge pull request #502 from Remi-Gau/datalad
Remi-Gau Dec 27, 2022
782a67e
fix cell indexing
Remi-Gau Dec 27, 2022
4570d92
update doc
Remi-Gau Dec 27, 2022
eabf771
Merge pull request #501 from bids-standard/events
Remi-Gau Dec 27, 2022
ceca48c
add diagnostic for events
Remi-Gau Dec 29, 2022
96929de
improve figure saving
Remi-Gau Dec 29, 2022
fa601d8
update doc
Remi-Gau Dec 29, 2022
61e8ac2
Merge pull request #504 from Remi-Gau/events_diag
Remi-Gau Dec 29, 2022
0984d59
rename transformers tests
Remi-Gau Jan 5, 2023
b946fc9
refactor tests
Remi-Gau Jan 5, 2023
a9b572a
silence writing tranformers test definitions
Remi-Gau Jan 5, 2023
5ac8db0
move logical operation as compute opertion
Remi-Gau Jan 5, 2023
0480e5e
update transformer test description
Remi-Gau Jan 5, 2023
f2730dd
update facerep
Remi-Gau Jan 6, 2023
b245358
Merge pull request #506 from Remi-Gau/transformer_rules
Remi-Gau Jan 6, 2023
0049c4f
Merge pull request #507 from bids-standard/facerep
Remi-Gau Jan 6, 2023
2eaeb13
add versbosity options to reports
Remi-Gau Jan 18, 2023
ec93e35
Merge branch 'master' into dev
Remi-Gau Jan 18, 2023
a53fcba
add flag to all figures
Remi-Gau Jan 18, 2023
46d1ab6
Merge pull request #509 from bids-standard/silence
Remi-Gau Jan 18, 2023
e2029f4
add filter to layout to only index certain subjects, sessions, modali…
Remi-Gau Jan 22, 2023
0855b9a
use filtering of layout
Remi-Gau Jan 22, 2023
9e05c94
fix when no filter
Remi-Gau Jan 22, 2023
bbfb6c8
use regexp
Remi-Gau Jan 22, 2023
d67d110
fix when to use regex
Remi-Gau Jan 22, 2023
3dfba0c
Merge pull request #510 from bids-standard/filter_layout
Remi-Gau Jan 22, 2023
f229144
Merge pull request #517 from bids-standard/master
Remi-Gau Feb 7, 2023
ce73cd4
improve octave support of transformers
Remi-Gau Feb 15, 2023
d40284e
rm some tests skip for octave
Remi-Gau Feb 15, 2023
f41f194
stop using moxunit
Remi-Gau Feb 15, 2023
de3a626
refactor ci
Remi-Gau Feb 15, 2023
6d3ea1d
change action version
Remi-Gau Feb 15, 2023
1f3f341
use bids validator with octave
Remi-Gau Feb 15, 2023
ddb2c38
fix octace in ci
Remi-Gau Feb 15, 2023
d7f58cc
add JSONio to octave path
Remi-Gau Feb 15, 2023
8894627
add quotes
Remi-Gau Feb 15, 2023
573513a
fiw path
Remi-Gau Feb 15, 2023
6128c75
fix path
Remi-Gau Feb 15, 2023
8b54fde
fix dead links
Remi-Gau Feb 15, 2023
f60c4d8
fix links
Remi-Gau Feb 15, 2023
292ab4a
Merge pull request #518 from bids-standard/test_octave
Remi-Gau Feb 15, 2023
c50ffb0
update download
Remi-Gau Feb 15, 2023
97b7491
Merge branch 'dev' into download
Remi-Gau Feb 15, 2023
ef50a98
Merge pull request #519 from bids-standard/download
Remi-Gau Feb 16, 2023
1a08a28
Merge remote-tracking branch 'upstream/master' into dev
Remi-Gau Mar 28, 2023
0b2c956
update precommit
Remi-Gau Mar 28, 2023
3a86a3b
Merge pull request #530 from Remi-Gau/update_dev
Remi-Gau Mar 28, 2023
d92a869
fix tests
Remi-Gau Mar 28, 2023
de1c6d4
Merge pull request #531 from Remi-Gau/fix-schema_dev
Remi-Gau Mar 28, 2023
d4a6637
make transformer more tolerant when filtering variable is missing
Remi-Gau Mar 28, 2023
c32a98b
Merge pull request #532 from bids-standard/fix-filter_transformer
Remi-Gau Mar 29, 2023
adbd3c1
[DOC] update bids.layout doc and return_file_index error message (#539)
Remi-Gau Apr 20, 2023
bbd2b4f
[ENH] update warning message on return_file_index failure (#540)
Remi-Gau Apr 21, 2023
6e65b0a
update info about gunzip (#547)
Remi-Gau Apr 27, 2023
258ff7a
[MAINT] back merge master (#549)
Remi-Gau Apr 27, 2023
bd992f0
[FIX] failing to return file index during dependencies indexing thorw…
Remi-Gau Apr 27, 2023
554f792
update doc (#554)
Remi-Gau Apr 28, 2023
f423ea6
[ENH] support querying for scans.tsv and sessions.tsv (#550)
Remi-Gau Apr 28, 2023
786b562
[ENH] allow to query directly for tsv content (#555)
Remi-Gau Apr 28, 2023
7ea783a
allow query of participants (#557)
Remi-Gau May 1, 2023
287109a
[INFRA] run tests on mac OS and windows for matlab (#560)
Remi-Gau May 5, 2023
3b2d45f
[INFRA] randomize tests order (#566)
Remi-Gau May 11, 2023
df0c543
[MAINT] update schema dev (#580)
Remi-Gau Jun 12, 2023
db6e3d0
[ENH] give more meaningful error messsages when failing to read json …
Remi-Gau Jun 18, 2023
d97d8df
fix force false skipped when unzipping files (#584)
Remi-Gau Jun 18, 2023
07897c5
[DOC] update help of several functions (#583)
Remi-Gau Jun 18, 2023
1faff9b
[ENH] add electrodes and optodes as group dependencies (#586)
Remi-Gau Jun 18, 2023
3578dca
allow indexing of files missing session entity when schemaless (#598)
Remi-Gau Jul 31, 2023
8dbcfe8
improve wrong dir message (#601)
Remi-Gau Jul 31, 2023
0bb0fde
[ENH] index and query phenotype (#590)
Remi-Gau Jul 31, 2023
3dbfed5
[ENH] do not add subject to layout if it is empty (#600)
Remi-Gau Jul 31, 2023
d2b1c9c
[MAINT] Update from main (#606)
Remi-Gau Jul 31, 2023
fd3e0e6
[ENH] use inheritance in get_meta_list (#609)
Remi-Gau Aug 5, 2023
5f7ac04
[ENH] improve bids schema api (#610)
Remi-Gau Aug 5, 2023
87b1216
[FIX] better handle printing of paths in windows (#611)
Remi-Gau Aug 5, 2023
125f217
fix bug with unsorted model (#613)
Remi-Gau Aug 7, 2023
10baa5d
add info about skipped tests (#614)
Remi-Gau Aug 8, 2023
43eb70b
Incorporating json into bids.File (issues #596 #371) (#597)
nbeliy Aug 8, 2023
aaa0007
add id to warning
Remi-Gau Aug 12, 2023
8915f32
fix bug with 2 json file for one level (#616)
Remi-Gau Aug 13, 2023
7abb241
[ENH] improve performance and testing (#618)
Remi-Gau Aug 18, 2023
eec8349
update demo (#621)
Remi-Gau Aug 22, 2023
d3f339a
[ENH] remove atlas and update res and den metadata (#622)
Remi-Gau Aug 26, 2023
0008bb7
Merge branch 'master' into dev
Remi-Gau Sep 4, 2023
2efd714
[FIX] Fix tests after merge from master (#627)
Remi-Gau Sep 6, 2023
64b4613
use objects for levels (#630)
Remi-Gau Sep 11, 2023
fc062f9
add internal function to start resolvig uri (#631)
Remi-Gau Sep 11, 2023
8bbabd6
fix hed tags (#632)
Remi-Gau Sep 16, 2023
2b8ba88
[MAINT] merge main in dev (#644)
Remi-Gau Nov 6, 2023
8df8b62
Merge branch 'master' into dev
Remi-Gau Nov 20, 2023
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
1 change: 1 addition & 0 deletions +bids/+internal/add_missing_field.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
%
% structure = add_missing_field(structure, field)
%

% (C) Copyright 2021 BIDS-MATLAB developers

if ~isfield(structure, field)
Expand Down
10 changes: 7 additions & 3 deletions +bids/+internal/append_to_layout.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
% subject = append_to_layout(file, subject, modality, schema == [])
%
% :param file:
% :type file: string
% :type file: char
%
% :param subject: subject sub-structure from the BIDS layout
% :type subject: structure
%
% :param modality:
% :type modality: string
% :type modality: char
%
% :param schema:
% :type schema: structure
%
%

% (C) Copyright 2021 BIDS-MATLAB developers

pth = [subject.path, filesep, modality];
Expand Down Expand Up @@ -156,7 +160,7 @@

function [msg, msg_id] = error_message(msg_id, file, extra)

msg = sprintf('Skipping file: %s.\n', file);
msg = sprintf('Skipping file: %s.\n', bids.internal.format_path(file));

switch msg_id

Expand Down
5 changes: 3 additions & 2 deletions +bids/+internal/camel_case.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
% str = camel_case(str)
%
% :param str:
% :type str: string
% :type str: char
%
% :returns:
% :str: (string) returns the input with an upper case for first letter
% :str: (char) returns the input with an upper case for first letter
% for all words but the first one (``camelCase``) and
% removes invalid characters (like spaces).
%

% (C) Copyright 2018 BIDS-MATLAB developers

% camel case: upper case for first letter for all words but the first one
Expand Down
61 changes: 61 additions & 0 deletions +bids/+internal/create_unordered_list.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
function list = create_unordered_list(list)
%
% turns a cell string or a structure into a string
% that is an unordered list to print to the screen
%
% USAGE::
%
% list = bids.internal.create_unordered_list(list)
%
% :param list: obligatory argument.
% :type list: cell string or structure
%
%

% (C) Copyright 2022 Remi Gau

if bids.internal.is_octave
warning('off', 'Octave:mixed-string-concat');
end

prefix = '\n\t- ';

if ischar(list)
list = cellstr(list);
end

if iscell(list)

for i = 1:numel(list)
if isnumeric(list{i})
list{i} = num2str(list{i});
end
end

list = sprintf([prefix, strjoin(list, prefix), '\n']);

elseif isstruct(list)

output = '';
fields = fieldnames(list);

for i = 1:numel(fields)
content = list.(fields{i});
if ~iscell(content)
content = {content};
end

for j = 1:numel(content)
if isnumeric(content{j})
content{j} = num2str(content{j});
end
end

output = [output prefix fields{i} ': {' strjoin(content, ', ') '}'];
end

list = sprintf(output);

end

end
26 changes: 17 additions & 9 deletions +bids/+internal/download.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
%
% filename = download(URL, output_dir, verbose)
%

% (C) Copyright 2021 BIDS-MATLAB developers
if nargin < 2
output_dir = pwd;
end
bids.util.mkdir(output_dir);

msg = sprintf('Downloading dataset from:\n %s\n\n', URL);
print_to_screen(msg, verbose);
Expand All @@ -16,26 +18,32 @@
protocol = tokens{1};

filename = tokens{end};
if strcmp(filename, '?zip=')
[~, filename] = fileparts(tempname);
filename = [filename '.zip'];
end

if exist(filename, 'file')
delete(filename);
end

if strcmp(protocol, 'http:')
if ismember(protocol, {'http:', 'https:'})

if isunix()
if verbose
system(sprintf('wget %s', URL));
else
system(sprintf('wget -q %s', URL));
try
urlwrite(URL, filename); %#ok<*URLWR>
catch
options = '';
if ~verbose
options = '-q';
end
else
urlwrite(URL, filename);
system(sprintf('wget %s %s', options, URL));
end

% move file in case it was not downloaded in the root dir
if ~exist(fullfile(output_dir, filename), 'file')
print_to_screen([filename ' --> ' output_dir], verbose);
print_to_screen([bids.internal.format_path(filename), ...
' --> ', ...
bids.internal.format_path(output_dir)], verbose);
movefile(filename, fullfile(output_dir, filename));
end
filename = fullfile(output_dir, filename);
Expand Down
3 changes: 2 additions & 1 deletion +bids/+internal/ends_with.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
% :param pattern:
% :type pattern: character array
%
%
% Based on the equivalent function from SPM12
%

% (C) Copyright 2011-2018 Guillaume Flandin, Wellcome Centre for Human Neuroimaging
%

% (C) Copyright 2018 BIDS-MATLAB developers

res = false;
Expand Down
44 changes: 28 additions & 16 deletions +bids/+internal/error_handling.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ function error_handling(varargin)
%
% :param function_name: default = ``bidsMatlab``
% :type function_name:
%
% :param id: default = ``unspecified``
% :type id: string
% :type id: char
%
% :param msg: default = ``unspecified``
% :type msg: string
% :type msg: char
%
% :param tolerant:
% :type tolerant: boolean
% :type tolerant: logical
%
% :param verbose:
% :type verbose: boolean
% :type verbose: logical
%
% Example
% -------
%
% .. code-block:: matlab
%
% bids.internal.error_handling(mfilename(), 'thisError', 'this is an error', tolerant, verbose)
%

% (C) Copyright 2018 BIDS-MATLAB developers

default_function_name = 'bidsMatlab';
Expand All @@ -23,28 +35,28 @@ function error_handling(varargin)
default_tolerant = true;
default_verbose = false;

p = inputParser;
args = inputParser;

addOptional(p, 'function_name', default_function_name, @ischar);
addOptional(p, 'id', default_id, @ischar);
addOptional(p, 'msg', default_msg, @ischar);
addOptional(p, 'tolerant', default_tolerant, @islogical);
addOptional(p, 'verbose', default_verbose, @islogical);
addOptional(args, 'function_name', default_function_name, @ischar);
addOptional(args, 'id', default_id, @ischar);
addOptional(args, 'msg', default_msg, @ischar);
addOptional(args, 'tolerant', default_tolerant, @islogical);
addOptional(args, 'verbose', default_verbose, @islogical);

parse(p, varargin{:});
parse(args, varargin{:});

function_name = bids.internal.file_utils(p.Results.function_name, 'basename');
function_name = bids.internal.file_utils(args.Results.function_name, 'basename');

id = [function_name, ':' p.Results.id];
msg = p.Results.msg;
id = [function_name, ':' args.Results.id];
msg = sprintf(['\n' args.Results.msg '\n']);

if ~p.Results.tolerant
if ~args.Results.tolerant
errorStruct.identifier = id;
errorStruct.message = msg;
error(errorStruct);
end

if p.Results.verbose
if args.Results.verbose
warning(id, msg);
end

Expand Down
17 changes: 8 additions & 9 deletions +bids/+internal/file_utils.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function varargout = file_utils(str, varargin)
%
% Character array (or cell array of strings) handling facility
% Character array (or cell array of char) handling facility
%
% USAGE:
%
Expand All @@ -11,33 +11,32 @@
% [dirs] = bids.internal.file_utils('List', directory, 'dir', regexp)
% [dirs] = bids.internal.file_utils('FPList', directory, 'dir', regexp)
%
%
% To get a certain piece of information from a file::
%
% str = bids.internal.file_utils(str, option)
%
% str - character array, or cell array of strings
% str - character array, or cell array of char
%
% option - string of requested item - one among:
% option - char of requested item - one among:
% {'path', 'basename', 'ext', 'filename', 'cpath', 'fpath'}
%
%
% To set a certain piece of information from a file::
%
% str = bids.internal.file_utils(str, opt_key, opt_val, ...)
%
% str - character array, or cell array of strings
% str - character array, or cell array of char
%
% opt_key - string of targeted item - one among:
% opt_key - char of targeted item - one among:
% {'path', 'basename', 'ext', 'filename', 'prefix', 'suffix'}
%
% opt_val - string of new value for feature
%
% opt_val - char of new value for feature
%
% Based on spm_file.m and spm_select.m from SPM12.
%

% (C) Copyright 2011-2018 Guillaume Flandin, Wellcome Centre for Human Neuroimaging
%

% (C) Copyright 2018 BIDS-MATLAB developers

%#ok<*AGROW>
Expand Down
31 changes: 31 additions & 0 deletions +bids/+internal/format_path.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function pth = format_path(pth)
%
% USAGE::
%
% pth = bids.internal.format_path(pth)
%
% Replaces single '\' by '/' in Windows paths
% to prevent escaping warning when printing a path to screen
%
% :param pth: If pth is a cellstr of paths, pathToPrint will work
% recursively on it.
% :type pth: char or cellstr$
%
%

% (C) Copyright 2022 BIDS-MATLAB developers

if isunix()
return
end

if ischar(pth)
pth = strrep(pth, '\', '\\');

elseif iscell(pth)
for i = 1:numel(pth)
pth{i} = strrep(pth{i}, '\', '\\');
end
end

end
Loading
Loading