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

Minor fixes #1247

Merged
merged 9 commits into from
May 7, 2017
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package/MDAnalysis/analysis/encore/similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
"""
=================================================================================
"""=================================================================================
Ensemble Similarity Calculations --- :mod:`MDAnalysis.analysis.encore.similarity`
=================================================================================

Expand Down Expand Up @@ -56,9 +55,12 @@
References
==========

.. [Lindorff-Larsen2009] Similarity Measures for Protein Ensembles. Lindorff-Larsen, K. Ferkinghoff-Borg, J. PLoS ONE 2008, 4, e4203.
.. [Lindorff-Larsen2009] Similarity Measures for Protein
Ensembles. Lindorff-Larsen, K. Ferkinghoff-Borg, J. PLoS ONE 2008, 4, e4203.

.. [Tiberti2015] ENCORE: Software for Quantitative Ensemble Comparison. Matteo Tiberti, Elena Papaleo, Tone Bengtsen, Wouter Boomsma, Kresten Lindorff- Larsen. PLoS Comput Biol. 2015, 11
.. [Tiberti2015] ENCORE: Software for Quantitative Ensemble Comparison. Matteo
Tiberti, Elena Papaleo, Tone Bengtsen, Wouter Boomsma, Kresten
Lindorff-Larsen. PLoS Comput Biol. 2015, 11, e1004415.

.. _Examples:
Examples
Expand Down Expand Up @@ -166,7 +168,6 @@

.. All functions are included via automodule :members:.


"""
from __future__ import print_function, division, absolute_import
from six.moves import range, zip
Expand Down
3 changes: 2 additions & 1 deletion package/MDAnalysis/analysis/encore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#
from __future__ import division, absolute_import
from six.moves import range
import numbers
from multiprocessing.sharedctypes import SynchronizedArray
from multiprocessing import Process, Manager
from joblib import cpu_count
Expand Down Expand Up @@ -68,7 +69,7 @@ def __init__(self, size, metadata=None, loadfile=None):
self.size = size
if loadfile:
self.loadz(loadfile)
elif isinstance(size, int):
elif isinstance(size, numbers.Integral):
self.size = size
self._elements = np.zeros((size + 1) * size // 2, dtype=np.float64)
elif isinstance(size, SynchronizedArray):
Expand Down
57 changes: 31 additions & 26 deletions package/MDAnalysis/auxiliary/XVG.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
========================================================

xvg files are produced by Gromacs during simulation or analysis, formatted
for plotting data with Grace.
for plotting data with Grace.

Data is column-formatted; time/data selection is enabled by providing column
indices.
Data is column-formatted; time/data selection is enabled by providing column
indices.

Note
----
By default, the time of each step is assumed to be stored in the first column,
By default, the time of each step is assumed to be stored in the first column,
in units of ps.


Expand All @@ -42,17 +42,17 @@

XVG Readers
-----------
The default :class:`XVGReader` reads and stores the full contents of the .xvg
file on initialisation, while a second reader (:class:`XVGFileReader`) that
reads steps one at a time as required is also provided for when a lower memory
The default :class:`XVGReader` reads and stores the full contents of the .xvg
file on initialisation, while a second reader (:class:`XVGFileReader`) that
reads steps one at a time as required is also provided for when a lower memory
footprint is desired.

Note
----
Data is assumed to be time-ordered.

Multiple datasets, separated in the .xvg file by '&', are currently not
supported (the readers will stop at the first line starting '&').
Multiple datasets, separated in the .xvg file by '&', are currently not
supported (the readers will stop at the first line starting '&').


.. autoclass:: XVGReader
Expand All @@ -69,6 +69,7 @@

from six.moves import range

import numbers
import os
import numpy as np
from . import base
Expand Down Expand Up @@ -106,8 +107,8 @@ def uncomment(lines):
class XVGStep(base.AuxStep):
""" AuxStep class for .xvg file format.

Extends the base AuxStep class to allow selection of time and
data-of-interest fields (by column index) from the full set of data read
Extends the base AuxStep class to allow selection of time and
data-of-interest fields (by column index) from the full set of data read
each step.

Parameters
Expand All @@ -134,7 +135,7 @@ def _select_time(self, key):
if key is None:
# here so that None is a valid value; just return
return
if isinstance(key, int):
if isinstance(key, numbers.Integral):
return self._select_data(key)
else:
raise ValueError('Time selector must be single index')
Expand All @@ -143,7 +144,7 @@ def _select_data(self, key):
if key is None:
# here so that None is a valid value; just return
return
if isinstance(key, int):
if isinstance(key, numbers.Integral):
try:
return self._data[key]
except IndexError:
Expand All @@ -156,23 +157,23 @@ def _select_data(self, key):
class XVGReader(base.AuxReader):
""" Auxiliary reader to read data from an .xvg file.

Detault reader for .xvg files. All data from the file will be read and stored
Detault reader for .xvg files. All data from the file will be read and stored
on initialisation.

Parameters
----------
filename : str
Location of the file containing the auxiliary data.
**kwargs
Other AuxReader options.
Other AuxReader options.

See Also
--------
:class:`~MDAnalysis.auxiliary.base.AuxReader`

Note
----
The file is assumed to be of a size such that reading and storing the full
The file is assumed to be of a size such that reading and storing the full
contents is practical.
"""

Expand All @@ -193,7 +194,7 @@ def __init__(self, filename, **kwargs):
# check the number of columns is consistent
if len(auxdata_values[i]) != len(auxdata_values[0]):
raise ValueError('Step {0} has {1} columns instead of '
'{2}'.format(i, auxdata_values[i],
'{2}'.format(i, auxdata_values[i],
auxdata_values[0]))
self._auxdata_values = np.array(auxdata_values)
self._n_steps = len(self._auxdata_values)
Expand Down Expand Up @@ -223,13 +224,17 @@ def _read_next_step(self):
raise StopIteration

def _go_to_step(self, i):
""" Move to and read i-th auxiliary step.
""" Move to and read i-th auxiliary step.

Parameters
----------
i : int
i: int
Step number (0-indexed) to move to
Copy link
Member

Choose a reason for hiding this comment

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

return value doc is missing


Returns
-------
:class:`XVGStep`

Raises
------
ValueError
Expand All @@ -256,16 +261,16 @@ def read_all_times(self):
class XVGFileReader(base.AuxFileReader):
""" Auxiliary reader to read (step at a time) from an .xvg file.

An alternative XVG reader which reads each step from the .xvg file as
needed (rather than reading and storing all from the start), for a lower
memory footprint.
An alternative XVG reader which reads each step from the .xvg file as
needed (rather than reading and storing all from the start), for a lower
memory footprint.

Parameters
----------
filename : str
Location of the file containing the auxiliary data.
**kwargs
Other AuxReader options.
Other AuxReader options.

See Also
--------
Expand Down Expand Up @@ -336,7 +341,7 @@ def _count_n_steps(self):
try:
return len(self._times)
except AttributeError:
# might as well build _times now, since we'll need to iterate
# might as well build _times now, since we'll need to iterate
# through anyway
self._times = self.read_all_times()
return len(self.read_all_times())
Expand Down
Loading