From 8d3e1db01e8956bb4f79550884d89fe1b4ab19c4 Mon Sep 17 00:00:00 2001 From: Camille Maumet Date: Fri, 4 May 2018 14:35:25 +0200 Subject: [PATCH 01/10] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..eb9bfe6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 INCF-NIDASH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 5ba9593919531b2fee385bab2eb8aa16cb5dfa43 Mon Sep 17 00:00:00 2001 From: Camille Maumet Date: Fri, 4 May 2018 17:24:53 +0200 Subject: [PATCH 02/10] First pass at creating README --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e015080 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# nidmresults +The Python library to read and write [NIDM-Results](http://nidm.nidash.org/specs/nidm-results.html) packs. + +You are free to copy, modify, and distribute nidmresults with attribution under the terms of the MIT license. See the [LICENSE file](LICENSE.md) for details. + +## Install +nidmresults is distributed through pypi, to install the latest relase you can use: +``` +pip install nidmresults +``` + +To work with the current developement version we recommend cloning this repository locally and then install using +``` +python setup.py install +``` + +## Example of usage + +## Contributing + + + From c49a6cb02afc12b1b4f8bf0554e8377972cf31ed Mon Sep 17 00:00:00 2001 From: Camille Maumet Date: Tue, 26 Jun 2018 10:15:09 +0200 Subject: [PATCH 03/10] Few fixes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e015080..8e2f053 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # nidmresults -The Python library to read and write [NIDM-Results](http://nidm.nidash.org/specs/nidm-results.html) packs. +A Python library to read and write [NIDM-Results](http://nidm.nidash.org/specs/nidm-results.html) packs. You are free to copy, modify, and distribute nidmresults with attribution under the terms of the MIT license. See the [LICENSE file](LICENSE.md) for details. ## Install -nidmresults is distributed through pypi, to install the latest relase you can use: +nidmresults is distributed with [PyPI](https://pypi.org/project/nidmresults/), to install the latest relase you can use: ``` pip install nidmresults ``` From 2fce15d44081628ebdeebd57a121293148d07554 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 26 Jun 2018 10:54:46 +0200 Subject: [PATCH 04/10] version to 2.0.1-dev1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b2e771a..99d85bb 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="nidmresults", - version="2.0.0", + version="2.0.0-dev1", author="Camille Maumet", author_email="c.m.j.maumet@warwick.ac.uk", description=( From 4360c6aa28eabc7f36ce759d32abd772ebc2f2f6 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 26 Jun 2018 10:55:19 +0200 Subject: [PATCH 05/10] Exception if loading unhandled file --- nidmresults/load.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nidmresults/load.py b/nidmresults/load.py index b08778b..8969073 100644 --- a/nidmresults/load.py +++ b/nidmresults/load.py @@ -24,5 +24,7 @@ def load(filename, to_replace=dict()): raise Exception('Minimal json file: not handled yet') elif filename.endswith('.nidm.zip'): nidm = NIDMResults.load_from_pack(filename, to_replace=to_replace) + else: + raise Exception('Unhandled format ' + filename) return nidm From b80e0aa3f3b8e4b9877cd5fa7589a5c327f7697e Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 26 Jun 2018 10:56:11 +0200 Subject: [PATCH 06/10] version to 2.0.1-dev1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 99d85bb..cff4386 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="nidmresults", - version="2.0.0-dev1", + version="2.0.1-dev1", author="Camille Maumet", author_email="c.m.j.maumet@warwick.ac.uk", description=( From 7c41dbf190a98b1fa0cb72b9220736e3fee33289 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 26 Jun 2018 10:56:52 +0200 Subject: [PATCH 07/10] First example reading NIDM pack --- examples/ex_read_nidm.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/ex_read_nidm.py diff --git a/examples/ex_read_nidm.py b/examples/ex_read_nidm.py new file mode 100644 index 0000000..492ab79 --- /dev/null +++ b/examples/ex_read_nidm.py @@ -0,0 +1,27 @@ +# Example: reading a NIDM pack available on NeuroVault +import os +import json +import shutil +import tempfile +import nidmresults as nidm +import urllib.request + +# Download the NIDM pack locally +nidm_url = 'https://neurovault.org/collections/2210/fsl_default_130.nidm.zip' +nidmpack = "2210_fsl_default_130.nidm.zip" + +if not os.path.isfile(nidmpack): + print('Downloading ' + nidmpack) + urllib.request.urlretrieve(nidm_url, nidmpack) + +# Known issues with NIDM packs in collection 2210 +to_replace = { + ' \\ntask': '\\\\n task', + ';\n nidm_coordinateVectorInVoxels: "null"^^xsd:string .': + '.'} + +# Read the NIDM pack +nres = nidm.load(nidmpack, to_replace=to_replace) + +print(json.dumps(nres.get_info(), indent=4)) + \ No newline at end of file From dfbbf051c2cbf4dbb5aedf2033490cc68cf3eb2a Mon Sep 17 00:00:00 2001 From: Camille Maumet Date: Tue, 26 Jun 2018 11:00:27 +0200 Subject: [PATCH 08/10] Minimal examples and contributing sections --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e2f053..5826074 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,9 @@ python setup.py install ## Example of usage -## Contributing +Examples are available in the [examples](examples) folder. +## Contributing +Thanks for your interest in contributing to nidmresults. All contributions are very welcome! If you experience difficulties using the library, please [open an issue](https://github.com/incf-nidash/nidmresults/issues/new) describing the problem. See the list of [current issues](https://github.com/incf-nidash/nidmresults/issues). From 8dc5786a527aae9b94e5b99f85d0d7a928a9a570 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 26 Jun 2018 11:01:27 +0200 Subject: [PATCH 09/10] fixing PEP8 --- examples/ex_read_nidm.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/ex_read_nidm.py b/examples/ex_read_nidm.py index 492ab79..9870376 100644 --- a/examples/ex_read_nidm.py +++ b/examples/ex_read_nidm.py @@ -11,8 +11,8 @@ nidmpack = "2210_fsl_default_130.nidm.zip" if not os.path.isfile(nidmpack): - print('Downloading ' + nidmpack) - urllib.request.urlretrieve(nidm_url, nidmpack) + print('Downloading ' + nidmpack) + urllib.request.urlretrieve(nidm_url, nidmpack) # Known issues with NIDM packs in collection 2210 to_replace = { @@ -24,4 +24,3 @@ nres = nidm.load(nidmpack, to_replace=to_replace) print(json.dumps(nres.get_info(), indent=4)) - \ No newline at end of file From d4576e2c002f724f49fe8a9b377d38dd36ff1487 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 26 Jun 2018 11:02:00 +0200 Subject: [PATCH 10/10] More fixes for PEP8 --- examples/ex_read_nidm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ex_read_nidm.py b/examples/ex_read_nidm.py index 9870376..5bebc4a 100644 --- a/examples/ex_read_nidm.py +++ b/examples/ex_read_nidm.py @@ -13,7 +13,7 @@ if not os.path.isfile(nidmpack): print('Downloading ' + nidmpack) urllib.request.urlretrieve(nidm_url, nidmpack) - + # Known issues with NIDM packs in collection 2210 to_replace = { ' \\ntask': '\\\\n task',