[yt-users] Simple radial profile

Matthew Turk matthewturk at gmail.com
Wed Oct 14 08:32:14 PDT 2009


Hi Nicholas,

I believe the y_bounds for a radial profile is only defined at
plot-time, unless you want to apply a truncation for maximum values --
which there is no user-friendly facility for in yt.  (But it can be
done by accessing the 'data' property of the profile object.) To apply
a y-axis scaling on the image, you can do something like (building on
the example "Simple Radial Profile" here
http://yt.enzotools.org/doc/cookbook/recipes.html )

>>
from yt.mods import * # set up our namespace

fn = "RedshiftOutput0005" # parameter file to load

pf = load(fn) # load data
pc = PlotCollection(pf) # defaults to center at most dense point
pc.add_profile_sphere(10.0, "mpc", # how many of which unit at pc.center
    ["RadiusMpc", "Density"], weight="CellMassMsun", # x, y, weight
     x_bounds = (1e-3, 10.0))  # cut out zero-radius and tiny-radius cells
    # But ... weight defaults to CellMassMsun, so we're being redundant here!
pc.set_ylim( 1e0, 1e6 )
pc.save(fn) # save all plots
<<

Note that calling 'pc.set_ylim' will set it on all the plots hanging
off that plot collection.  Additionally, while I was preparing this
email, I found a bug in the set_ylim routine -- which would prevent
this recipe from working at all!  I've committed a fix in revision
1483 to both the yt-1.5 branch and the trunk.

Let me know if there are any problems!

-Matt

On Wed, Oct 14, 2009 at 8:19 AM, Nicholas M. Earl <earlnich at msu.edu> wrote:
> Hey all,
>
> I was hoping that someone might have a suggestion or answer for an issue I'm
> having with generating simple radial profiles from simulation data. The
> profiles automatically generate axis bounds and while I can set the bounds
> on the x axis using the x_bounds parameter, I don't know how--or if it's
> even possible--to set a similar restriction for the y axis. (I have tried
> simply setting a y_bounds parameter, but the script breaks stating that
> y_bounds is unrecognized).
>
> Any suggestions or help would be greatly appreciated,
> Nicholas Earl
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list