Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pybids for filename generation #111

Open
Remi-Gau opened this issue Dec 7, 2021 · 2 comments
Open

Use pybids for filename generation #111

Remi-Gau opened this issue Dec 7, 2021 · 2 comments

Comments

@Remi-Gau
Copy link

Remi-Gau commented Dec 7, 2021

Could be done this way and should be able to handle optional entities.

from bids import BIDSLayout

config_file = "config_pybids.json"
target_dir = "."
layout = BIDSLayout(target_dir, validate=False, config=config_file)

entities = {
    "subject": "01",
    "session": "1",
    "sample": "A",
    "run": 1,
    "task": "nox",
    "suffix": "ephys",
}

# Define the pattern to build out of the components passed in a dictionary
pattern = "sub-{subject}/[ses-{session}]/sub-{subject}[_ses-{session}]_sample-{sample}_task-{task}[_run-{run}]_{suffix}.nwb"

layout.build_path(entities, pattern, validate=False)
@dumaatravaie
Copy link
Contributor

Looks good ..

@Remi-Gau
Copy link
Author

Remi-Gau commented Dec 7, 2021

FYI I am using a modified config for pybids that should start providing some support for ephys and microscopy data (it is not complete yet).

https://gin.g-node.org/RemiGau/example_ephys_bids_conversion/src/master/code/config_pybids.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants