[yt-users] New means of simple interaction

Matthew Turk matthewturk at gmail.com
Thu Aug 21 22:54:27 PDT 2008


Hi guys,

Are you tired of having to include lots of boilerplate code in your
python scripts?

I've committed a change (r737) in trunk/ that should help cut down on
this -- but might also make things significantly more terse!

The idea has long been that there were standard workflows in yt --
generating static outputs, adding these to plot collections, and
making plots.  These are now accessible from a pipe-like interface.
For example:

>>> from yt.mods import *
>>> pf = "galaxy1200" | static
>>> pf | slicer
>>> pf | slicer(field="Temperature", width=(1.0,'kpc'))
>>> pf | slicer_y(field="H2I_Fraction", width=(1.0,'au'))
>>> pf | projector(field="Density", width=(1.0,'kpc'), name='hiya')

or if you want to be ultra terse, forget the pf part:

>>> from yt.mods import *
>>> "galaxy1200" | slicer
>>> pf | projector(field="Temperature", weight_field="Density", width=(1.0,'kpc'), name='hiya')

I'm thinking about adding some more of these -- for contour finding
among other things -- and using iterators to speed this whole workflow
up.

Let me know if you like this, or if there are problems, or whatever!
There are likely some bugs, but I've run a bunch of tests and it seems
to work.

-Matt



More information about the yt-users mailing list