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: RuntimeWarning in lightness plot #497

Merged
merged 4 commits into from
Oct 6, 2023
Merged

Conversation

lang-m
Copy link
Member

@lang-m lang-m commented Oct 6, 2023

The warning originates from the cast from float to int (inside matplotlib) when there are invalid parts in the field. We did set those to np.nan and get a warning about invalid values in the cast to uint8.

The warning originates from the cast from float to int (inside matplotlib)
when there are invalid parts in the field. We did set those to np.nan and get
a warning about invalid values in the cast to uint8.
@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

PR Analysis

  • 🎯 Main theme: Fixing a RuntimeWarning in the lightness plot function.
  • 📝 PR summary: This PR addresses a RuntimeWarning that was being raised when casting from float to int in the lightness plot function. The warning was due to invalid parts in the field being set to np.nan. The fix involves setting these invalid parts to zero instead of np.nan to avoid the warning.
  • 📌 Type of PR: Bug fix
  • 🧪 Relevant tests added: Yes
  • ⏱️ Estimated effort to review [1-5]: 2, because the PR is relatively small and the changes are straightforward.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The PR is well-structured and the changes are clear. The added test ensures that the fix works as expected. Good job!

  • 🤖 Code feedback:

How to use

To invoke the PR-Agent, add a comment using one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe: Modify the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback.
/ask <QUESTION>: Pose a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, use the /config command.

@lang-m
Copy link
Member Author

lang-m commented Oct 6, 2023

/review

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

PR Analysis

  • 🎯 Main theme: Fixing a RuntimeWarning in the lightness plot function.
  • 📝 PR summary: This PR addresses a RuntimeWarning that was being raised when invalid parts of a field were set to np.nan. The fix involves setting invalid parts to zero instead of np.nan. The PR also includes a test to ensure that the warning is no longer raised.
  • 📌 Type of PR: Bug fix
  • 🧪 Relevant tests added: Yes
  • ⏱️ Estimated effort to review [1-5]: 2, because the PR is relatively small and the changes made are straightforward.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The changes made in this PR are clear and concise. The added test ensures that the warning is no longer raised, which is good practice.

  • 🤖 Code feedback:

How to use

To invoke the PR-Agent, add a comment using one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe: Modify the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback.
/ask <QUESTION>: Pose a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, use the /config command.

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (89068b8) 93.49% compared to head (cedffde) 93.49%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #497   +/-   ##
=======================================
  Coverage   93.49%   93.49%           
=======================================
  Files          28       28           
  Lines        3027     3027           
=======================================
  Hits         2830     2830           
  Misses        197      197           
Files Coverage Δ
discretisedfield/plotting/mpl_field.py 91.34% <100.00%> (ø)

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

@lang-m
Copy link
Member Author

lang-m commented Oct 6, 2023

/improve --extended

lang-m and others added 2 commits October 6, 2023 09:50
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@lang-m lang-m marked this pull request as ready for review October 6, 2023 07:55
@lang-m lang-m requested a review from samjrholt October 6, 2023 07:55
@lang-m lang-m merged commit 6d318aa into master Oct 6, 2023
7 checks passed
@lang-m lang-m deleted the fix-lightness-casting-warning branch October 6, 2023 09:51
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.

3 participants