Package gromacs :: Package analysis :: Package plugins :: Module dist :: Class Mindist
[hide private]
[frames] | no frames]

Class Mindist

source code

object --+
         |
        Mindist

The Mindist class allows analysis of the output from ``g_dist -dist CUTOFF``.

Output is read from a file or stream. The raw data is transformed
into a true 'mindist' time series (available in the
:attr:`Mindist.distances` attribute): for each frame only the
shortest distance is stored (whereas ``g_dist`` provides *all*
distances below the cutoff).

:TODO:
  * Save analysis to pickle or data files.
  * Export data as simple data files for plotting in other programs.

.. Note:: :class:`gromacs.tools.G_mindist` is apparently providing
          exactly the service that is required: a timeseries of
          the minimum distance between two groups. Feel free to
          use that tool instead :-).
  

Instance Methods [hide private]
 
__init__(self, datasource, cutoff=None)
Read mindist data from file or stream.
source code
 
histogram(self, nbins=None, lo=None, hi=None, midpoints=False, normed=True)
Returns a distribution or histogram of the minimum distances:
source code
 
plot(self, **kwargs)
Plot histograms with matplotlib's plot() function::
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  hist = property(** hist())
  dist = property(** dist())
  edges = property(** edges())
  midpoints = property(** midpoints())
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, datasource, cutoff=None)
(Constructor)

source code 
Read mindist data from file or stream.
Overrides: object.__init__

Arguments:

datasource
a filename (plain, gzip, bzip2) or file object
cutoff
the -dist CUTOFF that was provided to g_dist; if supplied we work around a bug in g_dist (at least in Gromacs 4.0.2) in which sometimes numbers >> CUTOFF are printed.

histogram(self, nbins=None, lo=None, hi=None, midpoints=False, normed=True)

source code 

Returns a distribution or histogram of the minimum distances:

If no values for the bin edges are given then they are set to 0.1 below and 0.1 above the minimum and maximum values seen in the data.

If the number of bins is not provided then it is set so that on average 100 counts come to a bin. Set nbins manually if the histogram only contains a single bin (and then get more data)!

Keywords:

nbins : int
number of bins
lo : float
lower edge of histogram
hi : float
upper edge of histogram
midpoints : boolean
False: return edges. True: return midpoints
normed : boolean
True: return probability distribution. False: histogram

plot(self, **kwargs)

source code 
Plot histograms with matplotlib's plot() function::

   plot(**histogramargs, **plotargs)

Arguments for both :meth:`Mindist.histogram` and :func:`pylab.plot` can be provided (qv).