Skip to content

Commit

Permalink
Numpyfy docstrings
Browse files Browse the repository at this point in the history
Update the docstrings everywhere in the package but in the anlysis.
  • Loading branch information
jbarnoud committed Mar 19, 2017
1 parent c6ea5d8 commit fc52bf2
Show file tree
Hide file tree
Showing 31 changed files with 521 additions and 364 deletions.
4 changes: 3 additions & 1 deletion package/MDAnalysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@
9.72062
....
.. SeeAlso:: :class:`MDAnalysis.core.universe.Universe` for details
See Also
--------
See :class:`MDAnalysis.core.universe.Universe` for details
Examples
Expand Down
6 changes: 5 additions & 1 deletion package/MDAnalysis/auxiliary/XVG.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,13 @@ def _go_to_step(self, i):
Parameters
----------
i : int
i: int
Step number (0-indexed) to move to
Returns
-------
:class:`XVGStep`
Raises
------
ValueError
Expand Down
13 changes: 8 additions & 5 deletions package/MDAnalysis/coordinates/CRD.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,14 @@ def _read_first_frame(self):
def Writer(self, filename, **kwargs):
"""Returns a CRDWriter for *filename*.
:Arguments:
*filename*
filename of the output CRD file
:Returns: :class:`CRDWriter`
Parameters
----------
filename: str
filename of the output CRD file
Returns
-------
:class:`CRDWriter`
"""
return CRDWriter(filename, **kwargs)
Expand Down
157 changes: 84 additions & 73 deletions package/MDAnalysis/coordinates/DCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
:class:`MDAnalysis.coordinates.LAMMPS.DCDReader` for NAMD
trajectories.
.. SeeAlso:: The :mod:`MDAnalysis.coordinates.LAMMPS` module provides
a more flexible DCD reader/writer.
See Also
--------
The :mod:`MDAnalysis.coordinates.LAMMPS` module provides a more flexible DCD
reader/writer.
The classes in this module are the reference implementations for the
Trajectory API.
Expand Down Expand Up @@ -209,29 +211,31 @@ def __init__(self, filename, n_atoms, start=0, step=1,
remarks="Created by DCDWriter", convert_units=None):
"""Create a new DCDWriter
:Arguments:
*filename*
name of output file
*n_atoms*
number of atoms in dcd file
*start*
starting timestep
*step*
skip between subsequent timesteps (indicate that *step* MD
integrator steps (!) make up one trajectory frame); default is 1.
*delta*
timestep (MD integrator time step (!), in AKMA units); default is
20.45482949774598 (corresponding to 1 ps).
*remarks*
comments to annotate dcd file
*dt*
**Override** *step* and *delta* so that the DCD records that *dt* ps
lie between two frames. (It sets *step* = 1 and *delta* = ``AKMA(dt)``.)
The default is ``None``, in which case *step* and *delta* are used.
*convert_units*
units are converted to the MDAnalysis base format; ``None`` selects
the value of :data:`MDAnalysis.core.flags` ['convert_lengths'].
(see :ref:`flags-label`)
Parameters
----------
filename: str
name of output file
n_atoms: int
number of atoms in dcd file
start: int
starting timestep
step: int
skip between subsequent timesteps (indicate that *step* MD
integrator steps (!) make up one trajectory frame); default is 1.
delta: float
timestep (MD integrator time step (!), in AKMA units); default is
20.45482949774598 (corresponding to 1 ps).
remarks: str
comments to annotate dcd file
dt: float
**Override** *step* and *delta* so that the DCD records that
*dt* ps lie between two frames. (It sets *step* = 1 and
*delta* = ``AKMA(dt)``.) The default is ``None``, in which case
*step* and *delta* are used.
convert_units: bool
units are converted to the MDAnalysis base format; ``None`` selects
the value of :data:`MDAnalysis.core.flags` ['convert_lengths'].
(see :ref:`flags-label`)
.. Note::
Expand Down Expand Up @@ -336,7 +340,9 @@ def write_next_timestep(self, ts=None):
def convert_dimensions_to_unitcell(self, ts, _ts_order=Timestep._ts_order):
"""Read dimensions from timestep *ts* and return appropriate native unitcell.
.. SeeAlso:: :attr:`Timestep.dimensions`
See Also
--------
:attr:`Timestep.dimensions`
"""
# unitcell is A,B,C,alpha,beta,gamma - convert to order expected by low level DCD routines
lengths, angles = ts.dimensions[:3], ts.dimensions[3:]
Expand Down Expand Up @@ -510,23 +516,24 @@ def timeseries(self, asel=None, start=None, stop=None, step=None, skip=None,
format='afc'):
"""Return a subset of coordinate data for an AtomGroup
:Arguments:
*asel*
:class:`~MDAnalysis.core.groups.AtomGroup` object
Defaults to None, in which case the full set of coordinate data
is returned.
*start*, *stop*, *step*
A range of the trajectory to access, with start being inclusive
and stop being exclusive.
*format*
the order/shape of the return data array, corresponding
to (a)tom, (f)rame, (c)oordinates all six combinations
of 'a', 'f', 'c' are allowed ie "fac" - return array
where the shape is (frame, number of atoms,
coordinates)
:Deprecated:
*skip*
Skip has been deprecated in favor of the standard keyword step.
Parameters
----------
asel: :class:`~MDAnalysis.core.groups.AtomGroup`
The :class:`~MDAnalysis.core.groups.AtomGroup` to read the
coordinates from. Defaults to None, in which case the full set of
coordinate data is returned.
start, stop, step: int
A range of the trajectory to access, with start being inclusive
and stop being exclusive.
format: str
the order/shape of the return data array, corresponding
to (a)tom, (f)rame, (c)oordinates all six combinations
of 'a', 'f', 'c' are allowed ie "fac" - return array
where the shape is (frame, number of atoms,
coordinates)
.. deprecated:: 0.016.0
*skip* has been deprecated in favor of the standard keyword step.
"""
if skip is not None:
step = skip
Expand All @@ -553,15 +560,15 @@ def timeseries(self, asel=None, start=None, stop=None, step=None, skip=None,
def correl(self, timeseries, start=None, stop=None, step=None, skip=None):
"""Populate a TimeseriesCollection object with timeseries computed from the trajectory
:Arguments:
*timeseries*
:class:`MDAnalysis.core.Timeseries.TimeseriesCollection`
*start, stop, step*
A subset of the trajectory to use, with start being inclusive
and stop being exclusive.
:Deprecated:
*skip*
Skip has been deprecated in favor of the standard keyword step.
Parameters
----------
timeseries: :class:`MDAnalysis.core.Timeseries.TimeseriesCollection`
start, stop, step: int
A subset of the trajectory to use, with start being inclusive and
stop being exclusive.
.. deprecated:: 0.16.0
*skip* has been deprecated in favor of the standard keyword step.
"""
if skip is not None:
step = skip
Expand Down Expand Up @@ -590,34 +597,38 @@ def Writer(self, filename, **kwargs):
All values can be changed through keyword arguments.
:Arguments:
*filename*
filename of the output DCD trajectory
:Keywords:
*n_atoms*
number of atoms
*start*
number of the first recorded MD step
*step*
indicate that *step* MD steps (!) make up one trajectory frame
*delta*
MD integrator time step (!), in AKMA units
*dt*
**Override** *step* and *delta* so that the DCD records that *dt* ps
lie between two frames. (It sets *step* = 1 and *delta* = ``AKMA(dt)``.)
The default is ``None``, in which case *step* and *delta* are used.
*remarks*
string that is stored in the DCD header [XXX -- max length?]
:Returns: :class:`DCDWriter`
Parameters
----------
filename: str
filename of the output DCD trajectory
n_atoms: int
number of atoms
start: int
number of the first recorded MD step
step: int
indicate that *step* MD steps (!) make up one trajectory frame
delta: float
MD integrator time step (!), in AKMA units
dt: float
**Override** *step* and *delta* so that the DCD records that
*dt* ps lie between two frames. (It sets *step* = 1 and
*delta* = ``AKMA(dt)``.) The default is ``None``, in which case
*step* and *delta* are used. *remarks* string that is stored in
the DCD header
Returns
-------
:class:`DCDWriter`
.. Note::
The keyword arguments set the low-level attributes of the DCD
according to the CHARMM format. The time between two frames would be
*delta* * *step* !
.. SeeAlso:: :class:`DCDWriter` has detailed argument description
See Also
--------
:class:`DCDWriter` has detailed argument description
"""
n_atoms = kwargs.pop('n_atoms', self.n_atoms)
kwargs.setdefault('start', self.start_timestep)
Expand Down
33 changes: 20 additions & 13 deletions package/MDAnalysis/coordinates/GRO.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,14 @@ def _read_first_frame(self):
def Writer(self, filename, **kwargs):
"""Returns a CRDWriter for *filename*.
:Arguments:
*filename*
Parameters
----------
filename: str
filename of the output GRO file
:Returns: :class:`GROWriter`
Returns
-------
:class:`GROWriter`
"""
return GROWriter(filename, **kwargs)
Expand Down Expand Up @@ -240,9 +243,13 @@ class GROWriter(base.WriterBase):
def __init__(self, filename, convert_units=None, **kwargs):
"""Set up a GROWriter with a precision of 3 decimal places.
:Arguments:
*filename*
output filename
Parameters
----------
filename: str
output filename
convert_units: bool
units are converted to the MDAnalysis base format; ``None`` selects
the value of :data:`MDAnalysis.core.flags` ['convert_lengths']
"""
self.filename = util.filename(filename, ext='gro')

