From bfb6ab8d58df3813e095f8d05d34176fc18333b1 Mon Sep 17 00:00:00 2001 From: Philip Loche Date: Mon, 30 Jan 2023 16:24:13 +0100 Subject: [PATCH] proofread --- package/CHANGELOG | 2 +- package/MDAnalysis/analysis/base.py | 51 ++++++++++--------- .../MDAnalysisTests/analysis/test_base.py | 3 -- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/package/CHANGELOG b/package/CHANGELOG index 2c975780c72..41ffd4f01aa 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -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) diff --git a/package/MDAnalysis/analysis/base.py b/package/MDAnalysis/analysis/base.py index c709fe6e6a8..734e37b6693 100644 --- a/package/MDAnalysis/analysis/base.py +++ b/package/MDAnalysis/analysis/base.py @@ -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): diff --git a/testsuite/MDAnalysisTests/analysis/test_base.py b/testsuite/MDAnalysisTests/analysis/test_base.py index a4ecd7c1a5a..b17fb616d1b 100644 --- a/testsuite/MDAnalysisTests/analysis/test_base.py +++ b/testsuite/MDAnalysisTests/analysis/test_base.py @@ -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)