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
Avoid possible divide-by-zero in Vectors layer thumbnail update #5192
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5192 +/- ##
=======================================
Coverage 88.81% 88.81%
=======================================
Files 574 574
Lines 48910 48912 +2
=======================================
+ Hits 43441 43443 +2
Misses 5469 5469
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Thanks for addressing this! Tested locally, all vector tests on my M1 pass and For anyone reviewing, the diff is hard to follow, no idea why it's generated like that. Easier to look here perhaps: napari/napari/layers/vectors/vectors.py Lines 667 to 674 in dddbdcf
Those are the added lines, with the two colormapped lines being moved from 699-700. Then the rest is moved into the else: as is, with no changes but the indentation and black formatting.VS Code does a better job of presenting it: |
Wow, that diff really is bad! Thanks for the screenshot @psobolewskiPhD, that helps a lot :D @aganders3 nice catch, thanks for the PR! Looks good to me. |
Thanks for the reviews, and thanks @psobolewskiPhD for the clarification on the diff! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me.
Edit: sorry didn't know how to do this properly—still learning!
@aganders3 we have some merge conflicts, do you want to have a go at them? |
* rebase on main, fix conflicts introduced by napari#5003
dddbdcf
to
6e9a71a
Compare
Thanks for the heads-up. The only difference I found was that |
As @psobolewskiPhD mentioned in Zulip, this is fairly niche, so I'm going to remove the v0.4.17 milestone from this to keep the RC changes small. Thanks again for the fix @aganders3! |
Description
Trying to run tests locally I ran into nine tests in
layers/vectors/_tests/test_vectors.py
tests consistently failing:I will spare the repeated output because it was basically the same for each:
The root of the problem is the undefined behavior in casting a
NaN
toint
becauseself._extent_data
is filled withNaN
when the data is empty.It looks like this or something like it was fixed or anticipated for the Shapes layer, so I copied the implementation style from there. I checked some of the other layer types and they look okay as well, though I'm still getting familiar with them.
Type of change
References
See numpy/numpy#14412
I think this is actually set to emit a warning in a coming version of numpy, and potentially raise an error.
How has this been tested?
Vector tests pass with my change on multiple platforms.
Final checklist:
trans.
to make them localizable.For more information see our translations guide.