Expand All @@ -253,13 +260,13 @@ def __init__(self, filename, convert_units=None, **kwargs):
def write(self, selection, frame=None):
"""Write selection at current trajectory frame to file.
:Arguments:
selection
MDAnalysis AtomGroup (selection or Universe.atoms)
or also Universe
:Keywords:
frame
optionally move to frame number *frame*
Parameters
----------
selection:
The :class:`~MDAnalysis.core.groups.AtomGroup` or :class:`Universe`
to write
frame: int
optionally move to frame number *frame*
The GRO format only allows 5 digits for resid and atom
number. If these number become larger than 99,999 then this
Expand Down
13 changes: 7 additions & 6 deletions package/MDAnalysis/coordinates/MOL2.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,13 @@ def __init__(self, filename, n_atoms=None,
convert_units=None):
"""Create a new MOL2Writer
:Arguments:
*filename*
name of output file
*convert_units*
units are converted to the MDAnalysis base format; ``None`` selects
the value of :data:`MDAnalysis.core.flags` ['convert_lengths']
Parameters
----------
filename: str
name of output file
convert_units: bool
units are converted to the MDAnalysis base format; ``None`` selects
the value of :data:`MDAnalysis.core.flags` ['convert_lengths']
"""
self.filename = filename
if convert_units is None:
Expand Down
Loading

0 comments on commit fc52bf2

Please sign in to comment.