[gmx-users] A simple XVG viewer

Michael Lerner mglerner+gromacs at gmail.com
Thu Nov 5 16:19:55 CET 2009


(My apologies if this shows up several times. I sent it yesterday, but it
appears that it won't go through to the list if I include a screenshot.)

I wanted a quick way to plot the data in XVG files, so I wrote a quick
little GUI viewer in Python this morning. You point it at an XVG file and it
pops up a GUI where you can click buttons to step through the columns of
data, plot individual columns from the XVG file, or make a plot of
everything in the XVG file.

This makes it easy to dump all the information from an .edr/trr/xtc/etc file
and step through it visually in 30 seconds. That, in turn, makes me way more
likely to look at as much information as possible as part of my normal

I've only tested this on a few of my own XVG files, so it's possible that my
simple XVG parser doesn't cover everything.

Here's the help output. Let me know if anyone finds it useful.

Michael-Lerners-MacBook-Pro-2: ~ mglerner$ ./xvgviewer.py --help
Usage: Just a simple XVG viewer.

For each column in the XVG file, we plot

  - the raw data (light blue)
  - a running average (black)
  - block averages (green)

We also print out

  - the average over the simulation
  - standard error over the blocks
  - average of the standard deviations within each block

Block length is reported in number of frames, and its meaning will
therefore depend on the settings in your .mdp file as well as the
arguments you used when making the .xvg file.

We attempt to get units out of the XVG file, and we convert times to
nanoseconds before plotting.

This program requires

 - Python 2.5 or 2.6
 - wxPython (http://www.wxpython.org/)
 - numpy 1.3.0+ (http://numpy.scipy.org/)
 - matplotlib 0.99.0+ (http://matplotlib.sourceforge.net/)
 - traits 3.2.0+ (http://code.enthought.com/projects/traits/)

All of which will be installed for you if you use the Enthought Python
Distribution (http://enthought.com/).

I mostly wrote this as a quick way to figure out how to use the Traits
GUI, but feel free to email me (m g lerner atsign gmail dot com) if
you have any questions.

  -h, --help            show this help message and exit
  -f FILE, --file=FILE  The XVG file [default energy.xvg]



Michael Lerner, Ph.D.
IRTA Postdoctoral Fellow
Laboratory of Computational Biology NIH/NHLBI
5635 Fishers Lane, Room T909, MSC 9314
Rockville, MD 20852 (UPS/FedEx/Reality)
Bethesda MD 20892-9314 (USPS)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20091105/a113b9a8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xvgviewer.py
Type: application/octet-stream
Size: 10855 bytes
Desc: not available
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20091105/a113b9a8/attachment.obj>

More information about the gromacs.org_gmx-users mailing list