-
Notifications
You must be signed in to change notification settings - Fork 588
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
[WIP] Modify fetch_development_fmri to fetch adults or children #2035
[WIP] Modify fetch_development_fmri to fetch adults or children #2035
Conversation
Co-Authored-By: illdopejake <jacobwvogel@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Great catch on this. I'll look into the 155 thing, too !
nilearn/datasets/func.py
Outdated
@@ -2076,35 +2083,44 @@ def fetch_development_fmri(n_subjects=None, reduce_confounds=True, | |||
# Participants data: ids, demographics, etc | |||
participants = _fetch_development_fmri_participants(data_dir=data_dir, | |||
url=None, | |||
verbose=verbose) | |||
verbose=verbose | |||
)[::-1] # so adults come first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this given L2121 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah -- unfortunately the next line does not actually pay attention to the order of the hstack. When I was doing it locally, it wasn't actually changing the order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's odd.... maybe I can dig into that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the "problem" comes in at np.in1d
. It returns a sorted array, and since children have the earlier IDs, they're returned first.One idea, then would be:
participants = participants[np.in1d(participants['participant_id'], ids)][ids.argsort()]
Since we'd be passing the indices of the unsorted array, this would return the list with the ids in the ordering generated from np.hstack
.
WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm into it! I'll make the adjustment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry should've been more specific. I did:
ds = datasets.fetch_development_fmri(n_subjects=5)
and I got
array([('sub-pixar002', 4.8569473 , '4yo', 'child', 'F', 'R'),
('sub-pixar003', 4.15331964, '4yo', 'child', 'F', 'R'),
('sub-pixar004', 4.47364819, '4yo', 'child', 'F', 'R'),
('sub-pixar123', 27.06 , 'Adult', 'adult', 'F', 'R'),
('sub-pixar001', 4.77481177, '4yo', 'child', 'M', 'R')],
dtype=[('participant_id', '<U12'), ('Age', '<f8'), ('AgeGroup', '<U6'), ('Child_Adult', '<U5'), ('Gender', '<U4'), ('Handedness', '<U4')])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. That doesn't match what I'm seeing...
But this is really small so I don't want to hold this PR up over it !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
I'm too jetlagged to figure this out. i'll try again in the morning perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this question get resolved? (and are y'all over your jetlag? 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emdupre and I met and solved it! I think this one is all set @GaelVaroquaux !
Codecov Report
@@ Coverage Diff @@
## master #2035 +/- ##
==========================================
- Coverage 92.46% 92.35% -0.12%
==========================================
Files 149 149
Lines 18945 18991 +46
Branches 2301 2307 +6
==========================================
+ Hits 17518 17539 +21
- Misses 911 932 +21
- Partials 516 520 +4
Continue to review full report at Codecov.
|
@illdopejake I just ran this fetcher and am getting all 155 subjects -- not sure why it wouldn't have worked for you previously... Can you confirm it still isn't working on your machine with the master branch ? |
Still getting the 83, even in master. However, I passed a different directory to data_dir, and it downloaded all 155 to that directory... |
@illdopejake @emdupre |
I don't think so. I tried deleting a few files in the directory. Nilearn found the directory and downloaded the missing files.
So to make matters more odd, I went to the directory that nilearn found, and in fact, all 155 images are there. This is really bizarre but I don't know what to tell you to be able to reproduce this. I think we can assume its just idiosyncratic to something I'm doing / have done locally, and may not be worth looking into.. |
nilearn/datasets/tests/test_func.py
Outdated
data = func.fetch_development_fmri(n_subjects=1, reduce_confounds=False, | ||
verbose=1) | ||
age_group = data.phenotypic['Child_Adult'][0] | ||
assert_equal(age_group,'adult') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the right test!!
Can you merge master, so that circle runs. |
Hmm.. CircleCI still failing.. |
Circle is passing. Azure pipelines is failing. |
I have deactivated Azure Pipelines again.
Never mind that for now.
…On Fri, Apr 26, 2019, 22:56 Gael Varoquaux ***@***.***> wrote:
Circle is passing. Azure pipelines is failing.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2035 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB6SXRCTMEDG6OKO2MHXF63PSNT7TANCNFSM4HHENKMA>
.
|
This is now fixed with 18eb907 ! @illdopejake also caught another corner case -- when Even still, I think this is on hold until #2177 is merged because of the numerical instability in the example @jeromedockes and @kchawla-pi identified above. But, one question for the group: I really don't love the |
+1 I like this. We are not a stickler for 'adults', I don't see why we have to be for 'children'. |
…nt_modify_fetch_dev * 'master' of https://github.com/nilearn/nilearn: Removed sub-example due to unfit for lasso dataset - unstable float values (nilearn#2177) Fix Flake8 errors overlooked when merging PR nilearn#2028 (Plot connectome strength) (nilearn#2174)
[sty] rename adults_or_children to age_group, add test
nilearn/datasets/func.py
Outdated
if age_group not in ['both', 'child', 'adult']: | ||
raise ValueError("Wrong value for age_group={0}. " | ||
"Valid arguments are 'adult', 'child' " | ||
"or 'both'".format(age_group)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if age_group not in ['both', 'child', 'adult']: | |
raise ValueError("Wrong value for age_group={0}. " | |
"Valid arguments are 'adult', 'child' " | |
"or 'both'".format(age_group)) | |
valid_groups = ['both', 'child', 'adult'] | |
if age_group not in valid_groups: | |
raise ValueError("Wrong value for age_group={0}. " | |
"Valid arguments are {1}".format(age_group. valid_groups)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on this !
nilearn/datasets/func.py
Outdated
.format(n_subjects, max_subjects)) | ||
"value (for age_group={1}) will be used instead: " | ||
"n_subjects={2}" | ||
.format(n_subjects, age_group, max_subjects)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add a test where this warning is actually raised & verified.
I think this is blocking the beta release, as it will change the behavior of the development_fmri fetcher. ... but, it seems that we're just missing tests, here ! Would you be able to look into these some time this week, @illdopejake ? |
…nt_modify_fetch_dev * 'master' of https://github.com/nilearn/nilearn: Verbose doc building to ease tracking of progress & diagnose stalls (nilearn#2203) New conda env is created once conda path has been activated Conda environment is created for full-builds Refactor CircleCI config for reduced redundancy (nilearn#2204) Installation should fail on Python < 3.5 (nilearn#2198) [MRG] Add get data function (nilearn#2172) fix error when colorscale given boolean array (nilearn#2193) remove is_valid filter (nilearn#2169) Moved new entries to next release FIX: marker size issue in plot_connectome nilearn#2185 (nilearn#2186) Updated Appveyor status badge Run tests on local Windows machines & Azure Pipelines (nilearn#2191) Updated requirements list for devs (nilearn#2190) Update azure-pipelines.yml for Azure Pipelines Release Nilearn 0.6.0 alpha (nilearn#2164) Making fetch_localizer_button_task backwards compatibile (nilearn#2182) [DOC] Update whats_new to reference nilearn#2013 (Merging of several examples) (nilearn#2183)
Thanks for the phenomenal work you did for Niearn @illdopejake ! |
This is awesome work indeed. Thx ! |
* 'master' of github.com:nilearn/nilearn: Fixed the redundant & missing test case in merged PR nilearn#2035 (nilearn#2205) Modify fetch_development_fmri to fetch adults or children (nilearn#2035) Verbose doc building to ease tracking of progress & diagnose stalls (nilearn#2203) New conda env is created once conda path has been activated Conda environment is created for full-builds Refactor CircleCI config for reduced redundancy (nilearn#2204)
* 'master' of github.com:nilearn/nilearn: Rel 060b0 (nilearn#2208) Nilearn 0.6.0b0 release (nilearn#2206) Fixed the redundant & missing test case in merged PR nilearn#2035 (nilearn#2205) Modify fetch_development_fmri to fetch adults or children (nilearn#2035) Verbose doc building to ease tracking of progress & diagnose stalls (nilearn#2203) New conda env is created once conda path has been activated
…smooth-image * 'master' of https://github.com/nilearn/nilearn: (25 commits) Add testing for Nilearn setup & install & Fix the broken dependency installation (nilearn#2201) Fix uniform ball cloud test for sklearn >= 0.22 (nilearn#2175) MAINT: sklearn Deprecations (nilearn#2219) DOC: title in bold [DOC] Add note about decreasing memory usage (nilearn#2223) Rel 060b0 (nilearn#2208) Nilearn 0.6.0b0 release (nilearn#2206) Fixed the redundant & missing test case in merged PR nilearn#2035 (nilearn#2205) Modify fetch_development_fmri to fetch adults or children (nilearn#2035) Verbose doc building to ease tracking of progress & diagnose stalls (nilearn#2203) New conda env is created once conda path has been activated Conda environment is created for full-builds Refactor CircleCI config for reduced redundancy (nilearn#2204) Installation should fail on Python < 3.5 (nilearn#2198) [MRG] Add get data function (nilearn#2172) fix error when colorscale given boolean array (nilearn#2193) remove is_valid filter (nilearn#2169) Moved new entries to next release FIX: marker size issue in plot_connectome nilearn#2185 (nilearn#2186) Updated Appveyor status badge ...
…s-craddock * 'master' of https://github.com/nilearn/nilearn: (620 commits) CI: Test pre-release versions of dependencies (nilearn#2224) Fix: nilearn.image.smooth_img fails if fwhm is an ndarray (nilearn#2107) Update Python version warnings for Py35 deprecation (nilearn#2214) Fixing failure in minimum build of TravisCI (nilearn#2227) Updated missing whats_new entry Add testing for Nilearn setup & install & Fix the broken dependency installation (nilearn#2201) Fix uniform ball cloud test for sklearn >= 0.22 (nilearn#2175) MAINT: sklearn Deprecations (nilearn#2219) DOC: title in bold [DOC] Add note about decreasing memory usage (nilearn#2223) Rel 060b0 (nilearn#2208) Nilearn 0.6.0b0 release (nilearn#2206) Fixed the redundant & missing test case in merged PR nilearn#2035 (nilearn#2205) Modify fetch_development_fmri to fetch adults or children (nilearn#2035) Verbose doc building to ease tracking of progress & diagnose stalls (nilearn#2203) New conda env is created once conda path has been activated Conda environment is created for full-builds Refactor CircleCI config for reduced redundancy (nilearn#2204) Installation should fail on Python < 3.5 (nilearn#2198) [MRG] Add get data function (nilearn#2172) ... # Conflicts: # nilearn/datasets/atlas.py
This updates the fetch_development_fmri to do the following:
@emdupre if you want to look over it. I have not made any project on the n<155 issue
@gkiar I did my first test if you want to have a look.