Skip to content

Commit 6df2e7f

Browse files
committed
Merge remote-tracking branch 'cpp-lln-lab/master' into cer-readme_suggest
2 parents 17ab12d + a93b588 commit 6df2e7f

15 files changed

+101
-47
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ before_script:
4444
jobs:
4545
include:
4646
- name: "BIDS validator: create and check dataset"
47-
script: octave $OCTFLAGS --eval "test_makeRawDataset" && bids-validator `pwd`/output/rawdata/ --ignoreNiftiHeaders
47+
script: octave $OCTFLAGS --eval "test_makeRawDataset" && bids-validator `pwd`/output/raw/ --ignoreNiftiHeaders
4848
- name: "miss_hit: checking code quality"
4949
script: mh_metric . --ci
5050
- name: "miss_hit: checking code style"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ future BEP format in a dedicated eyetracker folder
125125
`<matches>[_recording-<label>]_stim.tsv.gz`
126126
`<matches>[_recording-<label>]_stim.json`
127127

128+
### change log
129+
130+
<!-- 93b4c584bf22883a3c4f8b9031b70e381deef272 -->
131+
128132
### 3.3. <a name='Contributors'></a>Contributors ✨
129133

130134
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

src/checkCFG.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
%% list the defaults to set
1414

15-
fieldsToSet.verbose = false;
15+
fieldsToSet.verbose = 0;
16+
17+
fieldsToSet.useGUI = false;
1618

1719
fieldsToSet.fileName.task = '';
1820
fieldsToSet.fileName.zeroPadding = 3;

src/convertSourceToRaw.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function convertSourceToRaw(cfg)
1010
% Only covers func folder at the moment
1111

1212
sourceDir = fullfile(cfg.dir.output, 'source');
13-
rawDir = fullfile(cfg.dir.output, 'rawdata');
13+
rawDir = fullfile(cfg.dir.output, 'raw');
1414

