-
Notifications
You must be signed in to change notification settings - Fork 696
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
Fixes #3743: Modernize test assertions in test_align.py #4951
base: develop
Are you sure you want to change the base?
Fixes #3743: Modernize test assertions in test_align.py #4951
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.
Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on GitHub Discussions so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS
as part of this PR.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4951 +/- ##
===========================================
- Coverage 93.42% 93.41% -0.02%
===========================================
Files 177 189 +12
Lines 21859 22925 +1066
Branches 3078 3078
===========================================
+ Hits 20422 21415 +993
- Misses 986 1059 +73
Partials 451 451 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Maybe I'm misreading something, but I don't understand the direct connection between the changes here and the referenced ticket, gh-3743, which focuses on modernizing old test constructs like assert_almost_equal()
.
It is true that most (though not all) of the tolerance changes here are in the "right" direction (stricter instead of looser), but that seems like a separate matter from the issue above.
Hi @tylerjereddy, thank you for the review! I reviewed Best regards, |
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.
In general I'm not a big fan of changing the tolerances, especially towards looser values. Could you please explain why this was necessary?
Using tighter tolerances might be good, but it is also possible that people with slightly different configurations will see more test failures. CI seems happy with them, but if they are strict enough, maybe it's better not to make them even stricter.
package/AUTHORS
Outdated
- Namir Oues | ||
|
||
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.
with expectation: | ||
rmsd = align.alignto( | ||
universe, reference, subselection=subselection | ||
) | ||
assert_allclose(rmsd[1], 0.0, rtol=0, atol=1.5e-9) | ||
assert_allclose(rmsd[1], 0.0, rtol=0, atol=1.5e-7) |
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.
Why Is this necessary? It makes the test looser.
@@ -242,7 +241,7 @@ def test_rmsd(self, universe, reference): | |||
rms.rmsd(first_frame, first_frame), | |||
0.0, | |||
rtol=0, | |||
atol=1.5e-5, | |||
atol=1.5e-7, |
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.
Why Is this necessary? It makes the test looser.
@RMeli, Regarding the changes in I completely agree that loosening the tolerances can reduce the precision of the tests, and I apologize for this oversight. To fix this, I’ll revert the tolerances back to their original values ( For the stricter tolerances in other tests (like On the I’ll push the changes to revert the looser tolerances shortly. Looking forward to your feedback on this approach! |
@RMeli, |
Thanks @Abdulrahman-PROG. As mentioned, I have some reservations on making the tests stricter. @MDAnalysis/coredevs, any opinions? |
For consistency, I'd try to keep it as close to the original as possible. |
@RMeli @orbeckst @tylerjereddy |
Fixes #3743
Changes made in this Pull Request:
atol
) in theassert_allclose()
function withintest_align.py
to ensure all tests pass locally.atol
in_assert_rmsd
to2e-6
to accommodate small differences (e.g.,1.493334e-06
) intest_AlignTraj
andtest_AlignTraj_in_memory
.atol
intest_alignto_partial_universe
to1.5e-3
to handle a maximum difference of0.00133514
.atol
inTestAverageStructure
tests to2e-5
to cover differences like1.5258789e-05
.PR Checklist
package/CHANGELOG
file updated? (No, not applicable for this change)package/AUTHORS
? (If it is not, add it!) (No, will add if requested)Developers Certificate of Origin
I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.
📚 Documentation preview 📚: https://mdanalysis--4951.org.readthedocs.build/en/4951/