Skip to content

Commit

Permalink
proofread
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCentauri committed Jan 30, 2023
1 parent a6d9ef2 commit bfb6ab8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Fixes
(Issue #3336)

Enhancements
* Add a `AnalayisCollection` class to perform multiple analysis on the same
* Add an `AnalayisCollection` class to perform multiple analysis on the same
trajectory (#3569, PR #4017).
* Add pickling support for Atom, Residue, Segment, ResidueGroup
and SegmentGroup. (PR #3953)
Expand Down
51 changes: 26 additions & 25 deletions package/MDAnalysis/analysis/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,56 +230,57 @@ class AnalysisCollection(object):
The class assumes that each analysis is a child of
:class:`MDAnalysis.analysis.base.AnalysisBase`. Additionally,
the trajectory of all ``analysis_objects`` must be same.
the trajectory of all ``analysis_objects`` must be the same.
By default it is ensured that all analyisis objects use the
By default, it is ensured that all analysis objects use the
*same original* timestep and not an altered one from a previous analysis
object. This behaviour can be changed with the ``reset_timestep`` parameter
object. This behavior can be changed with the ``reset_timestep`` parameter
of the :meth:`MDAnalysis.analysis.base.AnalysisCollection.run` method.
Parameters
----------
*analysis_objects : tuple
List of analysis classes to run on the same trajectory.
List of analysis classes to run on the same trajectory.
Raises
------
AttributeError
If the provided ``analysis_objects`` do not have the same trajectory.
If all the provided ``analysis_objects``do not have the same trajectory.
AttributeError
If an ``analysis_object`` is not a child of
:class:`MDAnalysis.analysis.base.AnalysisBase`.
If an ``analysis_object`` is not a child of
:class:`MDAnalysis.analysis.base.AnalysisBase`.
Example
-------
.. code-block:: python
import MDAnalysis as mda
from MDAnalysis.analysis.rdf import InterRDF
from MDAnalysis.analysis.base import AnalysisCollection
from MDAnalysisTests.datafiles import TPR, XTC
import MDAnalysis as mda
from MDAnalysis.analysis.rdf import InterRDF
from MDAnalysis.analysis.base import AnalysisCollection
from MDAnalysisTests.datafiles import TPR, XTC
u = mda.Universe(TPR, XTC)
u = mda.Universe(TPR, XTC)
# Select atoms
ag_O = u.select_atoms("name O")
ag_H = u.select_atoms("name H")
# Select atoms
ag_O = u.select_atoms("name O")
ag_H = u.select_atoms("name H")
# Create individual analysis objects
rdf_OO = InterRDF(ag_O, ag_O)
rdf_OH = InterRDF(ag_H, ag_H)
# Create individual analysis objects
rdf_OO = InterRDF(ag_O, ag_O)
rdf_OH = InterRDF(ag_H, ag_H)
# Create collection for common trajectory
collection = AnalysisCollection(rdf_OO, rdf_OH)
# Create a collection for common trajectory
collection = AnalysisCollection(rdf_OO, rdf_OH)
# Run the collected analysis
collection.run(start=0, end=100, step=10)
# Run the collected analysis
collection.run(start=0, end=100, step=10)
# Results are stored in indivial objects
print(rdf_OO.results)
print(rdf_OH.results)
# Results are stored in individual objects
print(rdf_OO.results)
print(rdf_OH.results)
.. versionadded:: 2.5.0
"""

def __init__(self, *analysis_objects):
Expand Down
3 changes: 0 additions & 3 deletions testsuite/MDAnalysisTests/analysis/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,6 @@ def _single_frame(self):
else:
assert_allclose(ana_2.ref_pos, ana_1.ref_pos + 10)

def test_no_trajectory_manipulation(self):
pass

def test_inconsistent_trajectory(self, universe):
v = mda.Universe(TPR, XTC)

Expand Down

0 comments on commit bfb6ab8

Please sign in to comment.