Fix saddle_strength() to compute extent=0#568
Open
HyeonjeYang wants to merge 1 commit into
Open
Conversation
The loop in saddle_strength() starts at k=1, so ratios[0] was left at its zero-initialized default instead of being computed. Per the function's own documented formula, extent=0 reduces to the ratio of the two corner bins on each side: ((S/C)[0,0] + (S/C)[-1,-1]) / (2*(S/C)[-1,0]) Fixes open2c#565
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.
Summary
saddle_strength()computes ratios in a loop starting atk=1, soratios[0]was left at its zero-initialized default instead of being computed. Per the function's own documented formula, extent=0 reduces to the ratio of the two corner bins on each side:((S/C)[0,0] + (S/C)[-1,-1]) / (2*(S/C)[-1,0])This PR computes that value explicitly before the loop.
Fixes #565
Test plan
test_saddle_strengthwith hand-computed expected ratios (including a regression check thatratios[0]is no longer left at 0)pytest tests/test_compartments_saddle.py— new test passes; pre-existing CLI test failures in that file reproduce identically onmasterand are unrelated to this change