From af248838b0d35d76a4cff00866a17593ed6ed3cf Mon Sep 17 00:00:00 2001 From: Elizabeth Kenneally <113037677+e-kenneally@users.noreply.github.com> Date: Sat, 22 Jun 2024 11:01:02 +0900 Subject: [PATCH] Add exclude field --- bids2table/_b2t.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bids2table/_b2t.py b/bids2table/_b2t.py index 1749245..01dc315 100644 --- a/bids2table/_b2t.py +++ b/bids2table/_b2t.py @@ -1,7 +1,7 @@ import logging from functools import partial from pathlib import Path -from typing import Optional +from typing import List, Optional from elbow.builders import build_parquet, build_table from elbow.sources.filesystem import Crawler @@ -24,6 +24,7 @@ def bids2table( workers: Optional[int] = None, worker_id: Optional[int] = None, return_table: bool = True, + exclude: Optional[List[str]] = None, ) -> Optional[BIDSTable]: """ Index a BIDS dataset directory and load as a pandas DataFrame. @@ -56,11 +57,14 @@ def bids2table( root = Path(root).expanduser().resolve() if not root.is_dir(): raise FileNotFoundError(f"root directory {root} does not exists") - + + if exclude is None: + exclude = [] + source = Crawler( root=root, include=["sub-*"], # find subject dirs - skip=["sub-*"], # but don't crawl into subject dirs + skip=["sub-*"] + exclude, # but don't crawl into subject dirs dirs_only=True, follow_links=True, )