About
The pygrace project is a set of tools that were designed to
act as an interface between
the Python programming
language and
the Grace
plotting tool. The pygrace package is a combination of two
previously distinct projects:
- PyGrace, developed by members of
the Amaral
Lab. The functionality of the old PyGrace package is now
in the new package under the name of templates.
- pygrace, developed
by Mike
McKerns. The functionality of the previous pygrace
package is available in the new package under the
name session.
Templates allow users to create complex Grace files
from within Python; they are intended to:
- assist in the automated creation of many figures for use
in large-scale exploratory data analysis.
- encourage code reuse, by offering an object-oriented
structure.
- reduce the time required to create figures for
scientific journal articles.
A pygrace session offers bindings to xmgrace as an
alternative to the Grace console. This provides users with a
powerful 2D scientific visualization platform that can be used
as an alternative to MATLAB or Mathematica.
pygrace sessions were created by Mike McKerns, and pygrace
templates were created by Dean Malmgren, Mike Stringer, and
members of the Amaral Lab. Mike M., Dean M., and Mike S. are
the maintainers of the pygrace project on SourceForge.
To get started with pygrace, see the tutorial.
Timeline
pygrace
Fall, 2009 (coming soon!)
The joint project will be merged
back into the trunk.
August, 2009
In a branch in the SourceForge
repository, we merged the two projects. To begin, we are
keeping the two projects quite separate by including them
as distinct subpackages in the pygrace package,
pygrace.templates and pygrace.session.
June, 2009
Started discussing a merge of
PyGrace (Dean Malmgren, Mike Stringer) and pygrace (Mike
McKerns). Since the function of the two projects were
quite different, we decided that a merge could be
useful.
PyGrace
April, 2009
Roger Guimera and Irmak Sirer
joined the PyGrace team and contributed valuable
code and input.
December, 2008
Merged the fancy new
object-oriented branch into trunk, and created the
current SourceForge pygrace project (unfortunately, the
SourceForge page is not case-sensitive, so the PyGrace
project inadvertently clashed with the name of
pygrace).
Fall 2008
Mike Stringer and Dean Malmgren
created a branch and rewrote the entire PyGrace project
code in an object oriented manner. Also, we
added ColorBrewer
functionality in the object-oriented branch.
2006 — 2008
PyGrace is used by some members
of the Amaral Lab, but the Python code of each user for
making plots quickly grows unwieldy. It is clear that
the PyGrace code needs to be more object-oriented to
facilitate the reuse of common patterns.
2006 — 2008
PyGrace is used by some members
of the Amaral Lab, but the Python code of each user for
making plots quickly grows unwieldy. It is clear that
the PyGrace code needs to be more object-oriented to
facilitate the reuse of common patterns. Mike Stringer
created a branch, and rewrote the code in an object
oriented manner.
Summer, 2006
Alex F. (a high school summer
intern) completes many details of implementing every
attribute of Grace plots into PyGrace.
April, 2006
The PyGrace project
begins. Mike Stringer, Dean Malmgren, Roger Guimera, Sam
Seaver, Erin Sawardecker each make valuable contributions
to PyGrace.
April, 2006
Inspired by hand-rolled Python
wrappers around other programs (such as xfig), the Amaral
Lab starts discussing the desire for a Python interface
for creating nicely formatted plots. Since the Amaral Lab
already heavily used Grace for simple data analysis, a
Python wrapper around Grace was a natural fit.
pygrace
Coming soon
The history of pygrace.
Tutorial
Important note: As of August 2009, the pygrace package is
in a time of transition. As such, the following tutorial
will be out of date very soon, but will be replaced by a
more comprehensive one. The following tutorial applies to
the pygrace/trunk version of the project.
Visualizing data may be an integral part of the data
analysis process, however, pygrace templates are
explicity intended to not perform any type of data
analysis. Not even computing an average. Especially
not performing a linear regression. This principle
underlies much of the structure of pygrace templates, with
the purpose discouraging users to adopt a “black
box” approach to analysis. While visualizing data
should be as painless as possible, the pain required to
understand the analysis process is considered necessary, or
even desirable (if you're into that sort of thing).
This tutorial is meant to help with installation of pygrace,
and give new users an idea of how pygrace is structured.
After reading this brief document, the next step for
learning to use pygrace is to go through the examples that
are located in the pygrace.templates
Examples directory.
Installation
As pygrace is still young, the only method yet available to
install it is to check out the source code from the
Subversion repository at
the SourceForge
page. The next section describes how to do so.
Installing a development version
To check out the PyGrace repository, change to a directory where you
want to put PyGrace, and type:
svn co https://pygrace.svn.sourceforge.net/svnroot/pygrace/trunk
PyGrace
For now, it is important to use the “correct”
capitalization of PyGrace (capital P and G). Then, make
sure that the directory you are in is on the python path
(the PYTHONPATH environment variable). One convenient way
to do this is to add a line in your ~/.bashrc file that
says:
export PYTHONPATH:\$PYTHONPATH:/path/to/your/pybrary/
Notice that, unlike the lame-o author of this documentation,
it is not necessary to call the directory that PyGrace is
located “the pybrary.” After the location of
PyGrace is on the PYTHONPATH, import statements in python
scripts will look in that directory (.../pybrary/) for
modules, and since PyGrace is a package (it has an
__init__.py file in the directory), the directory will act
like a module. Now, make sure that you have executed the
~/.bashrc file by running.
source ~/.bashrc
That should do the trick. You can test that python can find the
PyGrace package by opening an interactive python prompt and
typing
import PyGrace
If no error is raised, then installation was succesful!
Getting started
PyGrace was designed so that, “anything you can do in
Grace, you can do in PyGrace.” The best way to get
started is to go through the examples in the Examples
directory. Each example is fully commented. You may also
find the following three documents helpful:
By refering to these diagram and going through the examples,
you can develop a sense of how to use PyGrace. Remember to
report bugs using the SourceForge page!
Screenshots
Here are some examples of the types of figures that you can
create with pygrace templates. If you are interested in
contributing a screenshot of a figure made in pygrace,
contact us.