-
Notifications
You must be signed in to change notification settings - Fork 124
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
Custom configurations are not passed to derivatives indexer #1020
Comments
What I usualy do in cases like this is to create a separate config.json file (starting from this one) and to load this config before running BIDSLayout. |
Thanks for the tip! However I can't quite get it to work. Here's the file I created: {
"name": "bidsafq",
"entities": [
{
"name": "algorithm",
"pattern": "[_/\\\\]+algo-([a-zA-Z0-9]+)"
}
]
}
And here's the code I've been using. I tried a few different things, to no avail so far. It currently returns an empty list. add_config_paths(**{'bidsafq':'full/path/to/bids.json'}) # with or without that line -- although if run twice in the same session it errors out: ConfigError: Configuration 'bidsafq' already exists
layout = BIDSLayout(
root_dir,
derivatives=True,
config=[
"bids",
"full/path/to/bids.json" # or just "bidsafq" if `add_config_paths` was run
],
)
layout.get(algorithm="AFQ", return_type="filename")
>> []
# the regex works well though
import re
rex = re.compile(r"[_/\\]+algo-([a-zA-Z0-9]+)")
rex.findall(
"main/derivatives/afq/sub-01/ses-01/sub-01_ses-01_run-01_dwi_space-RASMM_model-probCSD_algo-AFQ_desc-profiles_dwi.csv"
)
>> ['AFQ'] |
You will need to use |
Adding |
If you call |
Just checked: it didn't attach the "algo" entity. Do I need to add a |
Oh, I think this may be a bug where the configs are getting reset when you descend into derivatives. Try the following: add_config_paths(**{'bidsafq':'full/path/to/bids.json'})
layout = BIDSLayout(root_dir)
layout.add_derivatives(Path(root_dir) / 'derivatives' / 'afq', config=['bids', 'derivatives', 'afq']) |
That works, thank you! Even with a slightly simplified version, which allows to include all derivative directories at once. layout.add_derivatives(Path(root_dir) / 'derivatives', config=['bids', 'derivatives', 'bidsafq']) What is the |
If you're not using any other derivatives entities, there should be no difference. |
Config
and Entity
element
Hello!
I'm trying to use a new
Entity
element, and I can't figure it out by looking at the documentation.Here's what I have, but it doesn't work:
Returns
TypeError: Object of type Config is not JSON serializable
.Also, I'm not trying to replace all entities but add one to the existing default ones.
I've looked at:
The text was updated successfully, but these errors were encountered: