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

Example to demonstrate copy_header_from in math_img #4392

Merged
merged 15 commits into from
Jun 4, 2024

Conversation

man-shu
Copy link
Contributor

@man-shu man-shu commented Apr 19, 2024

Changes proposed in this pull request:

  • create a new example to demonstrate the functionality

Copy link
Contributor

👋 @man-shu Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

Copy link

codecov bot commented Apr 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.99%. Comparing base (abb80ff) to head (7d63d69).
Report is 80 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4392      +/-   ##
==========================================
+ Coverage   91.85%   91.99%   +0.13%     
==========================================
  Files         144      145       +1     
  Lines       16419    16709     +290     
  Branches     3434     3551     +117     
==========================================
+ Hits        15082    15371     +289     
+ Misses        792      767      -25     
- Partials      545      571      +26     
Flag Coverage Δ
macos-latest_3.11_test_plotting 91.77% <ø> (-0.09%) ⬇️
macos-latest_3.8_test_plotting 91.80% <ø> (?)
ubuntu-latest_3.10_test_plotting 91.77% <ø> (-0.09%) ⬇️
ubuntu-latest_3.8_test_min 68.75% <ø> (?)
ubuntu-latest_3.8_test_plot_min 91.44% <ø> (?)
ubuntu-latest_3.8_test_plotting 91.73% <ø> (?)
windows-latest_3.12_test_plotting 91.76% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@man-shu
Copy link
Contributor Author

man-shu commented Apr 19, 2024

The same MSDL dataset download fails during building the docs.

So maybe first merging #4390 would be better.

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example LGTM.
I'm still not 100% sure that this deserves a full example, but I find it quite pedagogical, so I'm +0 for this addition.
Indeed, it has to come after #4390.

@man-shu
Copy link
Contributor Author

man-shu commented Apr 23, 2024

I'm still not 100% sure that this deserves a full example, but I find it quite pedagogical, so I'm +0 for this addition.

Yes, maybe it doesn't make much sense to have it for just one function.

But as explained in #4393, I identified the same issue in several others under the image module. So maybe a more general example would be worthwhile to have across all of them (once I have fixed them).

@bthirion
Copy link
Member

Can you propose an enhanced example ?

@man-shu
Copy link
Contributor Author

man-shu commented Apr 24, 2024

Yes, but I should fix #4393 first.

@man-shu man-shu marked this pull request as draft April 24, 2024 07:56
@man-shu
Copy link
Contributor Author

man-shu commented Apr 24, 2024

So, all the other nilearn.image functions with the same issue do not need further explanation (see #4397, they can now simply copy the header by default).

math_img remains the most peculiar, with several use cases where the default behavior could be confusing/problematic and could use this explanation. But I don't think I can change much in the current example.

@bthirion
Copy link
Member

We should decide on this at a forthcoming coredev meeting.

@man-shu man-shu marked this pull request as ready for review April 24, 2024 19:23
@man-shu man-shu removed the Blocked label Apr 25, 2024
Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall.

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just create the worresponding whatsnew entry.

@@ -0,0 +1,146 @@
"""
Copying headers from input images with ``math_img``
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it from 06_manipulating_images to 07_advanced as @Remi-Gau said in the dev meeting

@man-shu man-shu requested a review from bthirion June 4, 2024 08:08
@man-shu
Copy link
Contributor Author

man-shu commented Jun 4, 2024

This is also ready for review @Remi-Gau

@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Jun 4, 2024

This is also ready for review @Remi-Gau

checking it now

Copy link
Collaborator

@Remi-Gau Remi-Gau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx.

@bthirion
Copy link
Member

bthirion commented Jun 4, 2024

Merging, then.

@bthirion bthirion merged commit d4eb1a3 into nilearn:main Jun 4, 2024
29 checks passed
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

Successfully merging this pull request may close these issues.

[DOC] Add an example demonstrating header copying in math_img
3 participants