[BUG]: DataladDataGrabber with specified datadir #96

Closed
opened 2022-10-05 09:54:18 +00:00 by LeSasse · 2 comments
LeSasse commented 2022-10-05 09:54:18 +00:00 (Migrated from github.com)

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am writing this issue because it seems to be an issue not with the AOMIC datagrabber but with the underlying datalad datagrabber.

This became apparent when testing the DataladAOMIC1000 datagrabber. If I specify an existing directory for installing the datalad dataset, then subsequently the datagrabber seems to get the incorrect file (i.e. by incorrectly appending the directory before the file path.) If I do not specify an existing directory, then everything works correctly in a tmp dir.

Expected Behavior

I would like it to work the same whether or not I specify the datadir.

Steps To Reproduce

I installed junifer from github.

from junifer.datagrabber.aomic1000 import DataladAOMIC1000

# test is an existing folder in my working directory
dg = DataladAOMIC1000(datadir="test")

with dg:
    test_element = dg.get_elements()[0] 
    out = dg[test_element]

Running this will produce the following error:

get(impossible): test/derivatives/fmriprep/sub-0347/func/sub-0347_task-moviewatching_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz [path does not exist]

The same code without specifying a datadir works correctly:

from junifer.datagrabber.aomic1000 import DataladAOMIC1000

dg = DataladAOMIC1000()

with dg:
    test_element = dg.get_elements()[0] 
    out = dg[test_element]

Running this produces the desired result:

get(ok): derivatives/fmriprep/sub-0371/func/sub-0371_task-moviewatching_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz (file) [from s3-PUBLIC...]

Environment

Usage: junifer [OPTIONS] COMMAND [ARGS]...
Try 'junifer --help' for help.

Error: No such command 'wtf'.

Relevant log output

No response

Anything else?

No response

### Is there an existing issue for this? - [X] I have searched the existing issues ### Current Behavior I am writing this issue because it seems to be an issue not with the AOMIC datagrabber but with the underlying datalad datagrabber. This became apparent when testing the DataladAOMIC1000 datagrabber. If I specify an existing directory for installing the datalad dataset, then subsequently the datagrabber seems to get the incorrect file (i.e. by incorrectly appending the directory before the file path.) If I do not specify an existing directory, then everything works correctly in a tmp dir. ### Expected Behavior I would like it to work the same whether or not I specify the datadir. ### Steps To Reproduce I installed junifer from github. ```python3 from junifer.datagrabber.aomic1000 import DataladAOMIC1000 # test is an existing folder in my working directory dg = DataladAOMIC1000(datadir="test") with dg: test_element = dg.get_elements()[0] out = dg[test_element] ``` Running this will produce the following error: ``` get(impossible): test/derivatives/fmriprep/sub-0347/func/sub-0347_task-moviewatching_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz [path does not exist] ``` The same code without specifying a datadir works correctly: ```python3 from junifer.datagrabber.aomic1000 import DataladAOMIC1000 dg = DataladAOMIC1000() with dg: test_element = dg.get_elements()[0] out = dg[test_element] ``` Running this produces the desired result: ``` get(ok): derivatives/fmriprep/sub-0371/func/sub-0371_task-moviewatching_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz (file) [from s3-PUBLIC...] ``` ### Environment ```markdown Usage: junifer [OPTIONS] COMMAND [ARGS]... Try 'junifer --help' for help. Error: No such command 'wtf'. ``` ### Relevant log output _No response_ ### Anything else? _No response_
LeSasse commented 2022-10-05 10:04:28 +00:00 (Migrated from github.com)

Just realised that in each example the zeroth element was not the same.
But I checked the dataset and the above element

/derivatives/fmriprep/sub-0347/func/sub-0347_task-moviewatching_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz

does exist. So the above reported bug is still valid.

Just realised that in each example the zeroth element was not the same. But I checked the dataset and the above element ``` /derivatives/fmriprep/sub-0347/func/sub-0347_task-moviewatching_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz ``` does exist. So the above reported bug is still valid.
fraimondo commented 2022-10-05 13:25:25 +00:00 (Migrated from github.com)

Found the issue. datadir was tested, but never with a relative path. In order for the PatternDataGrabber to work, it needs an absolute path, otherwise it will repeat the datadir twice.

Found the issue. `datadir` was tested, but never with a relative path. In order for the `PatternDataGrabber` to work, it needs an absolute path, otherwise it will repeat the `datadir` twice.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
juaml/junifer#96
No description provided.