[yt-users] slice from fixed resolution data

Matthew Turk matthewturk at gmail.com
Tue Jun 12 05:23:25 PDT 2012


Hi Wolfram,

On Tue, Jun 12, 2012 at 8:20 AM, Wolfram Schmidt
<schmidt at astro.physik.uni-goettingen.de> wrote:
> Hi,
>
> is it possible to produce a slice of fixed resolution data, extracted with
> covering_grid? I tried the following:
>
> pf = load(file)
> cube = pf.h.covering_grid(0, ...)
> pc = PlotCollection(cube)
> pc.add_slice(...)
>
> But this produces again a slice from the multi-level data as if I had
> used pc = PlotCollection(pf).

It is possible, but it's a bit more DIY.  You can do it with
matplotlib directly; unlike with slices through AMR volumes, the
covering grid doesn't need any processing to turn it into an image
buffer.  For instance, if "index" is the integer index you want to
plot (along the X axis):

import pyplot
pyplot.imshow(na.log10(cube["Density"][index, :, :]), interpolation="nearest")
pyplot.savefig("cube.png")


I use log10 here, and also I set the interpolation to 'nearest'
because otherwise MPL defaults to linear.

Hope that helps,

Matt

>
> Thanks,
> Wolfram
> _______________________________________________
> 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