Skip to content

Commit e39a5ba

Browse files
authored
Merge pull request #90 from cpp-lln-lab/remi-update_from_retinotopy
make it possible to have a less verbose out when saving
2 parents 7f276cb + f221d4e commit e39a5ba

File tree

6 files changed

+34
-21
lines changed

6 files changed

+34
-21
lines changed

src/checkCFG.m

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

1313
%% list the defaults to set
1414

15-
fieldsToSet.verbose = false;
15+
fieldsToSet.verbose = 0;
1616

1717
fieldsToSet.useGUI = false;
1818

src/createFilename.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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( ...

src/subfun/printCreditsCppBids.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ function printCreditsCppBids(cfg)
77
version = 'v1.0.0';
88
end
99

10-
verbose = true;
10+
verbose = 2;
1111
if ~isempty(cfg) && isfield(cfg, 'verbose') && ~isempty(cfg.verbose)
1212
verbose = cfg.verbose;
1313
end
1414

15-
if verbose
15+
if verbose > 1
1616

1717
contributors = { ...
1818
'Rémi Gau', ...
1919
'Marco Barilari', ...
2020
'Ceren Battal'};
2121

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

2424
repoURL = 'https://github.com/cpp-lln-lab/CPP_BIDS';
2525

@@ -44,7 +44,7 @@ function printCreditsCppBids(cfg)
4444
end
4545
fprintf('\b\n\n');
4646

47-
% 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);
4848

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

tests/test_checkCFG.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function test_checkCfgBasic()
2929
%% set up
3030
outputDir = fullfile(fileparts(mfilename('fullpath')), '..', 'output');
3131

32-
cfg.verbose = false;
32+
cfg.verbose = 0;
3333

3434
cfg.subject.subjectNb = 1;
3535
cfg.subject.runNb = 1;

0 commit comments

Comments
 (0)