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] ensure that threshold passed to plotting functions are positive #4338

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

Conversation

Remi-Gau
Copy link
Collaborator

@Remi-Gau Remi-Gau commented Mar 22, 2024

Changes proposed in this pull request:

As far as I can tell all plotting threshold are implicitly expected to be positive numbers but this is never checked or enforced.

  • add a function to convert negative threshold to their absolute values if they are negative

Copy link
Contributor

👋 @Remi-Gau 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 Mar 22, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 92.14%. Comparing base (abb80ff) to head (8ab5efc).
Report is 37 commits behind head on main.

Files Patch % Lines
nilearn/plotting/img_plotting.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4338      +/-   ##
==========================================
+ Coverage   91.85%   92.14%   +0.28%     
==========================================
  Files         144      143       -1     
  Lines       16419    16509      +90     
  Branches     3434     3466      +32     
==========================================
+ Hits        15082    15212     +130     
+ Misses        792      751      -41     
- Partials      545      546       +1     
Flag Coverage Δ
macos-latest_3.10_test_plotting 91.93% <94.11%> (?)
macos-latest_3.11_test_plotting 91.93% <94.11%> (+0.08%) ⬆️
macos-latest_3.12_test_plotting 91.93% <94.11%> (?)
macos-latest_3.8_test_plotting 91.89% <94.11%> (?)
macos-latest_3.9_test_plotting 91.90% <94.11%> (?)
ubuntu-latest_3.10_test_plotting 91.93% <94.11%> (+0.08%) ⬆️
ubuntu-latest_3.11_test_plotting 91.93% <94.11%> (?)
ubuntu-latest_3.12_test_plotting 91.93% <94.11%> (?)
ubuntu-latest_3.8_test_min 68.78% <5.88%> (?)
ubuntu-latest_3.8_test_plot_min 91.60% <70.58%> (?)
ubuntu-latest_3.8_test_plotting 91.89% <94.11%> (?)
ubuntu-latest_3.9_test_plotting 91.90% <94.11%> (?)
windows-latest_3.10_test_plotting 91.91% <94.11%> (?)
windows-latest_3.11_test_plotting 91.91% <94.11%> (?)
windows-latest_3.12_test_plotting 91.91% <94.11%> (?)
windows-latest_3.8_test_plotting 91.87% <94.11%> (?)
windows-latest_3.9_test_plotting 91.88% <94.11%> (?)

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.

@bthirion
Copy link
Member

I'm wondering whether this is right. You could be in situations where you want to keep everything that's above -1, no ?
Why not leave the responsibility to the user ?

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.

Passing negative values as threshold for plotting
2 participants