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

timestep #4447

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
33 changes: 22 additions & 11 deletions package/MDAnalysis/coordinates/timestep.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -493,20 +493,31 @@ cdef class Timestep:
vectors lengths followed by their respective angle, or as three
triclinic vectors.

>>> ts.dimensions
array([ 13., 14., 15., 90., 90., 90.], dtype=float32)
>>> ts.triclinic_dimensions
array([[ 13., 0., 0.],
[ 0., 14., 0.],
[ 0., 0., 15.]], dtype=float32)
.. testsetup::

>>> import MDAnalysis as mda
>>> from MDAnalysis.tests.datafiles import TPR, XTC
>>> import numpy as np
>>> u = mda.Universe(TPR, XTC)
>>> ts = u.trajectory[0]
Comment on lines +498 to +502
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on a similar PR https://github.com/MDAnalysis/mdanalysis/pull/4374/files these lines should be indented to look like

         .. testsetup::
            import MDAnalysis as mda
            from MDAnalysis.tests.datafiles import TPR, XTC
            ...

and I am not 100% sure if >>> should remain.


.. doctest::

>>> print(np.round(ts.dimensions))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is rounding really required? It makes for less clear documentation. I'd like to get rid of it if at all possible so that it does not distract from what we are really interested in, namely ts.dimensions. The documentation aspect is more important than the testing...

[80. 80. 80. 60. 60. 90.]
>>> print(np.round(ts.triclinic_dimensions))
[[80. 0. 0.]
[ 0. 80. 0.]
[40. 40. 57.]]

Setting the attribute also works::


.. doctest::

>>> ts.triclinic_dimensions = [[15, 0, 0], [5, 15, 0], [5, 5, 15]]
>>> ts.dimensions
array([ 15. , 15.81138802, 16.58312416, 67.58049774,
72.45159912, 71.56504822], dtype=float32)

>>> print(np.round(ts.dimensions))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rounding here just gives the wrong output. Find a way to do this without round.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orbeckst I am getting this error

autodoc: failed to import module 'hole2' from module 'MDAnalysis.analysis'; the following exception was raised:
No module named 'mdahole2'
make: *** [Makefile:130: doctest] Error 2

I think mdahole2 uses python 3.11 or less I am using 3.12 so I am unable to install mdahole2. please check the error report I have attached in an earlier message. I will make the requested changes once this is resolved

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might have to install in a Python 3.11 environment for testing. The development version is a work in progress and even though we strive to make it fully usable, this is not always possible until close to a release.

[15. 16. 17. 68. 72. 72.]

See Also
--------
:func:`MDAnalysis.lib.mdamath.triclinic_vectors`
Expand Down
Loading