-
Notifications
You must be signed in to change notification settings - Fork 664
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 #2469 #2614
issue #2469 #2614
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.
How do your changes address the points raised in #2469 ?
There's @lilyminium 's #2469 (comment) and talk about doc changes. Can you explain a bit more your approach?
I tried to avoid the missing attribute error using a warning. I really couldn't understand why there's a need straight away put |
@lilyminium could you provide a quick comment if you have time? @PicoCentauri do you have time to look after this PR as the main reviewer? |
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.
Thanks for looking at this @siddharthjain1611! match_atoms
is currently set to True
by default because that matches the historical behaviour of the class before match_atoms
was added as a keyword. It checks that the alignment selection atoms have similar element-wise masses, to make sure that you're not accidentally doing something weird, like aligning your molecule backwards.
@orbeckst Yes I have time to do the main review. |
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.
I agree with @lilyminium. It is probably better to add if not hasattr(ag1, 'masses') and hasattr(ag2, 'masses')
directly after if math_atoms
to check wether both groups contain masses. If not you can warn the user saying that "Atoms could not be matched since they don't contain masses."
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.
Looks good!
Now please also add a test to the TestAlign class. You can use a with statement together with pytest to test your warning with pytest.warns():
.
Okay sir, I'll do that and get back to you as soon as possible. |
Sir, why are these tests being added to Edit: Which new function should be created or referenced. What should be the contents for the same? |
You are right it should be in Create a function like reference = make_Universe()
align.get_matching_atoms(reference.atoms, reference.atoms) should do the job. |
@PicoCentauri Sir, Please find some time to review my PR again. |
Hey @siddharthjain1611 sorry for the delay! I will review your PR later today. For now try to check why all tests are failing. |
Sure, Sir |
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.
Looks quite good now. Just a few things:
-
Why do you need the
testsuite/MDAnalysisTests/data/rmsfit_adk_dims.dcd
? It is not used in any of your tests. -
Due to your fix the
test_fit_translation_no_masses
is failing sincefit_translation
now raises anValueError
in line 104 rather anAttributeError
in line 102. For now I would just changeAttributeError
byValueError
in the test. -
In addition add yourself the the AUTHORS and add your changes to the CHANGELOG.
I'll delete the file |
My review was a blocking comment until the PR was more substantial. Other revieers have taken over.
@orbeckst Sir, is the pr not appropriate? Does it need more work? |
Your are right. The creation is valid but the method |
Is this pr ready for merging? |
First you have to fix the |
I'll fix that as soon as possible. |
@PicoCentauri Sir, For that problem, I feel setting the mass to |
You really want that the test raises an error here. The purpose of tests is not only to check wether code works but also to check that it raises errors under certain conditions. |
Okay sir, would just a warning be sufficient? |
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.
I checked our changes locally and if you do these changes it should work out
package/MDAnalysis/analysis/align.py
Outdated
errmsg = ("Failed to automatically find matching atoms: created empty selections. " + | ||
"Try to improve your selections for mobile and reference.") | ||
errmsg = ("Failed to automatically find matching atoms: created empty selections. " | ||
"Try to improve your selections for mobile and reference.") |
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.
This is still to be fixed
@PicoCentauri @lilyminium Please review 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.
Very good. Just remove the spaces and I am happy
@PicoCentauri Sir, I think the spaces look fine now, Please find some time to have a look :) |
package/MDAnalysis/analysis/align.py
Outdated
logger.error(errmsg) | ||
raise SelectionError(errmsg) | ||
if (not hasattr(ag1, 'masses') or not hasattr(ag2, 'masses')): | ||
# # WARNING: |
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.
Finally, remove this superfluous comment if you want.
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.
I saw a comment of this kind somewhere else, therefore I wrote it.
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.
Having the comment there is not bad but I would say not needed because the code itself clearly says "warning".
However, I see a PEP8 issue below...
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.
Looking good, @siddharthjain1611, nearly there. Please remove rmsfit_adk_dims.dcd
also. Thank you!
@PicoCentauri – you have the power to dismiss @lilyminium 's request if you think that her points have been addressed and if she doesn't have the time to look at the PR. If you do this, you just write a short justification message and go ahead. |
Oops – apparently @lilyminium commented 30 seconds ago.... ignore my previous comment ;-). |
Co-Authored-By: Oliver Beckstein <orbeckst@gmail.com>
Co-Authored-By: Oliver Beckstein <orbeckst@gmail.com>
Thanks @siddharthjain1611, I'm happy with this but let's wait for Travis to go green. Don't forget to remove |
Sorry, ma'am wasn't able to find that file in pr. I think I already discarded that in my system, but even if by mistake I pushed it. Please do point it out. I'll happily do it. |
@siddharthjain1611 You can delete this file on GitHub itself: https://github.com/MDAnalysis/mdanalysis/pull/2614/files#diff-216eba108275dddf90ef894a79bb8699 |
Done ma'am. |
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.
Awesome, looks good to me and thanks for the contribution! I'll let @PicoCentauri do the honours.
Thank you, ma'am. Got to learn a lot from both of you. |
@PicoCentauri @lilyminium is the PR ready for merging? |
@PicoCentauri seems to be busy so I've just merged it now. Congratulations on your first contribution! |
Update of AUTHORS and CHANGELOG with inferred author contributions. * Removed duplicate mattwthompson in 0.20.0 changelog entry.: mattwthompson was placed twice by accident, this removes this duplication. * Addition of missing authors. An retrospective analysis of the authors found via `git shortlog -s -n --email --branches="develop"` found several commits by authors which were not present in the `AUTHORS.md` file. - Zhenbo Li: commited via PR: Started tests for gnm. #803 and Make Travis run tests on OSX. #771, - Jenna M. Swarthout via PR Update CoC according to suggestions from current CoC committee #4289 and Point to new reporting form link (owned by conduct@mdanalysis.org) #4298, - Bradley Dice via PR Fix GSD Windows compatibility #2384 , - David Minh via PR #2668 There seemed to be no indications in the above mentioned PRs that the author did not want to be in the authors file, it looks like it was just forgotten. * Addition of missing entries from the changelog Continued cross referencing of the git shortlog output but also accounting for the changelog identified several individuals that had not been included in the changelog entries for the release they contributed under. They were added to the relevant entry of the changelog based on the merge commit date. Please note that for Tone Bengsten, we a) had no github handle (so they were assigned @tbengtsen), and b) no specific commit. Given we know that this individual was including alongside the encore merge, they were assigned to the 0.16.0 release. * Update CHANGELOG * PR #1218 * PR #1284 and #1408 * PR #4109 * based on git history * PRs #803 and #771 (author addition, changelog addition) * PR #2255 and #2221 * PR #1225 * PR #4289 and #4298 * PR #4031 * PR #4085 * PR #3635 * PR #2356 * PR #2559 * No GH handle - Encore author addition @tbengtsen * PR #4184 * PR #2614 * PR #2219 * PR #2384 * PR #2668 * Add missing entry for Jenna Thanks to @fiona-naughton for helping out with digging into this data :) Co-authored-by: Fiona Naughton <fiona@mdanalysis.org> Co-authored-by: Oliver Beckstein <orbeckst@mdanalysis.org>
Fixes #2469
Changes made in this Pull Request:
PR Checklist