Skip to content
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

Failed doc examples in align.py #3365

Closed
lilyminium opened this issue Jul 19, 2021 · 12 comments · Fixed by #4182
Closed

Failed doc examples in align.py #3365

lilyminium opened this issue Jul 19, 2021 · 12 comments · Fixed by #4182

Comments

@lilyminium
Copy link
Member

lilyminium commented Jul 19, 2021

Expected behavior

Sub-issue of #760

Doc examples work.

Actual behavior

This is after changing a >>> in the rotation matrix example to ...

================================================== FAILURES ===================================================
_____________________________________ [doctest] MDAnalysis.analysis.align _____________________________________
069    >>> from MDAnalysis.analysis.rms import rmsd
070    >>> from MDAnalysis.tests.datafiles import PSF, DCD, PDB_small
071
072
073 In the simplest case, we can simply calculate the C-alpha RMSD between
074 two structures, using :func:`rmsd`::
075
076    >>> ref = mda.Universe(PDB_small)
077    >>> mobile = mda.Universe(PSF,DCD)
078    >>> rmsd(mobile.select_atoms('name CA').positions, ref.select_atoms('name CA').positions)
Expected:
    16.282308620224068
Got:
    28.20178579474479

/Users/lily/pydev/mdanalysis/package/MDAnalysis/analysis/align.py:78: DocTestFailure
_____________________________ [doctest] MDAnalysis.analysis.align.rotation_matrix _____________________________
238         RMSD between `a` and `b` before rotation
239     ``(R, rmsd)`` rmsd and rotation matrix *R*
240
241     Example
242     -------
243     `R` can be used as an argument for
244     :meth:`MDAnalysis.core.groups.AtomGroup.rotate` to generate a rotated
245     selection, e.g. ::
246
247     >>> R = rotation_matrix(A.select_atoms('backbone').positions,
UNEXPECTED EXCEPTION: NameError("name 'A' is not defined")
Traceback (most recent call last):
  File "/Users/lily/anaconda3/envs/mda-dev/lib/python3.7/doctest.py", line 1329, in __run
    compileflags, 1), test.globs)
  File "<doctest MDAnalysis.analysis.align.rotation_matrix[0]>", line 1, in <module>
NameError: name 'A' is not defined
/Users/lily/pydev/mdanalysis/package/MDAnalysis/analysis/align.py:247: UnexpectedException
=========================================== short test summary info ===========================================
FAILED analysis/align.py::MDAnalysis.analysis.align
FAILED analysis/align.py::MDAnalysis.analysis.align.rotation_matrix

Code to reproduce the behavior

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import PSF, DCD,  GRO, PDB, TPR, XTC, TRR,  PRMncdf, NCDF

u = mda.Universe(PSF, DCD)

....

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)") 8f9f402
  • Which version of Python (python -V)? 3.7.3
  • Which operating system? Mac Catalina
@ojeda-e
Copy link
Member

ojeda-e commented Mar 29, 2022

Should we tag this with good first issue, @lilyminium ?

@lilyminium
Copy link
Member Author

lilyminium commented Mar 29, 2022

Sure :)

There are actually two issues here, and people should feel welcome to only fix one in a PR if they want.

The important errors are:

>>> ref = mda.Universe(PDB_small)
077    >>> mobile = mda.Universe(PSF,DCD)
078    >>> rmsd(mobile.select_atoms('name CA').positions, ref.select_atoms('name CA').positions)
Expected:
    16.282308620224068
Got:
    28.20178579474479

Here, the fix is fairly simple -- change the expected number.

UNEXPECTED EXCEPTION: NameError("name 'A' is not defined")
Traceback (most recent call last):
  File "/Users/lily/anaconda3/envs/mda-dev/lib/python3.7/doctest.py", line 1329, in __run
    compileflags, 1), test.globs)
  File "<doctest MDAnalysis.analysis.align.rotation_matrix[0]>", line 1, in <module>
NameError: name 'A' is not defined
/Users/lily/pydev/mdanalysis/package/MDAnalysis/analysis/align.py:247: UnexpectedException

Here, the problem is less simple -- a whole universe needs to be defined to substitute A, as was done with the example higher in this comment.

The automated CI won't catch the problem, so it would be great if anyone who opened a PR pasted the code into a notebook or iPython to demonstrate it works.

@aditi2906
Copy link
Contributor

Hello @lilyminium,
I was going through the code of align.py, and it reflects the expected calculation to be 28.20178579474479 instead of 16.282308620224068. However, it has not been released yet on the official documentation. It is still 16.282308620224068 in the 2.0.0 beta version.

@Ranit-Bandyopadhyay
Copy link

I would like to solve this issue. can you please provide some more details and how to approach this.

@chandra20500
Copy link

Hi, I would like to work on this Issue. it would be great could you please assign this issue to me

@jhunjhunwala1234
Copy link

I want to solve this issue please assign me this issue

@RMeli
Copy link
Member

RMeli commented Feb 19, 2023

Hi @jhunjhunwala1234, usually issues are not assigned to people in MDAnalysis. If you want to work on an issue, just work on it and open a pull request with your fix when you think it's ready. Other developers will then review your PR, on a first come first served basis.

Please note that there is already an open PR addressing this issue (see PR #4023).

@muhib-siddique
Copy link

hi i want work on this issue please assing me this issue

@pradeeprao31
Copy link

I want to solve this issue please assign me this issue because of my study area B.Tech CSE (Data Science)

@RMeli
Copy link
Member

RMeli commented Mar 27, 2023

@pradeeprao31, as explained above we don’t assign issues. If you want to work on an issue, just work on it and open a pull request with your fix when you think it's ready. Just make sure there is not an active PR against the issue you want to work on, since earlier PRs will be reviewed first.

@MohitKumar020291
Copy link
Contributor

Dear mentors, I just opened a PR #4182. Please review it.

@pradeeprao31
Copy link

pradeeprao31 commented Jun 30, 2023 via email

orbeckst pushed a commit that referenced this issue Jul 3, 2023
* fix #3365
* fixed all doc tests in analysis.align
* Update AUTHORS
* Update CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants