Skip to content

.get returns double results when validate=False #557

@adelavega

Description

@adelavega

Let's say I set up a derivative as a root directory, as a derivative (because I want it to use derivative entities, such as desc): Let's say I also said validate=False:

layout = BIDSLayout('/data/fmriprep', derivatives=['/data/fmriprep'], validate=False)

Then if I ask for the following:

layout.get(task='sherlockPart1', subject='01', datatype='func', suffix='bold')

I will get two results:

[<BIDSImageFile filename='/work/Sherlock/preproc/fmriprep/sub-01/func/sub-01_task-sherlockPart1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'>,
 <BIDSImageFile filename='/work/Sherlock/preproc/fmriprep/sub-01/func/sub-01_task-sherlockPart1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'>]

What is happening is that both the root layout, and the derivative layout are returning results.

This happens even if I ask for results only from derivatives:

layout.get(task='sherlockPart1', subject='01', datatype='func', suffix='bold', scope='derivatives')

This happens because _in_scope determines if a layout is in the scope of derivatives based on the PipelineDescription, which the root derivative has, even though derivative results were not applied when indexing.

If I validate the layout, then I only get one result, because the preproc file is not indexed at all by the root layout.


The reason this is relevant for fitlins, is that as @effigies pointed out, BIDS Model are not valid BIDS yet so we have to run with validate=False.

I think the simple solution for fitlins is to add desc=preproc as a entity to filter that get call on, so that we only get 1 preproc file returned.

But I think it's a bug to say the root derivative is in the derivatives scope, even when that set of entities were not applied during indexing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions