Skip to content

Fix image_threshold bug with integer arrays on some systems#6100

Merged
tkoyama010 merged 7 commits intopyvista:mainfrom
user27182:fix/image_threshold
May 19, 2024
Merged

Fix image_threshold bug with integer arrays on some systems#6100
tkoyama010 merged 7 commits intopyvista:mainfrom
user27182:fix/image_threshold

Conversation

@user27182
Copy link
Copy Markdown
Contributor

@user27182 user27182 commented May 18, 2024

Fix issue with image_threshold unexpectedly returning all zeros for integer scalar arrays. This seems to be build-specific. I am not able to reproduce this locally but the bug shows up in the docs.

See images of the bug here #6071 (comment)

@user27182 user27182 marked this pull request as draft May 18, 2024 17:31
@pyvista-bot pyvista-bot added the bug Uh-oh! Something isn't working as expected. label May 18, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.99%. Comparing base (4df1e0b) to head (bc9024f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6100   +/-   ##
=======================================
  Coverage   96.99%   96.99%           
=======================================
  Files         141      141           
  Lines       24624    24632    +8     
=======================================
+ Hits        23884    23892    +8     
  Misses        740      740           

@user27182
Copy link
Copy Markdown
Contributor Author

From the failed tests it looks like it's a Linux and/or Python < 3.12 issue. The tests fail for some cases with integer inputs.

@user27182 user27182 marked this pull request as ready for review May 19, 2024 05:01
@user27182 user27182 changed the title Fix image_threshold returns incorrect output (all zeros) Fix image_threshold bug with integer arrays on some systems May 19, 2024
@tkoyama010 tkoyama010 enabled auto-merge (squash) May 19, 2024 05:36
Copy link
Copy Markdown
Member

@tkoyama010 tkoyama010 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@tkoyama010 tkoyama010 merged commit d14dded into pyvista:main May 19, 2024
@user27182 user27182 deleted the fix/image_threshold branch May 19, 2024 12:25
tkoyama010 pushed a commit that referenced this pull request Jun 17, 2024
* Add image_threshold dtype tests

* Validate filter input as float

* Match paramater dtype to array dtype

* Cast int arrays to float

* Restrict casting to linux or mac or numpy < 2

* Fix casting back to input dtype
@banesullivan banesullivan mentioned this pull request Jul 7, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Uh-oh! Something isn't working as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants