-
Notifications
You must be signed in to change notification settings - Fork 279
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
Issue 1829 #1841
Issue 1829 #1841
Conversation
Thanks for the PR submission! Left a couple of comments. Also - it looks like all the tests passed but could you also run this test for |
# Test that linear coordinates yield 180 degrees, not "nan" | ||
a = md.load(get_fn('mol.gro')) | ||
b = md.compute_angles(a, [[0, 1, 2]]) | ||
assert not np.isnan(b[0][0]) |
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.
If this angle is meant to be 180 / pi, could we assert that as well? (Or that it's close to pi - pytest.approx
is one way to do this)
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.
Thought I'd replied to this but obviously not: good idea, thanks for the suggestion, I've added the extra test
To be frank I'm a little surprised a change this potentially far-reaching didn't have any side effects. Then again, it's a poorly-defined edge case so I guess it wasn't hit at all in tests before. |
No problem - I've run the test locally ( |
Great! I looked through the CI logs for the other
Do we think this is something of note? My initial impression is that this simply means we have a little more overhead in dealing with our angles testing but that's relatively minor and I'm not super worried. I need to think about it myself more but I wanted to flag it just in case it was more immediately obvious to others. |
tests/test_angles.py
Outdated
def test_angle_180(get_fn): | ||
# Test that linear coordinates yield 180 degrees, not "nan" | ||
a = md.load(get_fn('mol.gro')) | ||
b = md.compute_angles(a, [[0, 1, 2]]) |
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.
def test_angle_180(get_fn): | |
# Test that linear coordinates yield 180 degrees, not "nan" | |
a = md.load(get_fn('mol.gro')) | |
b = md.compute_angles(a, [[0, 1, 2]]) | |
@pytest.mark.parametrize("optimize", [True, False]) | |
def test_angle_180(get_fn, optimize): | |
# Test that linear coordinates yield 180 degrees, not "nan" | |
a = md.load(get_fn('mol.gro')) | |
b = md.compute_angles(a, [[0, 1, 2]], opt=optimize) |
IIRC these functions have "NumPy" and "our own C code" pathways - as you modified both - so in principle both paths should be tested
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.
Ah - now we get failures due to the default tolerance in pytest.approx (1e-6) being exceeded. If I reduce it to 1e-4, things are OK again. Are you happy to accept this?
If it's a new warning, yeah we should avoid that |
Co-authored-by: Matt Thompson <matt.thompson@openforcefield.org>
I think I have just uncovered something that was already there - that trajectories loaded from Gromacs .gro format files have their unit cell vectors returned as float64s. A non-exhaustive scan through other file formats suggests there is no consistency here - different ones may return float32 or float64s... |
Looks like the warning is only coming after the newly inserted test
Oh interesting I wonder if it's due to the precision of the file format being loaded in (and trying to capture as much useful precision as possible). Probably a discussion for a separate issue/PR (but doesn't have to be!) |
It seems the warning was appearing because in angles.py |
Great find! I see now the repeated use of All the tests pass as expected and no new warning LGTM! Assuming @mattwthompson has no additional comments/concerns, I think this is okay for approval/merge? |
Fell behind on merging this in but it looks like you might need to |
OK - I have re-synced my fork - please try again! |
Hrmmm looks like the conflicts are still there in In
and in
I can resolve these conflicts and it should be relatively easy, but is it easier for you to resolve these on your branch in the PR? If so then want to resolve it on your end? |
Those are lints with the exception of the new flag |
Oh! Thanks for explaining that! Hrmm it looks like
I'm rerunning the test now in case that was a fluke but otherwise we'll want to see what's going on... |
Huh, weird - passed this time.... Assuming no other issues crop up @mattwthompson I'll go ahead and merge this at long last! Thanks again @CharlieLaughton for this great PR! |
Stuff's flaky, especially dealing with corner cases like these. I'm not alarmed by 1/N jobs in a matrix needing to run a second time |
Thanks guys, it's been a pleasure to assist. |
Proposed bugfix for issue #1829