1515
% add dummy README and CHANGE file
1616
copyfile(fullfile( ...

src/createFilename.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
'echo', ...
106106
'phaseEncodingDirection', ...
107107
'reconstruction', ...
108-
'recording', ...
108+
'recording' ...
109109
};
110110

111111
targetFields = { ...
@@ -114,7 +114,7 @@
114114
'echo', ...
115115
'dir', ...
116116
'rec', ...
117-
'recording', ...
117+
'recording' ...
118118
};
119119

120120
for iField = 1:numel(fields2Check)
@@ -146,10 +146,10 @@
146146
pattern = cfg.fileName.pattern;
147147

148148
runSuffix = cfg.fileName.suffix.run;
149-
acqSuffix = cfg.fileName.suffix.acquisition ;
150-
ceSuffix = cfg.fileName.suffix.contrastEnhancement ;
151-
dirSuffix = cfg.fileName.suffix.phaseEncodingDirection ;
152-
recSuffix = cfg.fileName.suffix.reconstruction ;
149+
acqSuffix = cfg.fileName.suffix.acquisition;
150+
ceSuffix = cfg.fileName.suffix.contrastEnhancement;
151+
dirSuffix = cfg.fileName.suffix.phaseEncodingDirection;
152+
recSuffix = cfg.fileName.suffix.reconstruction;
153153
echoSuffix = cfg.fileName.suffix.echo;
154154
recordingSuffix = cfg.fileName.suffix.recording;
155155

@@ -201,7 +201,7 @@
201201

202202
function talkToMe(cfg)
203203

204-
if cfg.verbose
204+
if cfg.verbose > 0
205205

206206
fprintf(1, '\nData will be saved in this directory:\n\t%s\n', ...
207207
fullfile(cfg.dir.outputSubject, cfg.fileName.modality));

src/miss_hit.cfg

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# style guide (https://florianschanda.github.io/miss_hit/style_checker.html)
12
line_length: 100
23
regex_function_name: "[a-z]+(([A-Z]){1}[A-Za-z]+)*"
3-
suppress_rule: "copyright_notice"
4+
suppress_rule: "copyright_notice"
5+
6+
# metrics limit for the code quality (https://florianschanda.github.io/miss_hit/metrics.html)
7+
metric "cnest": limit 4
8+
metric "file_length": limit 500
9+
metric "cyc": limit 15
10+
metric "parameters": limit 6

src/saveEventsFile.m

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ function printHeaderExtraColumns(logFile)
219219
warning('saveEventsFile:missingData', ...
220220
'Missing some %s data for this event.', namesExtraColumns{iExtraColumn});
221221

222-
if cfg.verbose
222+
if cfg.verbose > 1
223223
disp(logFile(iEvent));
224224
end
225225

226226
elseif ~ischar(data) && all(isnan(data))
227227
warning('Missing %s data for this event.', namesExtraColumns{iExtraColumn});
228228

229-
if cfg.verbose
229+
if cfg.verbose > 1
230230
disp(logFile(iEvent));
231231
end
232232
end
@@ -297,11 +297,11 @@ function printHeaderExtraColumns(logFile)
297297

298298
else
299299

300-
printData(logFile(1).fileID, onset);
301-
printData(logFile(1).fileID, duration);
302-
printData(logFile(1).fileID, trial_type);
300+
printData(logFile(1).fileID, onset, cfg);
301+
printData(logFile(1).fileID, duration, cfg);
302+
printData(logFile(1).fileID, trial_type, cfg);
303303

304-
printExtraColumns(logFile, iEvent);
304+
printExtraColumns(logFile, iEvent, cfg);
305305

306306
fprintf(logFile(1).fileID, '\n');
307307
fprintf(1, '\n');
@@ -311,7 +311,7 @@ function printHeaderExtraColumns(logFile)
311311

312312
end
313313

314-
function printExtraColumns(logFile, iEvent)
314+
function printExtraColumns(logFile, iEvent, cfg)
315315
% loops through the extra columns and print them
316316

317317
namesExtraColumns = returnNamesExtraColumns(logFile);
@@ -320,26 +320,32 @@ function printExtraColumns(logFile, iEvent)
320320

321321
data = logFile(iEvent).(namesExtraColumns{iExtraColumn});
322322

323-
printData(logFile(1).fileID, data);
323+
printData(logFile(1).fileID, data, cfg);
324324

325325
end
326326

327327
end
328328

329-
function printData(output, data)
329+
function printData(output, data, cfg)
330330
% write char
331331
% for numeric data we replace any nan by n/a
332332
if ischar(data)
333333
fprintf(output, '%s\t', data);
334-
fprintf(1, '%s\t', data);
334+
if cfg.verbose > 0
335+
fprintf(1, '%s\t', data);
336+
end
335337
else
336338
for i = 1:numel(data)
337339
if isnan(data(i))
338340
fprintf(output, '%s\t', 'n/a');
339-
fprintf(1, '%s\t', 'n/a');
341+
if cfg.verbose > 0
342+
fprintf(1, '%s\t', 'n/a');
343+
end
340344
else
341345
fprintf(output, '%f\t', data(i));
342-
fprintf(1, '%f\t', data(i));
346+
if cfg.verbose > 0
347+
fprintf(1, '%f\t', data(i));
348+
end
343349
end
344350
end
345351
end
@@ -384,7 +390,7 @@ function errorSaveEventsFile(identifier)
384390

385391
function talkToMe(cfg, logFile)
386392

387-
if cfg.verbose
393+
if cfg.verbose > 0
388394

389395
fprintf(1, '\nData were saved in this file:\n\n%s\n\n', ...
390396
fullfile( ...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function checkCppBidsDependencies(cfg)
1212

1313
elseif isempty(GITHUB_WORKSPACE) % local
1414

15-
pth = fullfile(fileparts(mfilename('fullpath')), '..');
15+
pth = fullfile(fileparts(mfilename('fullpath')), '..', '..');
1616
checkSubmodule(fullfile(pth, 'lib', 'JSONio'));
1717
checkSubmodule(fullfile(pth, 'lib', 'bids-matlab'));
1818

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
function printCreditsCppBids(cfg)
22

3-
verbose = true;
3+
try
4+
version = fileread(fullfile(fileparts(mfilename('fullpath')), ...
5+
'..', '..', 'version.txt'));
6+
catch
7+
version = 'v1.0.0';
8+
end
9+
10+
verbose = 2;
411
if ~isempty(cfg) && isfield(cfg, 'verbose') && ~isempty(cfg.verbose)
512
verbose = cfg.verbose;
613
end
714

8-
if verbose
9-
10-
version = '0.0.1';
15+
if verbose > 1
1116

1217
contributors = { ...
1318
'Rémi Gau', ...
1419
'Marco Barilari', ...
1520
'Ceren Battal'};
1621

17-
% DOI_URL = 'https://doi.org/10.5281/zenodo.3554331.';
22+
DOI_URL = 'https://doi.org/10.5281/zenodo.4007674';
1823

1924
repoURL = 'https://github.com/cpp-lln-lab/CPP_BIDS';
2025

@@ -39,7 +44,7 @@ function printCreditsCppBids(cfg)
3944
end
4045
fprintf('\b\n\n');
4146

42-
% fprintf('Please cite using the following DOI: \n %s\n\n', DOI_URL)
47+
fprintf('Please cite using the following DOI: \n %s\n\n', DOI_URL);
4348

4449
fprintf('For bug report, suggestions or contributions see: \n %s\n\n', repoURL);
4550

src/userInputs.m

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,26 @@
1515
cfg = struct('debug', []);
1616
end
1717

18+
cfg = checkCFG(cfg);
19+
1820
[cfg, responses] = setDefaultResponses(cfg);
1921

2022
if ~cfg.debug.do
2123

2224
questions = createQuestionList(cfg);
2325

24-
try
25-
responses = askUserGui(questions, responses);
26-
catch
26+
if cfg.useGUI
27+
28+
try
29+
responses = askUserGui(questions, responses);
30+
catch
31+
responses = askUserCli(questions, responses);
32+
end
33+
34+
else
35+
2736
responses = askUserCli(questions, responses);
37+
2838
end
2939

3040
end

0 commit comments

Comments
 (0)