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

[FIX] add two_sided parameter to RegionExtractor #4849

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hndgzkn
Copy link
Collaborator

@hndgzkn hndgzkn commented Dec 2, 2024

Copy link
Contributor

github-actions bot commented Dec 2, 2024

👋 @hndgzkn 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 Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.66%. Comparing base (92a2248) to head (3d53ce2).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4849   +/-   ##
=======================================
  Coverage   93.66%   93.66%           
=======================================
  Files         136      136           
  Lines       17169    17170    +1     
  Branches     2973     2973           
=======================================
+ Hits        16082    16083    +1     
  Misses        577      577           
  Partials      510      510           
Flag Coverage Δ
macos-latest_3.10_test_plotting 93.18% <100.00%> (+<0.01%) ⬆️
macos-latest_3.11_test_plotting ?
macos-latest_3.12_test_plotting 93.18% <100.00%> (+<0.01%) ⬆️
macos-latest_3.13_test_plotting 93.18% <100.00%> (+<0.01%) ⬆️
macos-latest_3.9_test_plotting 93.16% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.10_test_plotting 93.18% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.11_test_plotting 93.18% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.12_test_plotting 93.18% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.13_test_plotting 93.18% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.13_test_pre 93.20% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.9_test_min 69.31% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.9_test_plot_min 92.07% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.9_test_plotting 93.16% <100.00%> (+<0.01%) ⬆️
windows-latest_3.10_test_plotting 93.16% <100.00%> (+<0.01%) ⬆️
windows-latest_3.11_test_plotting 93.16% <100.00%> (+<0.01%) ⬆️
windows-latest_3.12_test_plotting 93.16% <100.00%> (+<0.01%) ⬆️
windows-latest_3.13_test_plotting 93.16% <100.00%> (+<0.01%) ⬆️
windows-latest_3.9_test_plotting 93.14% <100.00%> (+<0.01%) ⬆️

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.

@hndgzkn hndgzkn requested a review from Remi-Gau December 2, 2024 09:59
Comment on lines +313 to +315
two_sided : :obj:`bool`, default=False
Whether the thresholding should yield both positive and negative
part of the maps.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
two_sided : :obj:`bool`, default=False
Whether the thresholding should yield both positive and negative
part of the maps.
two_sided : :obj:`bool`, default=False
Whether the thresholding should yield both positive and negative
part of the maps.

just adding some vertical spacing: a lot of our doc string don't have them and it hinders readability 😉

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.

I think I'd be more comfortable if we had a test for this

@hndgzkn
Copy link
Collaborator Author

hndgzkn commented Dec 2, 2024

I think I'd be more comfortable if we had a test for this

Yes, I agree. I try to understand how to test it.

Shall I also update change log bug fix part?

@hndgzkn
Copy link
Collaborator Author

hndgzkn commented Dec 3, 2024

Hi @Remi-Gau ,

Is there a way to create maps that contain positive and negative regions using nilearn._utils.data_gen.generate_maps?

@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Dec 3, 2024

Shall I also update change log bug fix part?

yes: I opened a PR to recreate the doc/changes/latest.rst file where you can update the changelod

@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Dec 3, 2024

Hi @Remi-Gau ,

Is there a way to create maps that contain positive and negative regions using nilearn._utils.data_gen.generate_maps?

no idea but if you need something that does it don't hesitate to create a new function for it

@hndgzkn
Copy link
Collaborator Author

hndgzkn commented Dec 3, 2024

Ok, I try to understand how I can do it .

@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Dec 3, 2024

@hndgzkn

maybe have a look to make sure it does not interfere with yours

@hndgzkn
Copy link
Collaborator Author

hndgzkn commented Dec 3, 2024

maybe have a look to make sure it does not interfere with yours

Thank you for sharing this PR, the discussion helps me understand a bit more on thresholding.

The issue that we address is different, however it can be the reason that I cannot create maps with positive and negative regions, or lose the values by thresholding. I need to understand how it works and how it should work. I'll be more explicit later :)

@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Dec 3, 2024

I'll be more explicit later :)

If you feel that some bits of the code could do with more comments / refactoring to help faster understanding, don't hesitate to open PR that just do that.

@bthirion
Copy link
Member

bthirion commented Dec 3, 2024

nilearn._utils.data_gen.generate_maps generates 3D+t data so I don't think that there can be a clear concept of positive/negative region.

@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Dec 3, 2024

@hndgzkn
should I finish #4501 and have you review it?

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.

[BUG] RegionExtractor does not have a two-tailed behavior.
3 participants