Fix PersistenceLength normalization for sliced run (Issue #5453) - #5459
Fix PersistenceLength normalization for sliced run (Issue #5453)#5459srikarjy wants to merge 1 commit into
Conversation
…5453) PersistenceLength._conclude() normalized bond_autocorrelation using the total number of frames in the trajectory instead of the number of frames actually analyzed. This gave wrong results whenever run() was called with start, stop, or step. Now uses self.n_frames, which AnalysisBase already tracks for this purpose. Added a regression test comparing full trajectory and sliced runs against manually computed normalization values.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5459 +/- ##
========================================
Coverage 93.87% 93.87%
========================================
Files 182 182
Lines 22522 22522
Branches 3206 3206
========================================
Hits 21143 21143
Misses 917 917
Partials 462 462 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Documentation build overview
|
| * 0.7.5.1 | ||
|
|
||
| Fixes | ||
| * `PersistenceLength._conclude()` now normalizes `results.bond_autocorrelation` using the number of frames actually analyzed instead of the total trajectory frame count, fixing incorrect results when `run()` is called with `start`/`stop`/`step` (Issue #5453). |
There was a problem hiding this comment.
Why has this CHANGELOG entry been duplicated across so many old versions? Did you see any previous examples where we did this? Did you read your diff carefully?
| norm *= len(chains) * n_sliced_frames | ||
| expected = p.results.raw_bond_autocorr / norm | ||
|
|
||
| assert_almost_equal(p.results.bond_autocorrelation, expected, decimal=6) |
There was a problem hiding this comment.
Here and above -- I don't like that your expected value is derived from the actual class/function under test. That can be a recipe for suppression of breaking changes if both the actual and expected values are mutated in a similar way.
Fixes #5453
Changes made in this Pull Request:
LLM / AI generated code disclosure
LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: minimal (an AI assistant pointed me to the relevant line and explained the concept; I made the edits and wrote/ran the tests myself)
PR Checklist
package/CHANGELOGfile updated?package/AUTHORS?