Skip to content

Commit 8379a5d

Browse files
committed
doc: document custom and multiple BIDS schemas
1 parent cc601d6 commit 8379a5d

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# bids2table
2+
23
[![CI](https://github.com/childmindresearch/bids2table/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/childmindresearch/bids2table/actions/workflows/ci.yaml?query=branch%3Amain)
34
[![Docs](https://github.com/childmindresearch/bids2table/actions/workflows/docs.yaml/badge.svg?branch=main)](https://childmindresearch.github.io/bids2table/bids2table)
45
[![codecov](https://codecov.io/gh/childmindresearch/bids2table/branch/main/graph/badge.svg?token=22HWWFWPW5)](https://codecov.io/gh/childmindresearch/bids2table)
@@ -100,7 +101,6 @@ As an example, here we index all datasets on [OpenNeuro](https://openneuro.org/)
100101

101102
Using 8 threads, we can index all ~1400 OpenNeuro datasets (1.2M files) in less than 15 minutes.
102103

103-
104104
### Indexing datasets from python
105105

106106
You can also index datasets using the Python API.
@@ -129,3 +129,20 @@ pq.write_table(tab, "ds000224.parquet")
129129
# Convert to a pandas dataframe.
130130
df = tab.to_pandas(types_mapper=pd.ArrowDtype)
131131
```
132+
133+
### Using a custom or multiple BIDS schemas
134+
135+
`bids2table` loads the bidsschematools default schema at import. For most
136+
users this is the right thing. To index a dataset against a specific schema
137+
version or path, pass a reference to the schema as the `schema` argument:
138+
139+
```python
140+
from bids2table import index_dataset
141+
142+
table = index_dataset("/path/to/dataset", schema="/path/to/bids-schema")
143+
```
144+
145+
`schema=` accepts a `pa.Schema`, a bidsschematools `Namespace`,
146+
a path/URL, or `None` (the module-level default).
147+
Passing different schemas to different `index_dataset` calls in the same
148+
process is supported and works under multiprocessing.

0 commit comments

Comments
 (0)