Repository navigation
Fix NaN values in inverse Box-Cox transform for Lambda > 0 - #577
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #577 +/- ##
==========================================
+ Coverage 84.75% 84.76% +0.01%
==========================================
Files 170 170
Lines 15104 15114 +10
==========================================
+ Hits 12801 12811 +10
Misses 2303 2303
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
hi @raashish1601, thanks for the fix, looks good to me! |
dnerini
self-requested a review
October 8, 2026 20:04
dnerini
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The inverse of
boxcox_transformreturns NaN instead of 0 for dry pixels whenLambda > 0.The forward transform sets values below the threshold to
zerovalue = threshold - 1in transformed space. ForLambda > 0that value is usually below-1 / Lambda. For example, with threshold 0.1 andLambda = 0.5it is about -2.37, soLambda * R + 1is negative andnp.loggives NaN. The inverse then runsR[R < threshold] = zerovalue, butNaN < thresholdis False, so these pixels stay NaN.The fix finds the zeros in transformed space, before the back-transformation. The transform is monotonic, so for finite values this gives the same pixels as before.
Lambda = 0and the dB/sqrt transforms are not affected.I added a round trip test with zeros for
Lambdain 0, 0.5 and 1. It fails on master for 0.5 and 1.test_utils_transformation.pyandtest_utils_conversion.pypass, and black is clean.