[yt-users] interactive mode on datastar

Matthew Turk matthewturk at gmail.com
Thu Jul 17 07:24:33 PDT 2008


Hi guys,

I've added a new means of plotting, currently only in trunk/ and
currently undocumented, that will pop up windows in the 'pylab'
environment with the displayed plots in them.

Currently, this works best within IPython, run in pylab mode ('ipython -pylab').

I've installed IPython on datastar, along with the TkAgg backend for
pylab.  If you've never played with pylab, then you shouldn't have any
problems -- but if you have, you may need to modify your matplotlibrc
file to get it to use the TkAgg backend.  Additionally, for some
reason IPython crashes on tab completion for me.  I'll let you know if
I find a solution to that.  (IPython has a ton of magic in it; I am by
no means an expert, and I don't even usually use it very often, but
it's pretty cool.)

So if you want a PlotCollection object that will pop up windows, you
need to ask for PlotCollectionInteractive.  I've included below an
example script for how to do basic stuff.  These commands should be
typed in or %run (see below) at the prompt given by running ipython
-pylab .  All of these require that you have my python libraries in
your setup (http://yt.enzotools.org/doc/getting_started.html#datastar-sdsc)
but you additionally need to have my bin path in your PATH variable
(/users/stanford/mturk/local/bin/).  The documentation will be updated
accordingly, but it's still in testing and I wanted to give you a
heads up.

>>>
from yt.mods import *
pf = EnzoStaticOutput("/users/stanford/mturk/local/src/yt/trunk/tests/DD0010/moving7_0010")
pc = PlotCollectionInteractive(pf, center=[0.75,0.75,0.75])
pc.add_phase_sphere(0.1,'1', ["Density","Temperature","x-velocity"])
pc.add_slice("Density", 0)
<<<

Note that there's *nothing* special here -- except that instead of
making a PlotCollection, we make a PlotCollectionInteractive.

IPython has a "%run" command that will execute a script that exists in
the file system.  So if you have these commands (or any commands,
really) in a file, you can type "%run my_file.py" at the IPython
prompt and it will execute them.  For more information about IPython,
which I've been told will "change your life!" you can see:

http://ipython.scipy.org/

or the videos at:

http://showmedo.com/videos/series?name=CnluURUTV

Additionally, Jeff (our man in Orion-ville) is an expert at IPython,
and I be he can answer any questions you might have.

Please let me know what you think, and if you have any suggestions.
Also, if any of these instructions don't work, please reply to the
list!

-Matt



More information about the yt-users mailing list