Skip to content

Commit

Permalink
Merge pull request #1857 from kabilar/master
Browse files Browse the repository at this point in the history
Update Python library docs
  • Loading branch information
effigies authored Dec 12, 2023
2 parents d8faac1 + c384f88 commit 3501e79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion bids-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bids-validator/bids_validator/bids_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ 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
-----
When you test a file path, make sure that the path is relative to the
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
--------
Expand Down

0 comments on commit 3501e79

Please sign in to comment.