Skip to content

Fix saddle_strength() to compute extent=0#568

Open
HyeonjeYang wants to merge 1 commit into
open2c:masterfrom
HyeonjeYang:fix-saddle-strength-extent0
Open

Fix saddle_strength() to compute extent=0#568
HyeonjeYang wants to merge 1 commit into
open2c:masterfrom
HyeonjeYang:fix-saddle-strength-extent0

Conversation

@HyeonjeYang

Copy link
Copy Markdown

Summary

saddle_strength() computes ratios in a loop starting 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])

This PR computes that value explicitly before the loop.

Fixes #565

Test plan

  • Added test_saddle_strength with hand-computed expected ratios (including a regression check that ratios[0] is no longer left at 0)
  • Ran pytest tests/test_compartments_saddle.py — new test passes; pre-existing CLI test failures in that file reproduce identically on master and are unrelated to this change

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update saddle_strength() to properly compute 0 extent

1 participant