-
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
Fix stretching integer data #153
Conversation
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.
Thanks for the fix and the test! I'm wondering if we should handle int (int32) differently, see inline comment.
trollimage/xrimage.py
Outdated
if np.issubdtype(dtype, np.integer): | ||
dtype = np.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.
Shouldn't this be float64 if the input type is int32? the mantissa in float32 in 24bits, so it can't represent the full spectrum of values from int32...
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.
The handling is adjusted in d35a5ac
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.
And fixed in 034d659 . The previous attempt entered the wrong branch.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
==========================================
+ Coverage 91.48% 91.50% +0.02%
==========================================
Files 12 12
Lines 3956 3969 +13
==========================================
+ Hits 3619 3632 +13
Misses 337 337
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
LGTM!
This PR fixes stretching of linear integer data. The bug was introduced in #150 due to lack of testing.
uint8
data gives unexpected results #152 (remove if there is no corresponding issue, which should only be the case for minor changes)git diff origin/master **/*py | flake8 --diff
(remove if you did not edit any Python files)