Skip to content

Commit

Permalink
Add exclude field
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kenneally authored Jun 22, 2024
1 parent 4bfb609 commit af24883
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bids2table/_b2t.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit af24883

Please sign in to comment.