From 2402f2c8dd2f2b443053a48c9a238b11d7114c28 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Mon, 11 Dec 2023 22:36:39 -0600 Subject: [PATCH 1/2] Update docstring --- bids-validator/bids_validator/bids_validator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bids-validator/bids_validator/bids_validator.py b/bids-validator/bids_validator/bids_validator.py index decc21412..40c85b662 100644 --- a/bids-validator/bids_validator/bids_validator.py +++ b/bids-validator/bids_validator/bids_validator.py @@ -30,14 +30,14 @@ def __init__(self, index_associated=True): def is_bids(self, path): """Check if file path adheres to BIDS. - Main method of the validator. uses other class methods for checking + Main method of the validator. Uses other class methods for checking different aspects of the file path. Parameters ---------- path : str Path of a file to be checked. Must be relative to root of a BIDS - dataset. + dataset, and must include a leading forward slash `/`. Notes ----- @@ -45,7 +45,7 @@ def is_bids(self, path): root of the BIDS dataset the file is part of. That is, as soon as the file path contains parts outside of the BIDS dataset, the validation will fail. For example "home/username/my_dataset/participants.tsv" will - fail, although "participants.tsv" is a valid BIDS file. + fail, although "/participants.tsv" is a valid BIDS file. Examples -------- From c384f8861f527d0bfc1ebb001c93e9e198938546 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Mon, 11 Dec 2023 22:40:51 -0600 Subject: [PATCH 2/2] Update readme --- bids-validator/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bids-validator/README.md b/bids-validator/README.md index 7e61645d3..6dc051cf1 100644 --- a/bids-validator/README.md +++ b/bids-validator/README.md @@ -56,7 +56,9 @@ [Conda package](https://anaconda.org/conda-forge/bids-validator). 1. Open a Python terminal and type: `python` 1. Import the BIDS Validator package `from bids_validator import BIDSValidator` - 1. Check if a file is BIDS compatible `BIDSValidator().is_bids('path/to/a/bids/file')` + 1. Check if a file is BIDS compatible `BIDSValidator().is_bids('/relative/path/to/a/bids/file')` + 1. Note, the file path must be relative to the root of the BIDS dataset, and + a leading forward slash `/` must be added to the file path. ## Support @@ -405,6 +407,9 @@ for filepath in filepaths: print(validator.is_bids(filepath)) # will print True, and then False ``` +Note, the file path must be relative to the root of the BIDS dataset, and a +leading forward slash `/` must be added to the file path. + ## Development To develop locally, clone the project and run `npm install` from the project