-
Notifications
You must be signed in to change notification settings - Fork 19
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
Preserve dtypes in XRImage "enhancements" #151
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
==========================================
+ Coverage 91.28% 91.47% +0.18%
==========================================
Files 11 11
Lines 3890 3952 +62
==========================================
+ Hits 3551 3615 +64
+ Misses 339 337 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Co-authored-by: David Hoese <[email protected]>
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.
Good work, some comments
trollimage/tests/test_image.py
Outdated
@@ -1954,7 +1986,8 @@ def test_blend(self): | |||
[0.768815, 0.72, 0.6728228, 0.62857145, 0.5885714], | |||
[0.55412847, 0.5264665, 0.50666666, 0.495612, 0.49394494], | |||
[0.5020408, 0.52, 0.5476586, 0.5846154, 0.63027024], | |||
[0.683871, 0.7445614, 0.81142855, 0.8835443, 0.96]])) | |||
[0.683871, 0.7445614, 0.81142855, 0.8835443, 0.96]], dtype=np.float32), |
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.
Ok, it looks like all the tests above this point were converted to float32, and the regular float version was just dropped. Maybe it's not necessary for all tests, but could dtype maybe be parameterized so the we don't just forget about floats here?
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.
I added the parametrize decorator to this and other tests to test with np.float32
, np.float64
and float
.
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.
great, thanks!
Co-authored-by: Martin Raspaud <[email protected]>
…/trollimage into preserve-enhancement-dtypes
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.
I'm happy with this, great work!
Some of the "enhancments" in
XRImage
class currently upcasts float data to float64. This PR makes these (.gamma()
and.colorize()
to preserve the dtype of the input data. Checks are added also to other tests to check this holds true also for those operations.Note that #150 has the same done for
.crude_stretch()
.Includes also some test refactoring.
git diff origin/master **/*py | flake8 --diff
(remove if you did not edit any Python files)