From 91e800f911f4683b54905007c41c881c4ea13727 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 7 Oct 2020 18:59:46 +0200 Subject: [PATCH 1/8] mh fix --- src/readAndFilterLogfile.m | 12 ++++++------ tests/test_readAndFilterLogfile.m | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/readAndFilterLogfile.m b/src/readAndFilterLogfile.m index 0e8269b8..1f791bab 100644 --- a/src/readAndFilterLogfile.m +++ b/src/readAndFilterLogfile.m @@ -63,7 +63,7 @@ for iField = 1:numel(listFields) output.(listFields{iField})(~filterIdx) = []; end - + output = convertStruct(output); % Convert the structure to dataset @@ -86,16 +86,16 @@ % changes the structure % % from struct.field(i,1) to struct(i,1).field(1) - + fieldsList = fieldnames(structure); tmp = struct(); - + for iField = 1:numel(fieldsList) for i = 1:numel(structure.(fieldsList{iField})) - tmp(i,1).(fieldsList{iField}) = structure.(fieldsList{iField})(i,1); + tmp(i, 1).(fieldsList{iField}) = structure.(fieldsList{iField})(i, 1); end end - + structure = tmp; - + end diff --git a/tests/test_readAndFilterLogfile.m b/tests/test_readAndFilterLogfile.m index 9f01f124..81406ed5 100644 --- a/tests/test_readAndFilterLogfile.m +++ b/tests/test_readAndFilterLogfile.m @@ -29,14 +29,14 @@ function test_readAndFilterLogfileBasic() logFile(end, 1).Speed = 2; logFile(end, 1).is_Fixation = true; logFile(end, 1).LHL24 = 2:13; - + logFile(3, 1).onset = 2; logFile(end, 1).trial_type = 'motion_up'; logFile(end, 1).duration = 3; logFile(end, 1).Speed = 2; logFile(end, 1).is_Fixation = true; logFile(end, 1).LHL24 = 1:12; - + logFile(4, 1).onset = 2; logFile(end, 1).trial_type = 'motion_down'; logFile(end, 1).duration = 3; @@ -62,7 +62,7 @@ function test_readAndFilterLogfileBasic() assertEqual(exist(expectedFile, 'file'), 2); content = bids.util.tsvread(expectedFile); - + assertEqual(size(content.trial_type), [2, 1]); assertEqual(content.trial_type{1}, 'motion_down'); From e7c7624653ff3e4cf336c93a0374ee934f9a752c Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Tue, 13 Oct 2020 10:03:13 +0200 Subject: [PATCH 2/8] fix markdown --- notebooks/README.md | 26 +++++++++++++++----------- tests/README.md | 42 ++++++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/notebooks/README.md b/notebooks/README.md index 7bcdbe46..23adaaec 100644 --- a/notebooks/README.md +++ b/notebooks/README.md @@ -1,13 +1,17 @@ # README -1. Make sure that you have Octave installed. -2. If you have Conda/Jupyter/pip installed, go to step 4. -Check if Conda is installed properly by typing `conda list` into your terminal -3. Download the [Anaconda Installer](https://www.anaconda.com/products/individual) and install it. -If using miniconda, run `conda install jupyter` to download and install the Jupyter Notebook package. -4. Install [Octave kernel](https://pypi.org/project/octave-kernel/): - ``` - pip install octave_kernel - ``` -5. Run `jupyter notebook` in your terminal. `Octave` should appear on the list - for creating a new notebook. +1. Make sure that you have Octave installed. + +2. If you have Conda/Jupyter/pip installed, go to step 4. Check if Conda is + installed properly by typing `conda list` into your terminal + +3. Download the + [Anaconda Installer](https://www.anaconda.com/products/individual) and + install it. If using miniconda, run `conda install jupyter` to download and + install the Jupyter Notebook package. + +4. Install [Octave kernel](https://pypi.org/project/octave-kernel/): + `pip install octave_kernel` + +5. Run `jupyter notebook` in your terminal. `Octave` should appear on the list + for creating a new notebook. diff --git a/tests/README.md b/tests/README.md index 673cc339..9d8452e4 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,18 +1,24 @@ # how to run the tests -- Install [MOxUnit for matlab and octave](https://github.com/MOxUnit/MOxUnit) to run the tests -- Install [MOcov for matlab and octave](https://github.com/MOcov/MOcov) to get the code coverage -- Make sure you are in the `tests` directory. -- Run `moxunit_runtests` or `moxunit_runtests -verbose` to run the tests. +- Install [MOxUnit for matlab and octave](https://github.com/MOxUnit/MOxUnit) + to run the tests + +- Install [MOcov for matlab and octave](https://github.com/MOcov/MOcov) to get + the code coverage + +- Make sure you are in the `tests` directory. + +- Run `moxunit_runtests` or `moxunit_runtests -verbose` to run the tests. This should tell you which tests pass or fail. - + ## code coverage -The following command would give more info and will give you HTML output in a `coverage_html` folder -showing you which lines of code is or is not checked by your test suite. +The following command would give more info and will give you HTML output in a +`coverage_html` folder showing you which lines of code is or is not checked by +your test suite. -``` matlab +```matlab success = moxunit_runtests(pwd, ... % the path where the tests are '-verbose', ... '-with_coverage', ... @@ -20,12 +26,15 @@ success = moxunit_runtests(pwd, ... % the path where the tests are '-cover_xml_file','coverage.xml', ... '-cover_html_dir','coverage_html'); ``` -This will return a clear underestimation of the code coverage as the the code in dependencies in the `lib` folder -are also included in this report. -If you want to get a slightly more accurate estimate you should run the following. +This will return a clear underestimation of the code coverage as the the code in +dependencies in the `lib` folder are also included in this report. + +If you want to get a slightly more accurate estimate you should run the +following. -I have not been able to find a way to exclude certain files without breaking some tests. +I have not been able to find a way to exclude certain files without breaking +some tests. ```matlab coverage = mocov( ... @@ -47,15 +56,13 @@ coverage = mocov( ... '-cover_html_dir','coverage_html') ``` - ## Adding more tests You can use the following function template to write more tests. - ```matlab function test_suite = test_functionToTest() - % This top function is necessary for mox unit to run tests. + % This top function is necessary for mox unit to run tests. % DO NOT CHANGE IT except to adapt the name of the function. try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> @@ -70,7 +77,7 @@ function test_functionToTestBasic() %% data to test against - + %% test % assertTrue( ); @@ -85,7 +92,7 @@ function test_functionToTestUseCase1() %% data to test against - + %% test % assertTrue( ); @@ -94,4 +101,3 @@ function test_functionToTestUseCase1() end ``` - From 4a5dbe8346998534735d2dd4b455c309f4e4e22b Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Tue, 13 Oct 2020 10:08:35 +0200 Subject: [PATCH 3/8] make travis run remark on certain files or folders --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 338ab7c2..e63a2e78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,4 +56,7 @@ jobs: before_script: - npm install `cat npm-requirements.txt` script: - - remark . --frail + - remark README.md --frail + - remark ./notebooks/ --frail + - remark ./tests/ --frail + - remark ./docs/ --frail From 48acd6b89ba9830e5d9b37d67bdd066e132653a7 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Tue, 13 Oct 2020 10:19:09 +0200 Subject: [PATCH 4/8] lock bids validator version at 1.5.4 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e63a2e78..d5cfa910 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_install: - travis_retry sudo apt-get -y install nodejs - travis_retry sudo apt-get -y install npm # Install BIDS-Validator - - sudo npm install -g bids-validator + - sudo npm install -g bids-validator@1.5.4 install: # make octave file the JSONio submodule From 92dd80960683d49ef6cabd3dfb8ffdc2ab0f45c9 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Tue, 13 Oct 2020 10:37:38 +0200 Subject: [PATCH 5/8] fix markdown --- README.md | 54 ++++++++++++++++++++--------------- docs/functions_description.md | 41 +++++++++++++------------- notebooks/README.md | 8 +++--- 3 files changed, 56 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index a54cff20..2f55bdde 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + + **Try it** [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/cpp-lln-lab/CPP_BIDS/master?filepath=notebooks%2Fbasic_usage.ipynb) @@ -17,34 +19,34 @@ [![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) ---- +* * * # CPP_BIDS - + + +- [CPP_BIDS](#cpp_bids) +- [Output format](#output-format) + - [Modality agnostic aspect](#modality-agnostic-aspect) +- [Documentation](#documentation) +- [Contributing](#contributing) + - [Guidestyle](#guidestyle) + - [BIDS naming convention](#bids-naming-convention) + - [Change log](#change-log) + - [Contributors ✨](#contributors-) -- 1. [Output format](#Outputformat) - - 1.1. [Modality agnostic aspect](#Modalityagnosticaspect) -- 2. [Documentation](#Documentation) -- 3. [Contributing](#Contributing) - - 3.1. [Guidestyle](#Guidestyle) - - 3.2. [BIDS naming convention](#BIDSnamingconvention) - - 3.3. [Contributors ✨](#Contributors) + - - + A set of function for matlab and octave to create [BIDS-compatible](https://bids-specification.readthedocs.io/en/stable/) folder structure and filenames for the output of behavioral, EEG, fMRI, eyetracking studies. -## 1. Output format +## Output format -### 1.1. Modality agnostic aspect +### Modality agnostic aspect Subjects, session and run number labels will be numbers with zero padding up to 3 values (e.g subject 1 will become `sub-001`). @@ -63,31 +65,33 @@ data set BIDS compliant. See `convertSourceToRaw.m` for more details. For example: -``` +```bash sub-090/ses-003/sub-090_ses-003_task-auditoryTask_run-023_events_date-202007291536.tsv ``` -## 2. Documentation +## Documentation - [Installation](./docs/installation.md) - [How to use it: jupyter notebooks](./notebooks) - [Functions description](./docs/functions_description.md) -## 3. Contributing +## Contributing Feel free to open issues to report a bug and ask for improvements. -### 3.1. Guidestyle +### Guidestyle - We use camelCase. + - We keep the McCabe complexity as reported by the [check_my_code function](https://github.com/Remi-Gau/check_my_code) below 15. + - We use the [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) to automatically fix some linting issues. -### 3.2. BIDS naming convention +### BIDS naming convention Here are the naming templates used. @@ -137,18 +141,21 @@ future BEP format in a dedicated eyetracker folder `[_recording-