Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/not_enforce_longitudinal' in…
Browse files Browse the repository at this point in the history
…to fix/not_enforce_longitudinal
  • Loading branch information
tientong98 committed Jan 17, 2025
2 parents 66a79ac + c885040 commit 09f003c
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions cubids/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,15 +952,36 @@ def remove_metadata_fields(bids_dir, container, fields):


def print_metadata_fields(bids_dir, container):
"""Print unique metadata fields.
"""Print unique metadata fields from a BIDS dataset.
This function identifies and prints all unique metadata fields from
the `dataset_description.json` file in a BIDS directory. It can run
either directly in Python or within a specified container (Docker or
Singularity).
Parameters
----------
bids_dir : :obj:`pathlib.Path`
Path to the BIDS directory.
Path to the BIDS directory containing the `dataset_description.json` file.
container : :obj:`str`
Container in which to run the workflow.
Name of the container (e.g., Docker, Singularity) to use for running the
`cubids print-metadata-fields` command. If `None`, the operation is performed
directly in Python without a container.
Raises
------
SystemExit
Raised in the following cases:
- The `dataset_description.json` file is not found in the BIDS directory.
- The subprocess returns a non-zero exit code when executed in a container.
"""
# Check if dataset_description.json exists
dataset_description = bids_dir / "dataset_description.json"
if not dataset_description.exists():
logger.error("dataset_description.json not found in the BIDS directory.")
sys.exit(1)

# Run directly from python
if container is None:
bod = CuBIDS(data_root=str(bids_dir), use_datalad=False)
Expand Down

0 comments on commit 09f003c

Please sign in to comment.