Skip to content

Commit faf45ad

Browse files
authored
Merge pull request #103 from Remi-Gau/remi-markdown_linting
fix removing date from _stim.json when converting to BIDS
2 parents 1c905c5 + d2a91d3 commit faf45ad

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/subfun/removeAllDateSuffix.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ function removeAllDateSuffix(rawDir, subjName, sesName)
2727
end
2828

2929
% do stim
30+
filenames = file_utils('List', subjectPath, ...
31+
sprintf('^%s.*_task-.*_stim_date-.*json$', subjName));
32+
removeDateSuffix(filenames, subjectPath);
33+
3034
filenames = file_utils('List', subjectPath, ...
3135
sprintf('^%s.*_task-.*_stim_date-.*tsv$', subjName));
3236
compressFiles(filenames, subjectPath);

tests/test_removeDateSuffix.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function test_removeDateSuffixBasic()
2121
eventsName = 'test_events_date-202008050730.tsv';
2222
stimName = 'test_stim_date-202008050730.tsv';
2323
stimNameZipped = 'test2_stim_date-202008050730.tsv.gz';
24+
stimJsonName = 'test_stim_date-202008050730.json';
2425

2526
filesToProcess = { ...
2627
boldName
@@ -30,6 +31,7 @@ function test_removeDateSuffixBasic()
3031
eventsName
3132
stimName
3233
stimNameZipped
34+
stimJsonName
3335
};
3436

3537
% create new files for new tests
@@ -48,6 +50,7 @@ function test_removeDateSuffixBasic()
4850
expectedEventsName = 'test_events.tsv';
4951
expectedStimName = 'test_stim.tsv';
5052
expectedStimNameZipped = 'test2_stim.tsv.gz';
53+
expectedStimJson = 'test_stim.json';
5154

5255
removeDateSuffix(filenames, outputDir);
5356

@@ -61,6 +64,7 @@ function test_removeDateSuffixBasic()
6164
assertEqual(exist(fullfile(outputDir, expectedStimNameZipped), 'file'), 2);
6265
assertEqual(exist(fullfile(outputDir, expectedBoldName2), 'file'), 2);
6366
assertEqual(exist(fullfile(outputDir, expectedBoldName), 'file'), 2);
67+
assertEqual(exist(fullfile(outputDir, expectedStimJson), 'file'), 2);
6468

6569
% clean up
6670
delete('*.nii*');

0 commit comments

Comments
 (0)